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]

Patch: FYI: Update gcj docs about class init


I'm checking this in.  I've had this patch lying around for a long
time; I don't know why I didn't check it in before.

This updates the gcj documentation to reflect that you need to
allocate arrays through the CNI functions.

Tom

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

	* gcj.texi (Class Initialization): Mention class initialization of
	arrays.

Index: gcj.texi
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/gcj.texi,v
retrieving revision 1.33
diff -u -r1.33 gcj.texi
--- gcj.texi 4 Aug 2002 16:55:06 -0000 1.33
+++ gcj.texi 16 Aug 2002 21:46:34 -0000
@@ -1316,16 +1316,17 @@
 However, this is fairly painless because of the conventions assumed by
 the Java system.
 
-First, @code{libgcj} will make sure a class is initialized
-before an instance of that object is created.  This is one
-of the responsibilities of the @code{new} operation.  This is
-taken care of both in Java code, and in C++ code.  (When the G++
-compiler sees a @code{new} of a Java class, it will call
-a routine in @code{libgcj} to allocate the object, and that
-routine will take care of initializing the class.)  It follows that you can
-access an instance field, or call an instance (non-static)
-method and be safe in the knowledge that the class and all
-of its base classes have been initialized.
+First, @code{libgcj} will make sure a class is initialized before an
+instance of that object is created.  This is one of the
+responsibilities of the @code{new} operation.  This is taken care of
+both in Java code, and in C++ code.  When G++ sees a @code{new} of a
+Java class, it will call a routine in @code{libgcj} to allocate the
+object, and that routine will take care of initializing the class.
+Note however that this does not happen for Java arrays; you must
+allocate those using the appropriate CNI function.  It follows that
+you can access an instance field, or call an instance (non-static)
+method and be safe in the knowledge that the class and all of its base
+classes have been initialized.
 
 Invoking a static method is also safe.  This is because the
 Java compiler adds code to the start of a static method to make sure


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