United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6915110 IfNode::up_one_dom moves beyond RootNode bug in src/share/vm/opto/ifnode.cpp
JDK-6915110 : IfNode::up_one_dom moves beyond RootNode bug in src/share/vm/opto/ifnode.cpp

Details
Type:
Bug
Submit Date:
2010-01-07
Status:
Resolved
Updated Date:
2010-04-03
Project Name:
JDK
Resolved Date:
2010-01-29
Component:
hotspot
OS:
solaris_7
Sub-Component:
compiler
CPU:
sparc
Priority:
P3
Resolution:
Fixed
Affected Versions:
hs14
Fixed Versions:
hs17 (b07)

Related Reports
Backport:
Backport:

Sub Tasks

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
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
EVALUATION

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



Hardware and Software, Engineered to Work Together