[ http://issues.apache.org/jira/browse/HARMONY-1774?page=comments#action_12441409 ]
Egor Pasko commented on HARMONY-1774:
-------------------------------------
I found even a shorter test:
public class TestLong2
{
public static void main(String[] args) {
parse(-(Long.MIN_VALUE + 8));
}
private static void parse(long rs)
{
long result = rs + 8;
if (result < 0) {
System.out.println("PASS");
return;
}
System.out.println("FAIL");
}
}
OPT.{ranslator and optimizer} parts are innocent here, the bug is in handling the branch ((long
+ 8) < 0) in code generator:
addl $8, %ecx
adcl $0, %eax
jnz .X
jb
.X:
jnl
I am slightly confused with all these zero jumps, and they look suspicious to me.
In case of "rs" instead of "rs + 8" in the above test, CG generates an explicit CMP instruction
before JNZ and the test *passes*. Can it be the reason? CG gurus, can you look at this bug?
OFFTOPIC:
in that case GCC produces something like:
addl $8, %eax
adcl $0, %edx
testl %edx, %edx
js
this should be faster. Can we do something similar in CG in the nearest future?
> [drlvm][unit] Classlib test org.apache.harmony.luni.tests.java.lang.LongTest fails in
OPT mode
> ----------------------------------------------------------------------------------------------
>
> Key: HARMONY-1774
> URL: http://issues.apache.org/jira/browse/HARMONY-1774
> Project: Harmony
> Issue Type: Bug
> Components: DRLVM
> Reporter: Elena Semukhina
> Attachments: TestFileChannel.java, TestLong.java, TestLong2.java
>
>
> 5 test methods in this test fail OPT mode while pass in JET.
> > java -showversion
> Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundatio
> n or its licensors, as applicable.
> java version "1.5.0"
> pre-alpha : not complete or compatible
> svn = r454267, (Oct 9 2006), Windows/ia32/msvc 1310, debug build
> http://incubator.apache.org/harmony
> I'll attach a simple test to reproduce the issue.
--
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
|