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]

RE: SIGSEGV in GC_mark_from



On Thu, 6 Sep 2001, Boehm, Hans wrote:
> Is that true for the pointer you are seeing?  It sounds like the linked to
> object has a proper vtable pointer, and was thus initialized after this
> object was last added to a free list?

That's consistent with my observations.  I'm doubting whether it is really
a free list, though I don't have a better explanation.

GC_find_header() dies on a signal when invoked from gdb.  I can't say if
it's a gdb bug or there is really something wrong.  I've tried a hardware
watchpoint which also didn't behave as I expected.

> Do any of these objects appear near the beginning of the appropriate free
> list?  GC_gcjobjfreelist is a pointer to an array of free list pointers.
> The (152/4)th entry should be the right one (where 4 is the number is the
> number of bytes in a word, i.e. it would be 8 on Itanium or Alpha).

The 152 byte target object doesn't appear to be on a free list.  

If I am going to debug this I need better tools or good guesswork.  On a
hunch I tried the patch below, and it hasn't failed since.  This
still isn't making any sense to me.

[On a more encouraging note, the application is otherwise very stable and
performance is acceptable.  The purpose of this exercise is finding a
suitable replacement for ExactVM on Solaris, which apparently ceased
development at 1.2.2.  The 1.3 Hotspot VM consistently crashes when
subjected to the same tests as libgcj.]

Index: include/boehm-gc.h
===================================================================
RCS file: /cvs/gcc/gcc/libjava/include/boehm-gc.h,v
retrieving revision 1.4
diff -u -p -r1.4 boehm-gc.h
--- boehm-gc.h  2001/05/24 05:40:36     1.4
+++ boehm-gc.h  2001/09/07 20:03:10
@@ -28,13 +28,25 @@ extern "C"
 
 extern "C" void * GC_gcj_malloc(size_t, void *);
 extern "C" void * GC_malloc_atomic(size_t);
+extern "C" void * GC_malloc(size_t);
 
 inline void *
 _Jv_AllocObj (jsize size, jclass klass)
 {
-  // This should call GC_GCJ_MALLOC, but that would involve
-  // including gc.h.
-  return GC_gcj_malloc (size, klass->vtable);
+  void *obj;
+
+  if (size > 120)
+    {
+      // Avoid _Jv_MarkObj for now.
+      obj = GC_malloc (size);
+      *((_Jv_VTable **) obj) = klass->vtable;
+    }
+  else
+    // This should call GC_GCJ_MALLOC, but that would involve
+    // including gc.h.
+    obj = GC_gcj_malloc (size, klass->vtable);
+
+  return obj;
 }
 
 inline void *



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