This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Re: glibc-2.2.5 bug triggered by Java interpreter
- From: Mark Wielaard <mark at klomp dot org>
- To: java-patches at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: 11 Oct 2002 21:42:38 +0200
- Subject: Re: glibc-2.2.5 bug triggered by Java interpreter
- References: <OF9AF5D7D8.919DA8C1-ONC1256C46.0051650B@de.ibm.com><87wup0oaew.fsf@fleche.redhat.com> <1033740983.29748.446.camel@elsschot> <87k7kuc8y3.fsf@fleche.redhat.com>
Hi,
On Mon, 2002-10-07 at 22:04, Tom Tromey wrote:
> >>>>> "Mark" == Mark Wielaard <mark@klomp.org> writes:
>
> Mark> The attached patch (untested) does this.
>
> I think this is ok.
I now tested that it doesn't introduce regressions.
2002-10-11 Mark Wielaard <mark@klomp.org>
Fix for PR libgcj/8142
* java/lang/natClassLoader.cc (findClass): Skip inner classes when
loading native modules.
OK, to commit?
> Mark> But whatever we decide we should at least document it
> Mark> somewhere. I looked but couldn't find this in the gcj manual. Is
> Mark> it documented somewhere else?
>
> It is alluded to in the `Invoking gij' node, but never explicitly
> documented. I thought there was a PR for this but I can't find that
> either.
I added a new section to the manual to document things like this.
2002-10-11 Mark Wielaard <mark@klomp.org>
* gcj.texi (Compatibility): Add Limitations and Extensions section.
OK, to commit?
Cheers,
Mark
Index: java/lang/natClassLoader.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/lang/natClassLoader.cc,v
retrieving revision 1.51
diff -u -u -r1.51 natClassLoader.cc
--- java/lang/natClassLoader.cc 30 Sep 2002 05:19:09 -0000 1.51
+++ java/lang/natClassLoader.cc 4 Oct 2002 14:09:59 -0000
@@ -204,7 +204,14 @@
// by `lib-gnu-pkg.so' and `lib-gnu.so'. If loading one of
// these causes the class to appear in the cache, then use it.
java::lang::StringBuffer *sb = new java::lang::StringBuffer (JvNewStringLatin1("lib-"));
- jstring so_base_name = (sb->append (name)->toString ())->replace ('.', '-');
+ // Skip inner classes
+ jstring cn;
+ jint ci = name->indexOf('$');
+ if (ci == -1)
+ cn = name;
+ else
+ cn = name->substring (0, ci);
+ jstring so_base_name = (sb->append (cn)->toString ())->replace ('.', '-');
// Compare against `3' because that is the length of "lib".
while (! klass && so_base_name && so_base_name->length() > 3)
Index: gcj.texi
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/gcj.texi,v
retrieving revision 1.39
diff -u -r1.39 gcj.texi
--- gcj.texi 4 Oct 2002 15:36:12 -0000 1.39
+++ gcj.texi 11 Oct 2002 19:19:02 -0000
@@ -487,14 +487,21 @@
documentation work against us. So, there are caveats to using
@command{gcj}.
+@menu
+* Limitations::
+* Extensions::
+@end menu
+
+@node Limitations
+@section Standard features not yet supported
+
This list of compatibility issues is by no means complete.
@itemize @bullet
@item
-@command{gcj} implements the JDK 1.1 language. It supports inner classes,
-though these are known to still be buggy. It does not yet support the
-Java 2 @code{strictfp} keyword (it recognizes the keyword but ignores
-it).
+@command{gcj} implements the JDK 1.2 language. It supports inner classes
+and the new 1.4 @code{assert} keyword. It does not yet support the Java 2
+@code{strictfp} keyword (it recognizes the keyword but ignores it).
@item
@code{libgcj} is largely compatible with the JDK 1.2 libraries.
@@ -510,6 +517,31 @@
the appropriate response.
@end itemize
+@node Extensions
+@section Extra features unique to gcj
+
+The main feature of @command{gcj} is that it can compile programs written in
+the Java programming language to native code. Most extensions that have been
+added are to facilitate this functionality.
+
+@itemize @bullet
+@item
+@command{gcj} makes it easy and efficient to mix code written in Java and C++.
+@xref{About CNI}, for more info on how to use this in your programs.
+
+@item
+When you compile your classes into a shared library they can be automatically
+loaded by the @code{libgcj} system classloader. When trying to load a class
+@code{gnu.pkg.SomeClass} the system classloader will first try to load the
+shared library @file{lib-gnu-pkg-SomeClass.so}, if that fails to load the
+class then it will try to load @file{lib-gnu-pkg.so} and finally when the
+class is still not loaded it will try to load @file{lib-gnu.so}. Note that
+all @samp{.}s will be transformed into @samp{-}s and that searching
+for inner classes starts with their outermost outer class. If the class
+cannot be found this way the system classloader tries to use
+the @code{libgcj} bytecode interpreter to load the class from the standard
+classpath.
+@end itemize
@node Invoking gcjh
@chapter Invoking gcjh