Re: [kaffe] Simple program shows strange results
In message "Re: [kaffe] Simple program shows strange results" on 03/03/14, Timothy Stack <[EMAIL PROTECTED]> writes: > > $ cat Test.java.m4 > > public class Test { > > public static void main(String[] args) { > > T x = C1; > > if (x < C2) { > > System.err.println("x > x = C2; > > } > > System.err.println(x); > > } > > } > > CVS update and try this again. (Thanks for the test case!) Thank you. My problem has been solved. ___ kaffe mailing list [EMAIL PROTECTED] http://kaffe.org/cgi-bin/mailman/listinfo/kaffe
Re: [kaffe] Simple program shows strange results
hi, > In message "Re: [kaffe] Simple program shows strange results" > on 03/03/05, Ito Kazumitsu <[EMAIL PROTECTED]> writes: > > > I have made a simpler test program: > > This strange problem occurs with float and double, but not > with int or byte. > > $ cat Test.java.m4 > public class Test { > public static void main(String[] args) { > T x = C1; > if (x < C2) { > System.err.println("x x = C2; > } > System.err.println(x); > } > } CVS update and try this again. (Thanks for the test case!) If you're interested, the causes were: I modified move_float() in icode.c to look like move_int/move_ref/etc since it was generating inefficient code on the PowerPC. Unfortunately, the x86 jitter depended on the way the old move_float() worked, so it was not working properly when a slot was aliased. For example, in the following bytecode: ldc 10.0 fstore_1 fload_1 Kaffe optimizes away the store and subsequent load since it is potentially redundant. Unfortunately, because of the bizarro way the x86 FPU works, this does not work and the 10.0 value never gets written to the proper place on the stack. Therefore, the floating point number that gets printed is just whatever garbage is on the stack at the time. Solution: Modify slotAlias() in machine.c to aggressively spill Rreadonce registers (the x86 float register). This method works and seems to generate the same code as before on x86 (as far as I know), without screwing over CPUs with more sensible FPUs. thanks, tim stack ___ kaffe mailing list [EMAIL PROTECTED] http://kaffe.org/cgi-bin/mailman/listinfo/kaffe
Re: [kaffe] Simple program shows strange results
In message "Re: [kaffe] Simple program shows strange results" on 03/03/07, Ito Kazumitsu <[EMAIL PROTECTED]> writes: > I rebuilt CVS version of kaffe on a machine: > >$ uname -a >Linux pub2.hitachi-cable.co.jp 2.0.38 #2 Sun Jan 2 11:44:53 JST 2000 i686 unknown > > using > > ./configure --with-engine=intrp --with-rt-jar=/usr/local/kaffe/jre/lib/rt.jar > > and got sastisfactory results. I reconfirmed this fact. ___ kaffe mailing list [EMAIL PROTECTED] http://kaffe.org/cgi-bin/mailman/listinfo/kaffe
Re: [kaffe] Simple program shows strange results
In message "Re: [kaffe] Simple program shows strange results" on 03/03/07, Ito Kazumitsu <[EMAIL PROTECTED]> writes: > I also tried rebuilding kaffe after replacing kaffe/kaffevm/jit/machine.c > by Revision 1.51 and without using --with-engine=intrp. > > The result was also sastisfactory. I am sorry that I reported a wrong thing. The result was NOT sastisfactory. And kaffe/kaffevm/jit/machine.c had nothing to do with my environment, but kaffe/kaffevm/jit3 was used for building kaffe. ___ kaffe mailing list [EMAIL PROTECTED] http://kaffe.org/cgi-bin/mailman/listinfo/kaffe
Re: [kaffe] Simple program shows strange results
In message "Re: [kaffe] Simple program shows strange results" on 03/03/07, Ito Kazumitsu <[EMAIL PROTECTED]> writes: > I rebuilt CVS version of kaffe on a machine: > using > > ./configure --with-engine=intrp --with-rt-jar=/usr/local/kaffe/jre/lib/rt.jar > > and got sastisfactory results. I also tried rebuilding kaffe after replacing kaffe/kaffevm/jit/machine.c by Revision 1.51 and without using --with-engine=intrp. The result was also sastisfactory. ___ kaffe mailing list [EMAIL PROTECTED] http://kaffe.org/cgi-bin/mailman/listinfo/kaffe
Re: [kaffe] Simple program shows strange results
In message "Re: [kaffe] Simple program shows strange results" on 03/03/06, "Kevin D. Kissell" <[EMAIL PROTECTED]> writes: > So the problem may be unique to x86 platforms, and if so, > that vastly reduces the number of places one needs to look > for the problem. It may be an x86 JIT bug, for example. > Could someone run the test on an interpretive-only x86 > kaffe? I rebuilt CVS version of kaffe on a machine: $ uname -a Linux pub2.hitachi-cable.co.jp 2.0.38 #2 Sun Jan 2 11:44:53 JST 2000 i686 unknown using ./configure --with-engine=intrp --with-rt-jar=/usr/local/kaffe/jre/lib/rt.jar and got sastisfactory results. ___ kaffe mailing list [EMAIL PROTECTED] http://kaffe.org/cgi-bin/mailman/listinfo/kaffe
Re: [kaffe] Simple program shows strange results
Interestingly enough, if I run either an interpretive kaffe 1.0.7 plus my MIPS patches, or an interpretive MIPS build of the current kaffe.org CVS sources on a little-endian MIPS/Linux box (a MIPS "Malta" board with a 5Kc processor on it), I get:: [EMAIL PROTECTED] BUGS]$ javac Test.java [EMAIL PROTECTED] BUGS]$ ls Hello.class Hello.java Test.class Test.java [EMAIL PROTECTED] BUGS]$ java Test 9.99 x>pf: 9.99 9.0 x pe pf =9.0 7.0 9.0 which looks to me to be your "correct" result. So the problem may be unique to x86 platforms, and if so, that vastly reduces the number of places one needs to look for the problem. It may be an x86 JIT bug, for example. Could someone run the test on an interpretive-only x86 kaffe? Kevin K. - Original Message - From: "Ito Kazumitsu" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, March 03, 2003 5:59 PM Subject: [kaffe] Simple program shows strange results > The following program: > > public class Test { > public static void main(String[] args) { > float x = 0f; > > float pb = 15.0f; > float pc = 2.0f; > float pd = 6.0f; > float pe = 7.0f; > float pf = 9.0f; > > x = (1.0f - (pc / pd)) * pb; > System.err.println(x); > if (x < pe) { > System.err.println("x x = pe; > } > else if (x > pf) { > System.err.println("x>pf: " + x + " " + pf); > x = pf; > } > System.err.println("x pe pf =" + x + " " + pe + " "+ pf); > } > } > > shows the following output when run with j2sdk1.4.0: > > bash$ java Test > 9.99 > x>pf: 9.99 9.0 > x pe pf =9.0 7.0 9.0 > > which is what I expect. But when run with kaffe, it shows: > > bash-2.05b$ java Test > 9.99 > x x pe pf =7.0 7.0 9.0 > > The kaffe version is > > Engine: Just-in-time v3 Version: 1.1.x-cvs Java Version: 1.1 > Configuration/Compilation options: > Compile date : Sun Feb 23 11:17:00 JST 2003 > Compile host : ph.maczuka.gcd.org > Install prefix: /usr/local/kaffe > Thread system : unix-jthreads > CC: gcc > CFLAGS: -g -O2 -Wall -Wstrict-prototypes > LDFLAGS : > ChangeLog head: 2003-02-12 Dalibor Topic <[EMAIL PROTECTED]> > > By the way, changing the said program as follows, that is > changing the System.err.println(x) to System.err.println("x=" + x), > I get expected output. > > public class Test { > public static void main(String[] args) { > float x = 0f; > > float pb = 15.0f; > float pc = 2.0f; > float pd = 6.0f; > float pe = 7.0f; > float pf = 9.0f; > > x = (1.0f - (pc / pd)) * pb; > System.err.println("x=" + x); > if (x < pe) { > System.err.println("x x = pe; > } > else if (x > pf) { > System.err.println("x>pf: " + x + " " + pf); > x = pf; > } > System.err.println("x pe pf =" + x + " " + pe + " "+ pf); > } > } > > bash-2.05b$ java Test > x=9.99 > x>pf: 9.99 9.0 > x pe pf =9.0 7.0 9.0 > > I wonder what is happening. > > ___ > kaffe mailing list > [EMAIL PROTECTED] > http://kaffe.org/cgi-bin/mailman/listinfo/kaffe > ___ kaffe mailing list [EMAIL PROTECTED] http://kaffe.org/cgi-bin/mailman/listinfo/kaffe
Re: [kaffe] Simple program shows strange results
Hi Ito, --- Ito Kazumitsu <[EMAIL PROTECTED]> wrote: > > In message "Re: [kaffe] Simple program shows strange > results" > on 03/03/06, Dalibor Topic <[EMAIL PROTECTED]> > writes: > > > Just one more question: could you try building > kaffe > > with three-four previous versions of > > kaffe/kaffevm/support.c and see if that changes > > anything? > > > > that's my suspect at the moment. > > I tried building kaffe with kaffe/kaffevm/support.c > 1.51 > 1.52, 1.53 and 1.54, but the results were the same. thanks for the quick reply. I'll take my gdb and look at it very closely ... cheers, dalibor topic __ Do you Yahoo!? Yahoo! Tax Center - forms, calculators, tips, more http://taxes.yahoo.com/ ___ kaffe mailing list [EMAIL PROTECTED] http://kaffe.org/cgi-bin/mailman/listinfo/kaffe
Re: [kaffe] Simple program shows strange results
In message "Re: [kaffe] Simple program shows strange results" on 03/03/06, Dalibor Topic <[EMAIL PROTECTED]> writes: > Just one more question: could you try building kaffe > with three-four previous versions of > kaffe/kaffevm/support.c and see if that changes > anything? > > that's my suspect at the moment. I tried building kaffe with kaffe/kaffevm/support.c 1.51 1.52, 1.53 and 1.54, but the results were the same. ___ kaffe mailing list [EMAIL PROTECTED] http://kaffe.org/cgi-bin/mailman/listinfo/kaffe
Re: [kaffe] Simple program shows strange results
Hi Ito, Just one more question: could you try building kaffe with three-four previous versions of kaffe/kaffevm/support.c and see if that changes anything? that's my suspect at the moment. cheers, dalibor topic __ Do you Yahoo!? Yahoo! Tax Center - forms, calculators, tips, more http://taxes.yahoo.com/ ___ kaffe mailing list [EMAIL PROTECTED] http://kaffe.org/cgi-bin/mailman/listinfo/kaffe
Re: [kaffe] Simple program shows strange results
In message "Re: [kaffe] Simple program shows strange results" on 03/03/05, Ito Kazumitsu <[EMAIL PROTECTED]> writes: > I have made a simpler test program: This strange problem occurs with float and double, but not with int or byte. $ cat Test.java.m4 public class Test { public static void main(String[] args) { T x = C1; if (x < C2) { System.err.println("x Test.java; javac Test.java; java Test 4.7761093E-34 $ echo 'define(T,double)define(C1,10d)define(C2,7d)dnl'| m4 - Test.java.m4 > Test.java; javac Test.java; java Test 1.4534249933639232E-269 $ echo 'define(T,int)define(C1,10)define(C2,7)dnl'| m4 - Test.java.m4 > Test.java; javac Test.java; java Test 10 $ echo 'define(T,byte)define(C1,10)define(C2,7)dnl'| m4 - Test.java.m4 > Test.java; javac Test.java; java Test 10 $ echo 'define(T,long)define(C1,10)define(C2,7)dnl'| m4 - Test.java.m4 > Test.java; javac Test.java; java Test 10 $ ___ kaffe mailing list [EMAIL PROTECTED] http://kaffe.org/cgi-bin/mailman/listinfo/kaffe
Re: [kaffe] Simple program shows strange results
In message "Re: [kaffe] Simple program shows strange results" on 03/03/06, Ito Kazumitsu <[EMAIL PROTECTED]> writes: > These are the results: > [EMAIL PROTECTED] ito]$ for i in kjc gcj Sun-javac; do ln -s -f Test.class.$i > Test.class > ; java Test; done > 4.7761093E-34 > 4.7761093E-34 > 4.7761203E-34 On the other hand, all of them show good results when run with Sun's java or compiled by GCJ. bash$ for i in kjc gcj Sun-javac; do cp Test.class.$i Test.class; java Test; done 10.0 10.0 10.0 bash$ for i in kjc gcj Sun-javac; do cp Test.class.$i Test.class; gcj --main=Test Test.class; ./a.exe; rm a.exe; done 10.0 10.0 10.0 ___ kaffe mailing list [EMAIL PROTECTED] http://kaffe.org/cgi-bin/mailman/listinfo/kaffe
Re: [kaffe] Simple program shows strange results
In message "Re: [kaffe] Simple program shows strange results" on 03/03/06, Ito Kazumitsu <[EMAIL PROTECTED]> writes: > >>>>> ":" == Dalibor Topic <[EMAIL PROTECTED]> writes: > > :> Does the problem occurs when the test is compiled with > :> jikes or Sun's javac, too? > > Yes, I tried with the class file generated by Sun's javac > and also by GCJ. These are the results: [EMAIL PROTECTED] ito]$ cat Test.java public class Test { public static void main(String[] args) { float x = 10.0f; if (x < 7.0f) { System.err.println("x<7: " + x); x = 7.0f; } System.err.println(x); } } [EMAIL PROTECTED] ito]$ ll Test.class* -rw-rw-r-- 1 ito ito 670 Mar 6 08:31 Test.class.Sun-javac -rw-rw-r-- 1 ito ito 599 Mar 6 08:33 Test.class.gcj -rw-rw-r-- 1 ito ito 723 Mar 6 08:37 Test.class.kjc [EMAIL PROTECTED] ito]$ for i in kjc gcj Sun-javac; do ln -s -f Test.class.$i Test.class ; java Test; done 4.7761093E-34 4.7761093E-34 4.7761203E-34 [EMAIL PROTECTED] ito]$ ___ kaffe mailing list [EMAIL PROTECTED] http://kaffe.org/cgi-bin/mailman/listinfo/kaffe
Re: [kaffe] Simple program shows strange results
> ":" == Dalibor Topic <[EMAIL PROTECTED]> writes: :> Does the problem occurs when the test is compiled with :> jikes or Sun's javac, too? Yes, I tried with the class file generated by Sun's javac and also by GCJ. ___ kaffe mailing list [EMAIL PROTECTED] http://kaffe.org/cgi-bin/mailman/listinfo/kaffe
Re: [kaffe] Simple program shows strange results
Hi Ito, --- Ito Kazumitsu <[EMAIL PROTECTED]> wrote: > > This problem occurs on Linux, too. > > $ java Test; uname -a; kaffe -fullversion > 4.7761093E-34 Does the problem occurs when the test is compiled with jikes or Sun's javac, too? cheers, dalibor topic __ Do you Yahoo!? Yahoo! Tax Center - forms, calculators, tips, more http://taxes.yahoo.com/ ___ kaffe mailing list [EMAIL PROTECTED] http://kaffe.org/cgi-bin/mailman/listinfo/kaffe
Re: [kaffe] Simple program shows strange results
In message "Re: [kaffe] Simple program shows strange results" on 03/03/05, Ito Kazumitsu <[EMAIL PROTECTED]> writes: > Additional Information: > > bash-2.05b$ uname -a > FreeBSD ph.maczuka.gcd.org 4.7-RELEASE FreeBSD 4.7-RELEASE #0: Wed Oct 9 15:08:34 > GMT 2002 [EMAIL PROTECTED]:/usr/obj/usr/src/sys/GENERIC i386 This problem occurs on Linux, too. $ java Test; uname -a; kaffe -fullversion 4.7761093E-34 Linux pub2.hitachi-cable.co.jp 2.0.38 #2 Sun Jan 2 11:44:53 JST 2000 i686 unknown Kaffe Virtual Machine Copyright (c) 1996-2002 Kaffe.org project contributors (please see the source code for a full list of contributors). All rights reserved. Portions Copyright (c) 1996-2002 Transvirtual Technologies, Inc. The Kaffe virtual machine is free software, licensed under the terms of the GNU General Public License. Kaffe.org is a an independent, free software community project, not directly affiliated with Transvirtual Technologies, Inc. Kaffe is a Trademark of Transvirtual Technologies, Inc. Kaffe comes with ABSOLUTELY NO WARRANTY. Engine: Just-in-time v3 Version: 1.1.x-cvs Java Version: 1.1 Configuration/Compilation options: Compile date : Wed Mar 5 21:02:05 JST 2003 Compile host : pub2.hitachi-cable.co.jp Install prefix: /usr/local/kaffe Thread system : unix-jthreads CC: gcc CFLAGS: -g -O2 -Wall -Wstrict-prototypes LDFLAGS : ChangeLog head: 2003-03-01 Dalibor Topic <[EMAIL PROTECTED]> ___ kaffe mailing list [EMAIL PROTECTED] http://kaffe.org/cgi-bin/mailman/listinfo/kaffe
Re: [kaffe] Simple program shows strange results
> ":" == Ito Kazumitsu <[EMAIL PROTECTED]> writes: :> bash-2.05b$ cat Test.java; javac Test.java; java Test :> public class Test { :> public static void main(String[] args) { :> float x = 10.0f; :> if (x < 7.0f) { :> System.err.println("x<7: " + x); :> x = 7.0f; :> } :> System.err.println(x); :> } :> } :> 4.8169137E-34 :> bash-2.05b$ Additional Information: bash-2.05b$ uname -a FreeBSD ph.maczuka.gcd.org 4.7-RELEASE FreeBSD 4.7-RELEASE #0: Wed Oct 9 15:08:34 GMT 2002 [EMAIL PROTECTED]:/usr/obj/usr/src/sys/GENERIC i386 bash-2.05b$ kaffe -fullversion Kaffe Virtual Machine Copyright (c) 1996-2002 Kaffe.org project contributors (please see the source code for a full list of contributors). All rights reserved. Portions Copyright (c) 1996-2002 Transvirtual Technologies, Inc. The Kaffe virtual machine is free software, licensed under the terms of the GNU General Public License. Kaffe.org is a an independent, free software community project, not directly affiliated with Transvirtual Technologies, Inc. Kaffe is a Trademark of Transvirtual Technologies, Inc. Kaffe comes with ABSOLUTELY NO WARRANTY. Engine: Just-in-time v3 Version: 1.1.x-cvs Java Version: 1.1 Configuration/Compilation options: Compile date : Wed Mar 5 00:53:51 JST 2003 Compile host : ph.maczuka.gcd.org Install prefix: /usr/local/kaffe Thread system : unix-jthreads CC: gcc CFLAGS: -g -O2 -Wall -Wstrict-prototypes LDFLAGS : ChangeLog head: 2003-03-01 Dalibor Topic <[EMAIL PROTECTED]> bash-2.05b$ ___ kaffe mailing list [EMAIL PROTECTED] http://kaffe.org/cgi-bin/mailman/listinfo/kaffe
Re: [kaffe] Simple program shows strange results
> ":" == Ito Kazumitsu <[EMAIL PROTECTED]> writes: :> I wonder what is happening. I have made a simpler test program: bash-2.05b$ cat Test.java; javac Test.java; java Test public class Test { public static void main(String[] args) { float x = 10.0f; if (x < 7.0f) { System.err.println("x<7: " + x); x = 7.0f; } System.err.println(x); } } 4.8169137E-34 bash-2.05b$ Isn't it strange? ___ kaffe mailing list [EMAIL PROTECTED] http://kaffe.org/cgi-bin/mailman/listinfo/kaffe
Re: [kaffe] Simple program shows strange results
In message "[kaffe] Simple program shows strange results" on 03/03/04, Ito Kazumitsu <[EMAIL PROTECTED]> writes: > which is what I expect. But when run with kaffe, it shows: > > bash-2.05b$ java Test > 9.99 > x x pe pf =7.0 7.0 9.0 > > The kaffe version is > ChangeLog head: 2003-02-12 Dalibor Topic <[EMAIL PROTECTED]> In another environment, kaffe gives satisfactory results. $ java Test 9.99 x>pf: 9.99 9.0 x pe pf =9.0 7.0 9.0 In this case, kaffe version is: Engine: Just-in-time v3 Version: 1.1.x-cvs Java Version: 1.1 Configuration/Compilation options: Compile date : Sun Dec 22 11:49:23 JST 2002 Compile host : pub2.hitachi-cable.co.jp Install prefix: /usr/local/kaffe Thread system : unix-jthreads CC: gcc CFLAGS: -g -O2 -Wall -Wstrict-prototypes LDFLAGS : ChangeLog head: 2002-12-21 Dalibor Topic <[EMAIL PROTECTED]> ___ kaffe mailing list [EMAIL PROTECTED] http://kaffe.org/cgi-bin/mailman/listinfo/kaffe
[kaffe] Simple program shows strange results
The following program: public class Test { public static void main(String[] args) { float x = 0f; float pb = 15.0f; float pc = 2.0f; float pd = 6.0f; float pe = 7.0f; float pf = 9.0f; x = (1.0f - (pc / pd)) * pb; System.err.println(x); if (x < pe) { System.err.println("x pf) { System.err.println("x>pf: " + x + " " + pf); x = pf; } System.err.println("x pe pf =" + x + " " + pe + " "+ pf); } } shows the following output when run with j2sdk1.4.0: bash$ java Test 9.99 x>pf: 9.99 9.0 x pe pf =9.0 7.0 9.0 which is what I expect. But when run with kaffe, it shows: bash-2.05b$ java Test 9.99 x By the way, changing the said program as follows, that is changing the System.err.println(x) to System.err.println("x=" + x), I get expected output. public class Test { public static void main(String[] args) { float x = 0f; float pb = 15.0f; float pc = 2.0f; float pd = 6.0f; float pe = 7.0f; float pf = 9.0f; x = (1.0f - (pc / pd)) * pb; System.err.println("x=" + x); if (x < pe) { System.err.println("x pf) { System.err.println("x>pf: " + x + " " + pf); x = pf; } System.err.println("x pe pf =" + x + " " + pe + " "+ pf); } } bash-2.05b$ java Test x=9.99 x>pf: 9.99 9.0 x pe pf =9.0 7.0 9.0 I wonder what is happening. ___ kaffe mailing list [EMAIL PROTECTED] http://kaffe.org/cgi-bin/mailman/listinfo/kaffe