boehm.cc (_Jv_MarkObj): Don't fail if class object has been allocated but not initial...
authorTom Tromey <tromey@redhat.com>
Wed, 25 Sep 2002 20:14:37 +0000 (20:14 +0000)
committerTom Tromey <tromey@gcc.gnu.org>
Wed, 25 Sep 2002 20:14:37 +0000 (20:14 +0000)
* boehm.cc (_Jv_MarkObj): Don't fail if class object has been
allocated but not initialized.

From-SVN: r57514

libjava/ChangeLog
libjava/boehm.cc

index b1f7f40763c292de26cebdcf592cc06e2e5af211..d4a611bbbf5ad8710180b8252aad0b841372cf8c 100644 (file)
@@ -1,3 +1,8 @@
+2002-09-25  Tom Tromey  <tromey@redhat.com>
+
+       * boehm.cc (_Jv_MarkObj): Don't fail if class object has been
+       allocated but not initialized.
+
 2002-09-25  Jesse Rosenstock  <jmr@ugcs.caltech.edu>
 
        Fix for PR libgcj/7766:
index be2855aef72b9b410054bb608c6d1a76682fedcc..466c9223ac81f422bf7c2ad2b9c8bc966f963583 100644 (file)
@@ -1,6 +1,6 @@
 // boehm.cc - interface between libjava and Boehm GC.
 
-/* Copyright (C) 1998, 1999, 2000, 2001  Free Software Foundation
+/* Copyright (C) 1998, 1999, 2000, 2001, 2002  Free Software Foundation
 
    This file is part of libgcj.
 
@@ -134,6 +134,12 @@ _Jv_MarkObj (void *addr, void *msp, void *msl, void * /* env */)
       p = (ptr_t) c->methods;
       MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, c, c6label);
 
+      // The vtable might have been set, but the rest of the class
+      // could still be uninitialized.  If this is the case, then
+      // c.isArray will SEGV.  We check for this, and if it is the
+      // case we just return.
+      if (__builtin_expect (c->name == NULL, false))
+       return mark_stack_ptr;
 
       if (! c->isArray() && ! c->isPrimitive())
        {