You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Alexey Varlamov (JIRA)" <ji...@apache.org> on 2007/05/11 13:48:15 UTC

[jira] Updated: (HARMONY-1861) [drlvm][jit] Double arithmetic instructions work incorrectly (Jitrino JET)

     [ https://issues.apache.org/jira/browse/HARMONY-1861?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexey Varlamov updated HARMONY-1861:
-------------------------------------

    Attachment: H1861.diff

Fix: 
 - use real operand size when spilling regs through stack;
 - emulate push/pop instructions for wide types on IA32.

> [drlvm][jit] Double arithmetic instructions work incorrectly (Jitrino JET)
> --------------------------------------------------------------------------
>
>                 Key: HARMONY-1861
>                 URL: https://issues.apache.org/jira/browse/HARMONY-1861
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>         Environment: Linux IA-32, Windows IA-32
>            Reporter: Irina Arkhipets
>         Assigned To: Alexey Varlamov
>         Attachments: H1861.diff, test.java
>
>
> Double arithmetic and compare operations  (instructions: ddiv, drem, dadd, dsub, dcmpl, dcmpg) return  incorrect result  if the first argument is the value of double non-static field and the second argument is an element of array of long values.
> I am able to reproduce this bug with Jitrino JET only, the testcase below always passes with interpreter, opt, client, server and server_static.
> Please, compile and run the following test example with "-Xem:jet" switch to reproduce the failure:
> ...
> public class test {
>     public static long [] arr = new long [] {6, 25, 50};
>     public static test t = new test();
>     public double d = 30d;
>     public static void main (String [] args)  {
>         double d1= t.d / arr[0];
>         if (d1 == 5.0d) {
>             System.out.println("double/long PASSED");
>         } else { 
>             System.out.println("double/long FAILED: " + d1);
>         }
>         d1= t.d % arr[1];
>         if (d1 == 5.0d) {
>             System.out.println("double%long PASSED");
>         } else { 
>             System.out.println("double%long FAILED: " + d1);
>         }
>         d1= t.d - arr[1];
>         if (d1 == 5.0d) {
>             System.out.println("double-long PASSED");
>         } else { 
>             System.out.println("double-long FAILED: " + d1);
>         } 
>         d1= t.d + arr[0];
>         if (d1 == 36.0d) {
>             System.out.println("double+long PASSED");
>         } else { 
>             System.out.println("double+long FAILED: " + d1);
>         }
>         boolean b = (t.d >= arr[0]);
>         if (b) {
>             System.out.println("double>=long PASSED");
>         } else { 
>             System.out.println("double>=long FAILED: " + b);
>         }
>         b = (t.d < arr[1]);
>         if (!b) {
>             System.out.println("double<long PASSED");
>         } else { 
>             System.out.println("double<long FAILED: " + b);
>         }
>     }
> }
> ...
> Please, note the following:
> 1. Tes output differs on Linux and Windows platforms, and dcmpl, dcmpg testcases even pass on Linux.
> 2. The test passes with JET if d variable is declared as static (" public static double d = 30d")
> 3. The test passes with JET if the second arguments for all operations are declared just as long variables (i.e. not an array memners)
> Sample outpit on Windows is:
> ...
> double/long FAILED: 4.62863868563952E-309
> double%long FAILED: 1.884906858420811E-225
> double-long FAILED: -25.0
> double+long FAILED: 6.0
> double>=long FAILED: false
> double<long FAILED: true
> ...
> Sample output on Linux is:
> ...
> double/long FAILED: -1.980992325586801E147
> double%long FAILED: 16.0
> double-long FAILED: 5.91906791E8
> double+long FAILED: 5.91906822E8
> double>=long PASSED
> double<long PASSED
> ...

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.