src/share/vm/opto/parse2.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot Sdiff src/share/vm/opto

src/share/vm/opto/parse2.cpp

Print this page
rev 5464 : 8024070: C2 needs some form of type speculation
Summary: record unused type profile information with type system, propagate and use it.
Reviewed-by:
rev 5465 : imported patch speculative-cleanup


2222 
2223   case Bytecodes::_ifnull:    btest = BoolTest::eq; goto handle_if_null;
2224   case Bytecodes::_ifnonnull: btest = BoolTest::ne; goto handle_if_null;
2225   handle_if_null:
2226     // If this is a backwards branch in the bytecodes, add Safepoint
2227     maybe_add_safepoint(iter().get_dest());
2228     a = null();
2229     b = pop();
2230     c = _gvn.transform( new (C) CmpPNode(b, a) );
2231     do_ifnull(btest, c);
2232     break;
2233 
2234   case Bytecodes::_if_acmpeq: btest = BoolTest::eq; goto handle_if_acmp;
2235   case Bytecodes::_if_acmpne: btest = BoolTest::ne; goto handle_if_acmp;
2236   handle_if_acmp:
2237     // If this is a backwards branch in the bytecodes, add Safepoint
2238     maybe_add_safepoint(iter().get_dest());
2239     a = pop();
2240     b = pop();
2241     c = _gvn.transform( new (C) CmpPNode(b, a) );

























2242     do_if(btest, c);
2243     break;
2244 
2245   case Bytecodes::_ifeq: btest = BoolTest::eq; goto handle_ifxx;
2246   case Bytecodes::_ifne: btest = BoolTest::ne; goto handle_ifxx;
2247   case Bytecodes::_iflt: btest = BoolTest::lt; goto handle_ifxx;
2248   case Bytecodes::_ifle: btest = BoolTest::le; goto handle_ifxx;
2249   case Bytecodes::_ifgt: btest = BoolTest::gt; goto handle_ifxx;
2250   case Bytecodes::_ifge: btest = BoolTest::ge; goto handle_ifxx;
2251   handle_ifxx:
2252     // If this is a backwards branch in the bytecodes, add Safepoint
2253     maybe_add_safepoint(iter().get_dest());
2254     a = _gvn.intcon(0);
2255     b = pop();
2256     c = _gvn.transform( new (C) CmpINode(b, a) );
2257     do_if(btest, c);
2258     break;
2259 
2260   case Bytecodes::_if_icmpeq: btest = BoolTest::eq; goto handle_if_icmp;
2261   case Bytecodes::_if_icmpne: btest = BoolTest::ne; goto handle_if_icmp;




2222 
2223   case Bytecodes::_ifnull:    btest = BoolTest::eq; goto handle_if_null;
2224   case Bytecodes::_ifnonnull: btest = BoolTest::ne; goto handle_if_null;
2225   handle_if_null:
2226     // If this is a backwards branch in the bytecodes, add Safepoint
2227     maybe_add_safepoint(iter().get_dest());
2228     a = null();
2229     b = pop();
2230     c = _gvn.transform( new (C) CmpPNode(b, a) );
2231     do_ifnull(btest, c);
2232     break;
2233 
2234   case Bytecodes::_if_acmpeq: btest = BoolTest::eq; goto handle_if_acmp;
2235   case Bytecodes::_if_acmpne: btest = BoolTest::ne; goto handle_if_acmp;
2236   handle_if_acmp:
2237     // If this is a backwards branch in the bytecodes, add Safepoint
2238     maybe_add_safepoint(iter().get_dest());
2239     a = pop();
2240     b = pop();
2241     c = _gvn.transform( new (C) CmpPNode(b, a) );
2242     // If this is transformed by the _gvn to a comparison with the low
2243     // level klass then we may be able to use speculation
2244     if (c->Opcode() == Op_CmpP &&
2245         (c->in(1)->Opcode() == Op_LoadKlass || c->in(1)->Opcode() == Op_DecodeNKlass ) &&
2246         c->in(2)->is_Con()) {
2247       Node* load_klass = NULL;
2248       if (c->in(1)->Opcode() == Op_DecodeNKlass) {
2249         load_klass = c->in(1)->in(1);
2250       } else {
2251         load_klass = c->in(1);
2252       }
2253       if (load_klass->in(2)->is_AddP()) {
2254         Node* obj = load_klass->in(2)->in(AddPNode::Address);
2255         const TypeOopPtr* obj_type = _gvn.type(obj)->is_oopptr();
2256         if (obj_type->speculative_type() != NULL) {
2257           ciKlass* k = obj_type->speculative_type();
2258           inc_sp(2);
2259           obj = maybe_cast_profiled_obj(obj, k);
2260           dec_sp(2);
2261           // now redo the CmpP which should always fail or succeed and
2262           // be optimized out
2263           c = _gvn.transform( new (C) CmpPNode(b, a) );
2264         }
2265       }
2266     }
2267     do_if(btest, c);
2268     break;
2269 
2270   case Bytecodes::_ifeq: btest = BoolTest::eq; goto handle_ifxx;
2271   case Bytecodes::_ifne: btest = BoolTest::ne; goto handle_ifxx;
2272   case Bytecodes::_iflt: btest = BoolTest::lt; goto handle_ifxx;
2273   case Bytecodes::_ifle: btest = BoolTest::le; goto handle_ifxx;
2274   case Bytecodes::_ifgt: btest = BoolTest::gt; goto handle_ifxx;
2275   case Bytecodes::_ifge: btest = BoolTest::ge; goto handle_ifxx;
2276   handle_ifxx:
2277     // If this is a backwards branch in the bytecodes, add Safepoint
2278     maybe_add_safepoint(iter().get_dest());
2279     a = _gvn.intcon(0);
2280     b = pop();
2281     c = _gvn.transform( new (C) CmpINode(b, a) );
2282     do_if(btest, c);
2283     break;
2284 
2285   case Bytecodes::_if_icmpeq: btest = BoolTest::eq; goto handle_if_icmp;
2286   case Bytecodes::_if_icmpne: btest = BoolTest::ne; goto handle_if_icmp;


src/share/vm/opto/parse2.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File