EVALUATION
The fix has been verified as part of hs15-b02 pit.
|
|
|
EVALUATION
http://hg.openjdk.java.net/jdk7/hotspot-comp/hotspot/rev/7628781568e1
|
|
|
EVALUATION
As Tom suspected the bug is in the Op_URShiftL special case in AndLNode::Identity. The constant shift value gets not masked before calculations are done. Adding the line:
shift &= (BitsPerJavaInteger * 2) - 1; // semantics of Java shifts
fixes the bug.
It seems the same bug is in AndINode::Identity, but I couldn't create a testcase yet. If I find one I will open a new CR.
|
|
|
SUGGESTED FIX
diff -Nupr 6795362.3b5ac9e7e6ea/src/share/vm/opto/mulnode.cpp 6795362/src/share/vm/opto/mulnode.cpp
--- 6795362.3b5ac9e7e6ea/src/share/vm/opto/mulnode.cpp 2009-01-30 11:24:39.694445872 +0100
+++ 6795362/src/share/vm/opto/mulnode.cpp 2009-01-30 11:24:39.695265016 +0100
@@ -581,6 +581,7 @@ Node *AndLNode::Identity( PhaseTransform
const TypeInt *t12 = phase->type( usr->in(2) )->isa_int();
if( t12 && t12->is_con() ) {
int shift_con = t12->get_con();
+ shift_con &= (BitsPerJavaInteger * 2) - 1; // semantics of Java shifts
jlong mask = max_julong >> shift_con;
if( (mask&con) == mask ) // If AND is useless, skip it
return usr;
|
|
|
EVALUATION
The bug was introduced with 6603011 and 6732154 already fixed a problem in the new code. I suspect this bug is similar to 6732154.
|
|
|
EVALUATION
6732154 has been fixed in hs14-b04, but the test still fails with latest hs14-b10
as well as hs14-b04:
/java/re/jdk/7/promoted/all/b44/binaries/solaris-i586/bin/java -server -Xcomp -XX:CompileOnly=TesterSmall_Class_0 -showversion TesterSmall
java version "1.7.0-ea"
Java(TM) SE Runtime Environment (build 1.7.0-ea-b44)
Java HotSpot(TM) Server VM (build 14.0-b10, compiled mode)
var_bad = -602947331
var_ok = 0
/java/re/jdk/7/promoted/all/b35/binaries/solaris-i586/bin/java -server -Xcomp -XX:CompileOnly=TesterSmall_Class_0 -showversion TesterSmall
java version "1.7.0-ea"
Java(TM) SE Runtime Environment (build 1.7.0-ea-b35)
Java HotSpot(TM) Server VM (build 14.0-b04, compiled mode)
var_bad = -602947331
var_ok = 0
|
|
|
EVALUATION
Obviously, because 6732154 fixes a similar but different problem. Still investigating.
|
|
|
EVALUATION
When the:
// Masking off sign bits? Dont make them!
if( rop == Op_RShiftL ) {
special case in AndLNode::Ideal is commented, the generated code is correct.
|
|
|