Re: [kaffe] Simple program shows strange results

2003-03-14 Thread Timothy Stack

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(xC2:  + 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

2003-03-07 Thread Ito Kazumitsu

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

2003-03-07 Thread Ito Kazumitsu

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

2003-03-06 Thread Kevin D. Kissell
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
xpf: 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(xpe:  + x +   + pe);
 x = pe;
   }
   else if (x  pf) {
 System.err.println(xpf:  + 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
 xpf: 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
 xpe: 0.0 7.0
 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(xpe:  + x +   + pe);
 x = pe;
   }
   else if (x  pf) {
 System.err.println(xpf:  + x +   + pf);
 x = pf;
   }
   System.err.println(x pe pf = + x +   + pe +  + pf);
   }
 }
 
 bash-2.05b$ java Test
 x=9.99
 xpf: 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

2003-03-06 Thread Ito Kazumitsu

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

2003-03-05 Thread Ito Kazumitsu

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

2003-03-05 Thread Ito Kazumitsu
 : == 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

2003-03-05 Thread Ito Kazumitsu

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