|
Quick Lists
|
|
Bug ID:
|
6863155
|
|
Votes
|
0
|
|
Synopsis
|
Server compiler generates incorrect code (x86, long, bitshift, bitmask)
|
|
Category
|
hotspot:compiler2
|
|
Reported Against
|
|
|
Release Fixed
|
hs16(b08),
6u18(b01) (Bug ID:2181930)
, 7(b71) (Bug ID:2182188)
|
|
State
|
10-Fix Delivered,
bug
|
|
Priority:
|
3-Medium
|
|
Related Bugs
|
6869274
,
5057225
|
|
Submit Date
|
22-JUL-2009
|
|
Description
|
FULL PRODUCT VERSION :
java version "1.7.0-ea"
Java(TM) SE Runtime Environment (build 1.7.0-ea-b65)
Java HotSpot(TM) Server VM (build 16.0-b06, mixed mode)
FULL OS VERSION :
customer Windows XP [Version 5.1.2600]
EXTRA RELEVANT SYSTEM CONFIGURATION :
customer x86 32-bit
A DESCRIPTION OF THE PROBLEM :
Code compiled with server compiler generates an incorrect result.
Ran the source code with:
-server
-XX:CompileThreshold=10
-XX:CompileOnly=jvmtest/Tester
-XX:+PrintCompilation
and got:
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
13254907146 jvmtest.Tester::
te3254907146s
t3254907146 (51 bytes)
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
The negative (incorrect) results seem to occur after the compiled code starts kicking in. The negative results never occur with client compiler or interpreted mode.
THE PROBLEM WAS REPRODUCIBLE WITH -Xint FLAG: No
THE PROBLEM WAS REPRODUCIBLE WITH -server FLAG: Yes
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run code without -server. Observe correct result.
Then observe code with -server and a low compile threshold and observe incorrect result after code is compiled.
EXPECTED VERSUS ACTUAL BEHAVIOR :
The correct result from the code is '3254907146'. The result after the code is compiled is calculated as '-1040060150'.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
package jvmtest;
public class Tester
{
private static long test(byte bytes[])
{
long value;
value = bytes[3] << 24 & 0xff000000L;
value += bytes[2] << 16 & 0xff0000;
value += bytes[1] << 8 & 0xff00;
value += bytes[0] & 0xff;
return(value);
}
public static void main(String... args)
throws Exception
{
for (int i = 0; i < 1000; i++)
{
//byte[] bytes = new byte[] {10, -15, 1, -62};
byte[] bytes = new byte[] {0x0a, (byte)0xf1, 0x01, (byte)0xc2};
System.out.println(test(bytes));
}
}
}
---------- END SOURCE ----------
Posted Date : 2009-07-22 14:56:19.0
|
|
Work Around
|
N/A
|
|
Evaluation
|
The bug happens with masks which would cause a sign extension to the integer value. This is not handled properly in AndLNode::Ideal().
Posted Date : 2009-07-27 09:12:35.0
http://hg.openjdk.java.net/jdk7/hotspot-comp/hotspot/rev/52898b0c43e9
Posted Date : 2009-07-29 14:16:30.0
http://hg.openjdk.java.net/jdk7/hotspot-gc/hotspot/rev/52898b0c43e9
Posted Date : 2009-08-10 07:35:32.0
|
|
Comments
|
PLEASE NOTE: JDK6 is formerly known as Project Mustang
|
|
|
 |