This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

PATCH Re: GC and GCJ


Antonio Ake wrote:

>I tried with -enable-java-gc=no, I had this message. I am working with
>gcc.3.0.1 release for linux x/86.
>../../../gcc-3.0.1/libjava/exception.cc:31:21: gc_priv.h: No such file or
>directory
>../../../gcc-3.0.1/libjava/exception.cc:32:21: gc_mark.h: No such file or
>directory
>../../../gcc-3.0.1/libjava/exception.cc:33:28: include/gc_gcj.h: No such
>file or directory
>
Here's a patch for that, which I will check in. I havn't tested it with 
a no-gc configuration. Let me know how you get on. For 3.0 you will need 
to remove the gc_priv.h etc includes from exception.cc as well. This 
patch would be pretty harmless to apply to the 3.0 branch also.

regards

Bryce


2001-09-10  Bryce McKinlay  <bryce@waitaki.otago.ac.nz>

	* include/jvm.h (_Jv_AllocRawObj): New prototype.
	* boehm.cc (_Jv_AllocRawObj): Implement.
	* nogc.cc (_Jv_AllocRawObj): Likewise.
	* exception.cc (_Jv_Throw): Use _Jv_AllocRawObj, not GC_malloc.

Index: include/jvm.h
===================================================================
RCS file: /cvs/gcc/gcc/libjava/include/jvm.h,v
retrieving revision 1.38
diff -u -r1.38 jvm.h
--- jvm.h	2001/09/06 22:32:53	1.38
+++ jvm.h	2001/09/10 01:09:22
@@ -114,6 +114,9 @@
 void *_Jv_AllocArray (jsize size, jclass cl) __attribute__((__malloc__));
 /* Allocate space that is known to be pointer-free.  */
 void *_Jv_AllocBytes (jsize size) __attribute__((__malloc__));
+/* Allocate space for a new non-Java object, which does not have the usual 
+   Java object header but may contain pointers to other GC'ed objects.  */
+void *_Jv_AllocRawObj (jsize size) __attribute__((__malloc__));
 /* Explicitly throw an out-of-memory exception.	*/
 void _Jv_ThrowNoMemory() __attribute__((__noreturn__));
 /* Allocate an object with a single pointer.  The first word is reserved
Index: boehm.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/boehm.cc,v
retrieving revision 1.26
diff -u -r1.26 boehm.cc
--- boehm.cc	2001/08/18 01:01:51	1.26
+++ boehm.cc	2001/09/10 01:09:25
@@ -375,6 +375,14 @@
   return obj;
 }
 
+/* Allocate space for a new non-Java object, which does not have the usual 
+   Java object header but may contain pointers to other GC'ed objects. */
+void *
+_Jv_AllocRawObj (jsize size)
+{
+  return (void *) GC_MALLOC (size);
+}
+
 static void
 call_finalizer (GC_PTR obj, GC_PTR client_data)
 {
Index: nogc.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/nogc.cc,v
retrieving revision 1.9
diff -u -r1.9 nogc.cc
--- nogc.cc	2001/05/24 05:40:36	1.9
+++ nogc.cc	2001/09/10 01:09:25
@@ -66,6 +66,13 @@
   return obj;
 }
 
+void *
+_Jv_AllocRawObj (jsize size)
+{
+  total += size;
+  return calloc (size, 1);
+}
+
 void
 _Jv_RegisterFinalizer (void *, _Jv_FinalizerFunc *)
 {
Index: exception.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/exception.cc,v
retrieving revision 1.17
diff -u -r1.17 exception.cc
--- exception.cc	2001/08/31 12:27:32	1.17
+++ exception.cc	2001/09/10 01:09:26
@@ -20,8 +20,6 @@
 
 #include "unwind.h"
 
-#include <gc.h>
-
 
 struct alignment_test_struct
 {
@@ -73,9 +71,8 @@
 extern "C" void
 _Jv_Throw (jthrowable value)
 {
-  /* FIXME: Use the proper API to the collector.  */
   java_exception_header *xh
-    = static_cast<java_exception_header *>(GC_malloc (sizeof (*xh)));
+    = static_cast<java_exception_header *>(_Jv_AllocRawObj (sizeof (*xh)));
 
   if (value == NULL)
     value = new java::lang::NullPointerException ();

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]