aboutsummaryrefslogtreecommitdiff
path: root/gcc/java/gcj.texi
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2002-08-16 21:49:33 +0000
committerTom Tromey <tromey@gcc.gnu.org>2002-08-16 21:49:33 +0000
commitca75573a5d8f17e1baa009caef0ea72bcece3932 (patch)
treea81a851051e84ed06c1f2de52ebdce8c9f6f65f9 /gcc/java/gcj.texi
parentf97a5bda3af8c5396ed5704b78ec634c82987a48 (diff)
downloadgcc-ca75573a5d8f17e1baa009caef0ea72bcece3932.zip
gcc-ca75573a5d8f17e1baa009caef0ea72bcece3932.tar.gz
gcc-ca75573a5d8f17e1baa009caef0ea72bcece3932.tar.bz2
gcj.texi (Class Initialization): Mention class initialization of arrays.
* gcj.texi (Class Initialization): Mention class initialization of arrays. From-SVN: r56386
Diffstat (limited to 'gcc/java/gcj.texi')
-rw-r--r--gcc/java/gcj.texi21
1 files changed, 11 insertions, 10 deletions
diff --git a/gcc/java/gcj.texi b/gcc/java/gcj.texi
index 165f122..ac1702f 100644
--- a/gcc/java/gcj.texi
+++ b/gcc/java/gcj.texi
@@ -1316,16 +1316,17 @@ programmer's responsibility to make sure classes are initialized.
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