File in question: src/share/vm/opto/ifnode.cpp
From the comments of IfNode::up_one_dom, it should return NULL if it hit a RootNode, so it will not move beyond root of cfg. But there's code for loop:
// Else hit a Region. Check for a loop header
if( dom->is_Loop() )
return dom->in(1); // Skip up thru loops
Because RootNode is also a subtype of LoopNode, it will return immediately. And the return value will move beyond the root. Sometimes it will cause unexpected behavior.
It is difficult to make a simple test case for this bug. I just added an assertion in IfNode::Ideal
prev_dom = dom;
dom = up_one_dom( dom );
assert( dom==NULL || !dom->is_Root(), "hit root"); // <<<<< my assertion
if( !dom ) break;
}
If you run the CTW test, this assertion will be volatiled while compiling com/sun/java/util/jar/pack/Histogram
My testing platform:
OS: SUSE Linux Enterprise Server 11 (x86_64)
JDK:Java(TM) SE Runtime Environment (build 1.6.0_06-b02)
CPU:AMD Opteron (tm) Processor 848
Test command:
./gamma -Xbootclasspath/p:$JAVA_HOME/jre/lib/rt.jar -XX:+CompileTheWorld -XX:CompileTheWorldStartAt=1644 -XX:CompileTheWorldStopAt=1648