src/share/vm/opto/parse2.cpp
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File
hotspot Cdiff src/share/vm/opto/parse2.cpp
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
*** 2237,2246 ****
--- 2237,2271 ----
// If this is a backwards branch in the bytecodes, add Safepoint
maybe_add_safepoint(iter().get_dest());
a = pop();
b = pop();
c = _gvn.transform( new (C) CmpPNode(b, a) );
+ // If this is transformed by the _gvn to a comparison with the low
+ // level klass then we may be able to use speculation
+ if (c->Opcode() == Op_CmpP &&
+ (c->in(1)->Opcode() == Op_LoadKlass || c->in(1)->Opcode() == Op_DecodeNKlass ) &&
+ c->in(2)->is_Con()) {
+ Node* load_klass = NULL;
+ if (c->in(1)->Opcode() == Op_DecodeNKlass) {
+ load_klass = c->in(1)->in(1);
+ } else {
+ load_klass = c->in(1);
+ }
+ if (load_klass->in(2)->is_AddP()) {
+ Node* obj = load_klass->in(2)->in(AddPNode::Address);
+ const TypeOopPtr* obj_type = _gvn.type(obj)->is_oopptr();
+ if (obj_type->speculative_type() != NULL) {
+ ciKlass* k = obj_type->speculative_type();
+ inc_sp(2);
+ obj = maybe_cast_profiled_obj(obj, k);
+ dec_sp(2);
+ // now redo the CmpP which should always fail or succeed and
+ // be optimized out
+ c = _gvn.transform( new (C) CmpPNode(b, a) );
+ }
+ }
+ }
do_if(btest, c);
break;
case Bytecodes::_ifeq: btest = BoolTest::eq; goto handle_ifxx;
case Bytecodes::_ifne: btest = BoolTest::ne; goto handle_ifxx;
src/share/vm/opto/parse2.cpp
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File