JDK-6915110 : IfNode::up_one_dom moves beyond RootNode bug in src/share/vm/opto/ifnode.cpp
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: hs14
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: solaris_7
  • CPU: sparc
  • Submitted: 2010-01-07
  • Updated: 2010-04-03
  • Resolved: 2010-01-29
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6 JDK 7 Other
6u21Fixed 7Fixed hs17Fixed
Description
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

Comments
EVALUATION http://hg.openjdk.java.net/jdk7/hotspot-comp/hotspot/rev/bea7a22a6f79
08-01-2010

SUGGESTED FIX check RootNode before check loop in up_one_dom if( dom->is_Root() ) return NULL; // <<<<<<< my fix // Else hit a Region. Check for a loop header if( dom->is_Loop() ) return dom->in(1); // Skip up thru loops
07-01-2010