src/share/vm/opto/compile.cpp

changeset 563
a76240c8b133
parent 562
e0bd2e08e3d0
child 598
885ed790ecf0
     1.1 --- a/src/share/vm/opto/compile.cpp	Wed Apr 23 06:35:28 2008 -0400
     1.2 +++ b/src/share/vm/opto/compile.cpp	Mon Apr 28 08:08:12 2008 -0700
     1.3 @@ -1981,10 +1981,6 @@
     1.4  #endif
     1.5      break;
     1.6    }
     1.7 -  case Op_If:
     1.8 -  case Op_CountedLoopEnd:
     1.9 -    fpu._tests.push(n);         // Collect CFG split points
    1.10 -    break;
    1.11  
    1.12    case Op_AddP: {               // Assert sane base pointers
    1.13      const Node *addp = n->in(AddPNode::Address);
    1.14 @@ -2083,10 +2079,12 @@
    1.15    default:
    1.16      assert( !n->is_Call(), "" );
    1.17      assert( !n->is_Mem(), "" );
    1.18 -    if( n->is_If() || n->is_PCTable() )
    1.19 -      fpu._tests.push(n);       // Collect CFG split points
    1.20      break;
    1.21    }
    1.22 +
    1.23 +  // Collect CFG split points
    1.24 +  if (n->is_MultiBranch())
    1.25 +    fpu._tests.push(n);
    1.26  }
    1.27  
    1.28  //------------------------------final_graph_reshaping_walk---------------------
    1.29 @@ -2165,19 +2163,18 @@
    1.30  
    1.31    // Check for unreachable (from below) code (i.e., infinite loops).
    1.32    for( uint i = 0; i < fpu._tests.size(); i++ ) {
    1.33 -    Node *n = fpu._tests[i];
    1.34 -    assert( n->is_PCTable() || n->is_If(), "either PCTables or IfNodes" );
    1.35 -    // Get number of CFG targets; 2 for IfNodes or _size for PCTables.
    1.36 +    MultiBranchNode *n = fpu._tests[i]->as_MultiBranch();
    1.37 +    // Get number of CFG targets.
    1.38      // Note that PCTables include exception targets after calls.
    1.39 -    uint expected_kids = n->is_PCTable() ? n->as_PCTable()->_size : 2;
    1.40 -    if (n->outcnt() != expected_kids) {
    1.41 +    uint required_outcnt = n->required_outcnt();
    1.42 +    if (n->outcnt() != required_outcnt) {
    1.43        // Check for a few special cases.  Rethrow Nodes never take the
    1.44        // 'fall-thru' path, so expected kids is 1 less.
    1.45        if (n->is_PCTable() && n->in(0) && n->in(0)->in(0)) {
    1.46          if (n->in(0)->in(0)->is_Call()) {
    1.47            CallNode *call = n->in(0)->in(0)->as_Call();
    1.48            if (call->entry_point() == OptoRuntime::rethrow_stub()) {
    1.49 -            expected_kids--;      // Rethrow always has 1 less kid
    1.50 +            required_outcnt--;      // Rethrow always has 1 less kid
    1.51            } else if (call->req() > TypeFunc::Parms &&
    1.52                       call->is_CallDynamicJava()) {
    1.53              // Check for null receiver. In such case, the optimizer has
    1.54 @@ -2187,7 +2184,7 @@
    1.55              Node *arg0 = call->in(TypeFunc::Parms);
    1.56              if (arg0->is_Type() &&
    1.57                  arg0->as_Type()->type()->higher_equal(TypePtr::NULL_PTR)) {
    1.58 -              expected_kids--;
    1.59 +              required_outcnt--;
    1.60              }
    1.61            } else if (call->entry_point() == OptoRuntime::new_array_Java() &&
    1.62                       call->req() > TypeFunc::Parms+1 &&
    1.63 @@ -2198,13 +2195,13 @@
    1.64              Node *arg1 = call->in(TypeFunc::Parms+1);
    1.65              if (arg1->is_Type() &&
    1.66                  arg1->as_Type()->type()->join(TypeInt::POS)->empty()) {
    1.67 -              expected_kids--;
    1.68 +              required_outcnt--;
    1.69              }
    1.70            }
    1.71          }
    1.72        }
    1.73 -      // Recheck with a better notion of 'expected_kids'
    1.74 -      if (n->outcnt() != expected_kids) {
    1.75 +      // Recheck with a better notion of 'required_outcnt'
    1.76 +      if (n->outcnt() != required_outcnt) {
    1.77          record_method_not_compilable("malformed control flow");
    1.78          return true;            // Not all targets reachable!
    1.79        }

mercurial