This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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]

Re: Allocate Class instancs on heap; not conservatively scan DSOs


Bryce McKinlay writes:

 > One suggestion - I think it would be good to make the comments a bit 
 > more clear on which libgcj functions are called by the compiler to 
 > register classes for the -findirect-classes case, and which are for the 
 > non-indirect case. Its obvious from reading the patch why there is both 
 > a _Jv_RegisterClasses and  _Jv_RegisterNewClasses, but it may not be for 
 > someone browsing the code later.
 > 
 > Also, the comment on emit_indirect_register_classes() doesn't look right 
 > - it doesn't call _Jv_NewClassFromInitailizer directly.

Thanks.

Andrew.

2006-05-10  Andrew Haley  <aph@redhat.com>

	* java/lang/natClassLoader.cc: Add comments.

Index: libjava/java/lang/natClassLoader.cc
===================================================================
--- libjava/java/lang/natClassLoader.cc (revision 113674)
+++ libjava/java/lang/natClassLoader.cc (working copy)
@@ -156,6 +156,30 @@
   loader->loadedClasses->remove(klass->name->toString());
 }
 
+
+// Class registration.
+//
+// There are two kinds of functions that register classes.  
+//
+// Type 1:
+//
+// These take the address of a class that is in an object file.
+// Because these classes are not allocated on the heap, It is also
+// necessary to register the address of the object for garbage
+// collection.  This is used with the "old" C++ ABI and with
+// -findirect-dispatch -fno-indirect-classes.
+//
+// Type 2:
+//
+// These take an initializer struct, create the class, and return the
+// address of the newly created class to their caller.  These are used
+// with -findirect-dispatch.
+//
+// _Jv_RegisterClasses() and _Jv_RegisterClasses_Counted() are
+// functions of Type 1, and _Jv_NewClassFromInitializer() and
+// _Jv_RegisterNewClasses() are of Type 2.
+
+
 // This function is called many times during startup, before main() is
 // run.  At that point in time we know for certain we are running 
 // single-threaded, so we don't need to lock when adding classes to the 

2006-05-10  Andrew Haley  <aph@redhat.com>

	* class.c (emit_indirect_register_classes): Fix comment.

Index: gcc/java/class.c
===================================================================
--- gcc/java/class.c    (revision 113532)
+++ gcc/java/class.c    (working copy)
@@ -2539,8 +2539,8 @@
   VEC_safe_push (tree, gc, registered_class, node);
 }
 
-/* Emit a function that calls _Jv_NewClassFromInitializer for every
-   class.  */
+/* Emit a function that calls _Jv_RegisterNewClasses with a list of
+   all the classes we have emitted.  */
 
 static void
 emit_indirect_register_classes (tree *list_p)


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