This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Patch: FYI: GC marking fixlet
- From: Tom Tromey <tromey at redhat dot com>
- To: Java Patch List <java-patches at gcc dot gnu dot org>
- Date: 24 Jun 2005 16:08:15 -0600
- Subject: Patch: FYI: GC marking fixlet
- Reply-to: tromey at redhat dot com
I'm checking this in on the trunk.
It is possible for a class in an error state to have a field whose
type is NULL. In this case the marker will crash. This patch fixes
it by checking the type first.
The marker is fairly ugly fwiw. This area could use some cleanups.
Tom
Index: ChangeLog
from Tom Tromey <tromey@redhat.com>
* boehm.cc (_Jv_MarkObj): Handle case where field's type is NULL.
Index: boehm.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/boehm.cc,v
retrieving revision 1.48
diff -u -r1.48 boehm.cc
--- boehm.cc 28 Mar 2005 08:09:37 -0000 1.48
+++ boehm.cc 24 Jun 2005 22:10:23 -0000
@@ -1,6 +1,6 @@
// boehm.cc - interface between libjava and Boehm GC.
-/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004
+/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
Free Software Foundation
This file is part of libgcj.
@@ -191,7 +191,11 @@
// static members.
// Note that field->u.addr may be null if the class c is
// JV_STATE_LOADED but not JV_STATE_PREPARED (initialized).
- if (JvFieldIsRef (field) && p && field->isResolved())
+ // Note also that field->type could be NULL in some
+ // situations, for instance if the class has state
+ // JV_STATE_ERROR.
+ if (field->type && JvFieldIsRef (field)
+ && p && field->isResolved())
{
jobject val = *(jobject*) p;
p = (GC_PTR) val;