This is the mail archive of the java-patches@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]
Other format: [Raw text]

Patch: FYI: document static field marking


I'm checking this in on the trunk.

Andrew pointed out that it is not obvious how static fields are
marked.  This documents it a bit.

Tom

Index: ChangeLog
from  Tom Tromey  <tromey@redhat.com>

	* interpret.cc (do_allocate_static_fields): Added comment.

Index: interpret.cc
===================================================================
--- interpret.cc	(revision 111573)
+++ interpret.cc	(working copy)
@@ -3882,7 +3882,17 @@
   _Jv_InterpClass *iclass = (_Jv_InterpClass *) klass->aux_info;
 
   // Splitting the allocations here lets us scan reference fields and
-  // avoid scanning non-reference fields.
+  // avoid scanning non-reference fields.  How reference fields are
+  // scanned is a bit tricky: we allocate using _Jv_AllocRawObj, which
+  // means that this memory will be scanned conservatively (same
+  // difference, since we know all the contents here are pointers).
+  // Then we put pointers into this memory into the 'fields'
+  // structure.  Most of these are interior pointers, which is ok (but
+  // even so the pointer to the first reference field will be used and
+  // that is not an interior pointer).  The 'fields' array is also
+  // allocated with _Jv_AllocRawObj (see defineclass.cc), so it will
+  // be scanned.  A pointer to this array is held by Class and thus
+  // seen by the collector.
   char *reference_fields = (char *) _Jv_AllocRawObj (pointer_size);
   char *non_reference_fields = (char *) _Jv_AllocBytes (other_size);
 


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