java in gcc-2.95 release on Linux - not so good
Steven Ashe
ashe@boulder.qms.com
Thu Aug 5 11:41:00 GMT 1999
Relative to gcc-2.95 release built on RH6.1 (PPro) ---->
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, world");
}
}
produces some 240000 bytes of output. This piece of gdb dump sheds some light
on the problem:
#0 0x4008fb66 in gnu::gcj::convert::Output_8859_1::write (this=@8065f60,
inbuffer=@8062f60, inpos=84043, inlength=512)
at ../../../libgcj-2.95/libjava/gnu/gcj/convert/Output_8859_1.java:33
#1 0x400a7195 in java::io::PrintStream::writeChars (this=@8061de0,
buf=@8062f60, offset=83968, count=134539104)
at ../../../libgcj-2.95/libjava/java/io/PrintStream.java:108
#2 0x400a6f6c in java::io::PrintStream::print (this=@8061de0, chars=@8062f60,
pos=0, len=134623072, println=true)
at ../../../libgcj-2.95/libjava/java/io/PrintStream.java:80
#3 0x400a7a4c in java::io::PrintStream::println (this=@8061de0,
charArray=@8062f60)
at ../../../libgcj-2.95/libjava/java/io/PrintStream.java:231
gotta love that byte count (134539104) as what the compiler produces for
chars.length in frame 2.
Likewise,
public class HelloWorld {
public static void main(String[] args) {
System.out.println(3);
}
}
produces the curious output:
4.2038954E-45
These were compiled as
gcj -g HelloWorld.java --main=HelloWorld
and their libraries are:
libgcj.so.0 => /usr/local/lib/libgcj.so.0 (0x40018000)
libm.so.6 => /lib/libm.so.6 (0x40184000)
libgcjgc.so.0 => /usr/local/lib/libgcjgc.so.0 (0x401a0000)
libzgcj.so.0 => /usr/local/lib/libzgcj.so.0 (0x401bb000)
libdl.so.2 => /lib/libdl.so.2 (0x401c9000)
libc.so.6 => /lib/libc.so.6 (0x401cc000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
Static compilations give the same results.
gcc-2.95 was built from its release with --enable-java-gc=boehm in gcc.
libgcj was built with
--enable-java-gc=boehm --enable-fast-char --enable-threads=none
By the way, building gcc-2.95 with --enable-shared fails to build some
part of stdlibc++-3*
This is on RH6.1 with a clean /usr/local
-Steve Ashe
ashe@qms.com
More information about the Java
mailing list