This is the mail archive of the java@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]

Re: Patch in libjava/exception.cc


Hi,

On Fri, May 25, 2001 at 12:23:09PM +0200, Erwin Bolwidt wrote:
> I have a fix which works for me, but I'm not sure why it works so I hope
> someone more knowledgable can have a look.
> 
> The fix is to replace:
> 
> exception.cc:348: if (_Jv_IsInstanceOf (xh->value, catch_type))
> 
> with
> 
> exception.cc:348: if (catch_type != NULL && _Jv_IsInstanceOf (xh->value,
> catch_type))
> 
> This makes everything work and causes no further errors in my app or in
> the gcj libraries.

I checked that this patch does not change the results of running gcj on
the Jacks testsuite and does not change the result of running make
check-target-libjava. (This is on Debian GNU/Linux woody on PowerPC,
with a checkout of gcc 3.0 of May 26.)

Hopefully someone can look at what is happening here because this 'fix'
makes KopisSusu <http://www.klomp.org/KopiSusu/> a java compiler written
in java usable when compiled (from class files) to native code with gcj.

I finally had some time to create an testcase that can be repeated by
someone that wants to see what is really happening here. Here are some
easy steps to recreate the problem:

Get http://www.klomp.org/mark/ksusu-gcj-test.tar.gz (1.9M)

In it you will find a jar file with all classes needed (ksusu-all.jar)
and a directory (ksusu-test-files) with java files that can be used to
test the ksusu binary when compiled with gcj.

To compile it to native code you just do:
gcj -o ksusu-bin --main=org.ksusu.compiler.Main ksusu-all.jar

There will be one warning about unreachable code in
org.ksusu.optimize.Optimizer.

Set your CLASSPATH to something like:
.:/opt/mark/ksusu-gcj-test/ksusu-all.jar:/usr/local/gcc-3.0/share/libgcj.jar

Now if you cd into ksusu-test-files and try to compile any of testfiles
in there you will notice that the compile just hangs.
(e.g. cd ksusu-test-files; ../ksusu-bin T151221je1.java)

When you compile a libgcj library with the suggested patch from Erwin
and point your LD_LIBRARY_PATH to it then you will see that the ksusu
binary will correctly work.

Note that working correctly here means give the correct error message
since all java files have an error in them that a correct java compiler
should detect. So the correct output is:

> T151221je1.java:10:error:Cannot find accessible method "Doubler.two(int)"
> T1628u1.java:10:error:Local variable "b" may have not been initialized before use [JLS 14.3]
> T1628u3.java:10:error:Local variable "j" may have not been initialized before use [JLS 14.3]
> T1628u4.java:9:error:Local variable "j" may have not been initialized before use [JLS 14.3]
> [for T33i1.java] error:Invalid unicode escape: \u20';
> T82aim5.java:7:error:Cannot access field "foo" it is in an other package and not a class member [JLS 15.10]
> T852nsmu1.java:7:error:Cannot access non-static field "foo" from static inner class [JLS 15.10]

Other Jacks test files work correctly with ksusu-bin. With the suggested
patch to exception.cc KopiSusu (compiled with gcj) is the best performing
compiler on the Jacks suite (beating gcj, jikes and the original kjc).
KopiSusu using the Sun or IBM JRE is even better (less then 20 failures)
but I consider using proprietary programs cheating :)

Cheers,

Mark

P.S. Note that KopiSusu is GPLed and the latest source code of the
classes in the jar file can be found on the following CVS server
:pserver:anoncvs@gloomy-place.tapsellferrier.co.uk:/usr/local/cvs
with as password anoncvs. gcj is not yet able to compile KopiSusu from
source, but I have some workaround for that in my personal tree.
But Erwin does not like changing the source to work around bugs in another
compiler so I should file bug reports agains gcj soon.
More Jacks (Jacks is an Automated Compiler Killing Suite) tests can be
found at <http://oss.software.ibm.com/developerworks/opensource/jacks/>.

-- 
Stuff to read:
    <http://www.toad.com/gnu/whatswrong.html>
  What's Wrong with Copy Protection, by John Gilmore


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