You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Irina Arkhipets (JIRA)" <ji...@apache.org> on 2006/10/13 05:38:35 UTC

[jira] Created: (HARMONY-1848) [drlvm][jit] dcmp and fcmp instructions return wrong result when one of the used parameter is NaN

[drlvm][jit] dcmp<op> and fcmp<op> instructions return wrong result when one of the used parameter is NaN
---------------------------------------------------------------------------------------------------------

                 Key: HARMONY-1848
                 URL: http://issues.apache.org/jira/browse/HARMONY-1848
             Project: Harmony
          Issue Type: Bug
          Components: DRLVM
         Environment: Windows IA-32, Linux IA-32
            Reporter: Irina Arkhipets
         Attachments: test_cmp.j

J2SE VM Specification reads about dcmp<op> and fcmp<op> instructions: "If one of value1 or value2 is NaN then dcmpg and fcmpg push the int value 1 
onto stack and dcmpl and fcmpl push the int -1"

However, Jitrino returns incorrect value in this case sometime.

The following test example demonstrates the failure:
--------- test.java ---------
public class test {
    public static void main(String [] args) {
        int ret = test_cmp.test_dcmp1();
        System.out.println(ret == 1 ? "dcmp1 test PASSED" : "dcmp1 test FAILED: " + ret);
        
        ret = test_cmp.test_fcmp1();
        System.out.println(ret == -1 ? "fcmp1 test PASSED" : "fcmp1 test FAILED: " + ret);
    }
}
--------- test_cmp.j ---------
.class public test_cmp
.super java/lang/Object

.method public <init>()V
    aload_0
    invokenonvirtual java/lang/Object/<init>()V
    return
.end method

.method public static test_dcmp1()I
    .limit stack 6
    .limit locals 2

    ldc2_w -1.0d
    ldc2_w -0.0d
    ldc2_w 0.0d 
    ddiv
    dcmpg   
    ireturn  
.end method

.method public static test_fcmp1()I
    .limit stack 2
    .limit locals 2
    ldc -0.0f
    ldc 0.0f 
    fdiv
    ldc -3.4028235E39f  
    fcmpl
    ireturn
.end method
----------------------------------

Both testcases passes with reference JDK as well as in default, interpreter, JET, client and server_static modes.
dcmp1 test fails in opt mode.
Both dcmp1 and fcmp1 tests fail in server mode.

Please, compile this test using the following commands:
$> java -jar jasmin.jar test_cmp.j
$> javac test.java

Please, run the following commands to reproduce the failure:
$> <Tested JDK> test
$> <Tested JDK> -Xem:opt test
$> <Tested JDK> -Xem:server test


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (HARMONY-1848) [drlvm][jit] dcmp and fcmp instructions return wrong result when one of the used parameter is NaN

Posted by "Irina Arkhipets (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-1848?page=all ]

Irina Arkhipets updated HARMONY-1848:
-------------------------------------

    Attachment: test.java

test.java source file

