JDK-6915110 : IfNode::up_one_dom moves beyond RootNode bug in src/share/vm/opto/ifnode.cpp
  • Type: Bug
  • Status: Resolved
  • Resolution: Fixed
  • Component: hotspot
  • Sub-Component: compiler
  • Priority: P3
  • Affected Version: hs14
  • OS: solaris_7
  • CPU: sparc
  • Submit Date: 2010-01-07
  • Updated Date: 2010-04-03
  • Resolved Date: 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 Availabitlity Release.

To download the current JDK release, click here.
JDK 6 JDK 7
6u21Resolved 7Fixed
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
2010-01-08

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
2010-01-07