1.1 --- a/src/share/vm/opto/parse2.cpp Wed Jul 16 16:04:39 2008 -0700 1.2 +++ b/src/share/vm/opto/parse2.cpp Mon Jul 21 13:37:05 2008 -0700 1.3 @@ -894,7 +894,7 @@ 1.4 } 1.5 1.6 //----------------------------------do_ifnull---------------------------------- 1.7 -void Parse::do_ifnull(BoolTest::mask btest) { 1.8 +void Parse::do_ifnull(BoolTest::mask btest, Node *c) { 1.9 int target_bci = iter().get_dest(); 1.10 1.11 Block* branch_block = successor_for_bci(target_bci); 1.12 @@ -906,8 +906,9 @@ 1.13 // (An earlier version of do_ifnull omitted this trap for OSR methods.) 1.14 #ifndef PRODUCT 1.15 if (PrintOpto && Verbose) 1.16 - tty->print_cr("Never-taken backedge stops compilation at bci %d",bci()); 1.17 + tty->print_cr("Never-taken edge stops compilation at bci %d",bci()); 1.18 #endif 1.19 + repush_if_args(); // to gather stats on loop 1.20 // We need to mark this branch as taken so that if we recompile we will 1.21 // see that it is possible. In the tiered system the interpreter doesn't 1.22 // do profiling and by the time we get to the lower tier from the interpreter 1.23 @@ -928,14 +929,6 @@ 1.24 maybe_add_safepoint(target_bci); 1.25 1.26 explicit_null_checks_inserted++; 1.27 - Node* a = null(); 1.28 - Node* b = pop(); 1.29 - Node* c = _gvn.transform( new (C, 3) CmpPNode(b, a) ); 1.30 - 1.31 - // Make a cast-away-nullness that is control dependent on the test 1.32 - const Type *t = _gvn.type(b); 1.33 - const Type *t_not_null = t->join(TypePtr::NOTNULL); 1.34 - Node *cast = new (C, 2) CastPPNode(b,t_not_null); 1.35 1.36 // Generate real control flow 1.37 Node *tst = _gvn.transform( new (C, 2) BoolNode( c, btest ) ); 1.38 @@ -997,7 +990,7 @@ 1.39 if (prob == PROB_UNKNOWN) { 1.40 #ifndef PRODUCT 1.41 if (PrintOpto && Verbose) 1.42 - tty->print_cr("Never-taken backedge stops compilation at bci %d",bci()); 1.43 + tty->print_cr("Never-taken edge stops compilation at bci %d",bci()); 1.44 #endif 1.45 repush_if_args(); // to gather stats on loop 1.46 // We need to mark this branch as taken so that if we recompile we will 1.47 @@ -1016,6 +1009,9 @@ 1.48 return; 1.49 } 1.50 1.51 + // If this is a backwards branch in the bytecodes, add Safepoint 1.52 + maybe_add_safepoint(target_bci); 1.53 + 1.54 // Sanity check the probability value 1.55 assert(0.0f < prob && prob < 1.0f,"Bad probability in Parser"); 1.56 1.57 @@ -2101,18 +2097,18 @@ 1.58 break; 1.59 } 1.60 1.61 - case Bytecodes::_ifnull: 1.62 - do_ifnull(BoolTest::eq); 1.63 - break; 1.64 - case Bytecodes::_ifnonnull: 1.65 - do_ifnull(BoolTest::ne); 1.66 + case Bytecodes::_ifnull: btest = BoolTest::eq; goto handle_if_null; 1.67 + case Bytecodes::_ifnonnull: btest = BoolTest::ne; goto handle_if_null; 1.68 + handle_if_null: 1.69 + a = null(); 1.70 + b = pop(); 1.71 + c = _gvn.transform( new (C, 3) CmpPNode(b, a) ); 1.72 + do_ifnull(btest, c); 1.73 break; 1.74 1.75 case Bytecodes::_if_acmpeq: btest = BoolTest::eq; goto handle_if_acmp; 1.76 case Bytecodes::_if_acmpne: btest = BoolTest::ne; goto handle_if_acmp; 1.77 handle_if_acmp: 1.78 - // If this is a backwards branch in the bytecodes, add Safepoint 1.79 - maybe_add_safepoint(iter().get_dest()); 1.80 a = pop(); 1.81 b = pop(); 1.82 c = _gvn.transform( new (C, 3) CmpPNode(b, a) ); 1.83 @@ -2126,8 +2122,6 @@ 1.84 case Bytecodes::_ifgt: btest = BoolTest::gt; goto handle_ifxx; 1.85 case Bytecodes::_ifge: btest = BoolTest::ge; goto handle_ifxx; 1.86 handle_ifxx: 1.87 - // If this is a backwards branch in the bytecodes, add Safepoint 1.88 - maybe_add_safepoint(iter().get_dest()); 1.89 a = _gvn.intcon(0); 1.90 b = pop(); 1.91 c = _gvn.transform( new (C, 3) CmpINode(b, a) ); 1.92 @@ -2141,8 +2135,6 @@ 1.93 case Bytecodes::_if_icmpgt: btest = BoolTest::gt; goto handle_if_icmp; 1.94 case Bytecodes::_if_icmpge: btest = BoolTest::ge; goto handle_if_icmp; 1.95 handle_if_icmp: 1.96 - // If this is a backwards branch in the bytecodes, add Safepoint 1.97 - maybe_add_safepoint(iter().get_dest()); 1.98 a = pop(); 1.99 b = pop(); 1.100 c = _gvn.transform( new (C, 3) CmpINode( b, a ) );