> [drlvm][jit] dcmp<op> and fcmp<op> instructions return wrong result when one of the used parameter is NaN
> ---------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-1848
>                 URL: http://issues.apache.org/jira/browse/HARMONY-1848
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>         Environment: Windows IA-32, Linux IA-32
>            Reporter: Irina Arkhipets
>         Attachments: test.java, test_cmp.j
>
>
> J2SE VM Specification reads about dcmp<op> and fcmp<op> instructions: "If one of value1 or value2 is NaN then dcmpg and fcmpg push the int value 1 
> onto stack and dcmpl and fcmpl push the int -1"
> However, Jitrino returns incorrect value in this case sometime.
> The following test example demonstrates the failure:
> --------- test.java ---------
> public class test {
>     public static void main(String [] args) {
>         int ret = test_cmp.test_dcmp1();
>         System.out.println(ret == 1 ? "dcmp1 test PASSED" : "dcmp1 test FAILED: " + ret);
>         
>         ret = test_cmp.test_fcmp1();
>         System.out.println(ret == -1 ? "fcmp1 test PASSED" : "fcmp1 test FAILED: " + ret);
>     }
> }
> --------- test_cmp.j ---------
> .class public test_cmp
> .super java/lang/Object
> .method public <init>()V
>     aload_0
>     invokenonvirtual java/lang/Object/<init>()V
>     return
> .end method
> .method public static test_dcmp1()I
>     .limit stack 6
>     .limit locals 2
>     ldc2_w -1.0d
>     ldc2_w -0.0d
>     ldc2_w 0.0d 
>     ddiv
>     dcmpg   
>     ireturn  
> .end method
> .method public static test_fcmp1()I
>     .limit stack 2
>     .limit locals 2
>     ldc -0.0f
>     ldc 0.0f 
>     fdiv
>     ldc -3.4028235E39f  
>     fcmpl
>     ireturn
> .end method
> ----------------------------------
> Both testcases passes with reference JDK as well as in default, interpreter, JET, client and server_static modes.
> dcmp1 test fails in opt mode.
> Both dcmp1 and fcmp1 tests fail in server mode.
> Please, compile this test using the following commands:
> $> java -jar jasmin.jar test_cmp.j
> $> javac test.java
> Please, run the following commands to reproduce the failure:
> $> <Tested JDK> test
> $> <Tested JDK> -Xem:opt test
> $> <Tested JDK> -Xem:server test

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (HARMONY-1848) [drlvm][jit] dcmp and fcmp instructions return wrong result when one of the used parameter is NaN

Posted by "Irina Arkhipets (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-1848?page=all ]

Irina Arkhipets updated HARMONY-1848:
-------------------------------------

    Attachment: test_cmp.j

test_cmp.j source file

> [drlvm][jit] dcmp<op> and fcmp<op> instructions return wrong result when one of the used parameter is NaN
> ---------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-1848
>                 URL: http://issues.apache.org/jira/browse/HARMONY-1848
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>         Environment: Windows IA-32, Linux IA-32
>            Reporter: Irina Arkhipets
>         Attachments: test_cmp.j
>
>
> J2SE VM Specification reads about dcmp<op> and fcmp<op> instructions: "If one of value1 or value2 is NaN then dcmpg and fcmpg push the int value 1 
> onto stack and dcmpl and fcmpl push the int -1"
> However, Jitrino returns incorrect value in this case sometime.
> The following test example demonstrates the failure:
> --------- test.java ---------
> public class test {
>     public static void main(String [] args) {
>         int ret = test_cmp.test_dcmp1();
>         System.out.println(ret == 1 ? "dcmp1 test PASSED" : "dcmp1 test FAILED: " + ret);
>         
>         ret = test_cmp.test_fcmp1();
>         System.out.println(ret == -1 ? "fcmp1 test PASSED" : "fcmp1 test FAILED: " + ret);
>     }
> }
> --------- test_cmp.j ---------
> .class public test_cmp
> .super java/lang/Object
> .method public <init>()V
>     aload_0
>     invokenonvirtual java/lang/Object/<init>()V
>     return
> .end method
> .method public static test_dcmp1()I
>     .limit stack 6
>     .limit locals 2
>     ldc2_w -1.0d
>     ldc2_w -0.0d
>     ldc2_w 0.0d 
>     ddiv
>     dcmpg   
>     ireturn  
> .end method
> .method public static test_fcmp1()I
>     .limit stack 2
>     .limit locals 2
>     ldc -0.0f
>     ldc 0.0f 
>     fdiv
>     ldc -3.4028235E39f  
>     fcmpl
>     ireturn
> .end method
> ----------------------------------
> Both testcases passes with reference JDK as well as in default, interpreter, JET, client and server_static modes.
> dcmp1 test fails in opt mode.
> Both dcmp1 and fcmp1 tests fail in server mode.
> Please, compile this test using the following commands:
> $> java -jar jasmin.jar test_cmp.j
> $> javac test.java
> Please, run the following commands to reproduce the failure:
> $> <Tested JDK> test
> $> <Tested JDK> -Xem:opt test
> $> <Tested JDK> -Xem:server test

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira