2710 Node* recv_klass = load_object_klass(receiver); 2711 Node* want_klass = makecon(tklass); 2712 Node* cmp = _gvn.transform( new CmpPNode(recv_klass, want_klass) ); 2713 Node* bol = _gvn.transform( new BoolNode(cmp, BoolTest::eq) ); 2714 IfNode* iff = create_and_xform_if(control(), bol, prob, COUNT_UNKNOWN); 2715 set_control( _gvn.transform( new IfTrueNode (iff) )); 2716 Node* fail = _gvn.transform( new IfFalseNode(iff) ); 2717 2718 const TypeOopPtr* recv_xtype = tklass->as_instance_type(); 2719 assert(recv_xtype->klass_is_exact(), ""); 2720 2721 // Subsume downstream occurrences of receiver with a cast to 2722 // recv_xtype, since now we know what the type will be. 2723 Node* cast = new CheckCastPPNode(control(), receiver, recv_xtype); 2724 (*casted_receiver) = _gvn.transform(cast); 2725 // (User must make the replace_in_map call.) 2726 2727 return fail; 2728 } 2729 2730 2731 //------------------------------seems_never_null------------------------------- 2732 // Use null_seen information if it is available from the profile. 2733 // If we see an unexpected null at a type check we record it and force a 2734 // recompile; the offending check will be recompiled to handle NULLs. 2735 // If we see several offending BCIs, then all checks in the 2736 // method will be recompiled. 2737 bool GraphKit::seems_never_null(Node* obj, ciProfileData* data, bool& speculating) { 2738 speculating = !_gvn.type(obj)->speculative_maybe_null(); 2739 Deoptimization::DeoptReason reason = Deoptimization::reason_null_check(speculating); 2740 if (UncommonNullCast // Cutout for this technique 2741 && obj != null() // And not the -Xcomp stupid case? 2742 && !too_many_traps(reason) 2743 ) { 2744 if (speculating) { 2745 return true; 2746 } 2747 if (data == NULL) 2748 // Edge case: no mature data. Be optimistic here. 2749 return true; 2750 // If the profile has not seen a null, assume it won't happen. | 2710 Node* recv_klass = load_object_klass(receiver); 2711 Node* want_klass = makecon(tklass); 2712 Node* cmp = _gvn.transform( new CmpPNode(recv_klass, want_klass) ); 2713 Node* bol = _gvn.transform( new BoolNode(cmp, BoolTest::eq) ); 2714 IfNode* iff = create_and_xform_if(control(), bol, prob, COUNT_UNKNOWN); 2715 set_control( _gvn.transform( new IfTrueNode (iff) )); 2716 Node* fail = _gvn.transform( new IfFalseNode(iff) ); 2717 2718 const TypeOopPtr* recv_xtype = tklass->as_instance_type(); 2719 assert(recv_xtype->klass_is_exact(), ""); 2720 2721 // Subsume downstream occurrences of receiver with a cast to 2722 // recv_xtype, since now we know what the type will be. 2723 Node* cast = new CheckCastPPNode(control(), receiver, recv_xtype); 2724 (*casted_receiver) = _gvn.transform(cast); 2725 // (User must make the replace_in_map call.) 2726 2727 return fail; 2728 } 2729 2730 Node* GraphKit::subtype_check_receiver(Node* receiver, ciKlass* klass, 2731 Node** casted_receiver) { 2732 const TypeKlassPtr* tklass = TypeKlassPtr::make(klass); 2733 Node* recv_klass = load_object_klass(receiver); 2734 Node* want_klass = makecon(tklass); 2735 2736 Node* slow_ctl = gen_subtype_check(recv_klass, want_klass); 2737 2738 // Cast receiver after successful check 2739 const TypeOopPtr* recv_type = tklass->cast_to_exactness(false)->is_klassptr()->as_instance_type(); 2740 Node* cast = new CheckCastPPNode(control(), receiver, recv_type); 2741 (*casted_receiver) = _gvn.transform(cast); 2742 2743 return slow_ctl; 2744 } 2745 //------------------------------seems_never_null------------------------------- 2746 // Use null_seen information if it is available from the profile. 2747 // If we see an unexpected null at a type check we record it and force a 2748 // recompile; the offending check will be recompiled to handle NULLs. 2749 // If we see several offending BCIs, then all checks in the 2750 // method will be recompiled. 2751 bool GraphKit::seems_never_null(Node* obj, ciProfileData* data, bool& speculating) { 2752 speculating = !_gvn.type(obj)->speculative_maybe_null(); 2753 Deoptimization::DeoptReason reason = Deoptimization::reason_null_check(speculating); 2754 if (UncommonNullCast // Cutout for this technique 2755 && obj != null() // And not the -Xcomp stupid case? 2756 && !too_many_traps(reason) 2757 ) { 2758 if (speculating) { 2759 return true; 2760 } 2761 if (data == NULL) 2762 // Edge case: no mature data. Be optimistic here. 2763 return true; 2764 // If the profile has not seen a null, assume it won't happen. |