< prev index next >

src/hotspot/share/opto/graphKit.cpp

Print this page




2777   Node* recv_klass = load_object_klass(receiver);
2778   Node* want_klass = makecon(tklass);
2779   Node* cmp = _gvn.transform( new CmpPNode(recv_klass, want_klass) );
2780   Node* bol = _gvn.transform( new BoolNode(cmp, BoolTest::eq) );
2781   IfNode* iff = create_and_xform_if(control(), bol, prob, COUNT_UNKNOWN);
2782   set_control( _gvn.transform( new IfTrueNode (iff) ));
2783   Node* fail = _gvn.transform( new IfFalseNode(iff) );
2784 
2785   const TypeOopPtr* recv_xtype = tklass->as_instance_type();
2786   assert(recv_xtype->klass_is_exact(), "");
2787 
2788   // Subsume downstream occurrences of receiver with a cast to
2789   // recv_xtype, since now we know what the type will be.
2790   Node* cast = new CheckCastPPNode(control(), receiver, recv_xtype);
2791   (*casted_receiver) = _gvn.transform(cast);
2792   // (User must make the replace_in_map call.)
2793 
2794   return fail;
2795 }
2796 
















2797 
2798 //------------------------------seems_never_null-------------------------------
2799 // Use null_seen information if it is available from the profile.
2800 // If we see an unexpected null at a type check we record it and force a
2801 // recompile; the offending check will be recompiled to handle NULLs.
2802 // If we see several offending BCIs, then all checks in the
2803 // method will be recompiled.
2804 bool GraphKit::seems_never_null(Node* obj, ciProfileData* data, bool& speculating) {
2805   speculating = !_gvn.type(obj)->speculative_maybe_null();
2806   Deoptimization::DeoptReason reason = Deoptimization::reason_null_check(speculating);
2807   if (UncommonNullCast               // Cutout for this technique
2808       && obj != null()               // And not the -Xcomp stupid case?
2809       && !too_many_traps(reason)
2810       ) {
2811     if (speculating) {
2812       return true;
2813     }
2814     if (data == NULL)
2815       // Edge case:  no mature data.  Be optimistic here.
2816       return true;




2777   Node* recv_klass = load_object_klass(receiver);
2778   Node* want_klass = makecon(tklass);
2779   Node* cmp = _gvn.transform( new CmpPNode(recv_klass, want_klass) );
2780   Node* bol = _gvn.transform( new BoolNode(cmp, BoolTest::eq) );
2781   IfNode* iff = create_and_xform_if(control(), bol, prob, COUNT_UNKNOWN);
2782   set_control( _gvn.transform( new IfTrueNode (iff) ));
2783   Node* fail = _gvn.transform( new IfFalseNode(iff) );
2784 
2785   const TypeOopPtr* recv_xtype = tklass->as_instance_type();
2786   assert(recv_xtype->klass_is_exact(), "");
2787 
2788   // Subsume downstream occurrences of receiver with a cast to
2789   // recv_xtype, since now we know what the type will be.
2790   Node* cast = new CheckCastPPNode(control(), receiver, recv_xtype);
2791   (*casted_receiver) = _gvn.transform(cast);
2792   // (User must make the replace_in_map call.)
2793 
2794   return fail;
2795 }
2796 
2797 //------------------------------subtype_check_receiver-------------------------
2798 Node* GraphKit::subtype_check_receiver(Node* receiver, ciKlass* klass,
2799                                        Node** casted_receiver) {
2800   const TypeKlassPtr* tklass = TypeKlassPtr::make(klass);
2801   Node* recv_klass = load_object_klass(receiver);
2802   Node* want_klass = makecon(tklass);
2803 
2804   Node* slow_ctl = gen_subtype_check(recv_klass, want_klass);
2805 
2806   // Cast receiver after successful check
2807   const TypeOopPtr* recv_type = tklass->cast_to_exactness(false)->is_klassptr()->as_instance_type();
2808   Node* cast = new CheckCastPPNode(control(), receiver, recv_type);
2809   (*casted_receiver) = _gvn.transform(cast);
2810 
2811   return slow_ctl;
2812 }
2813 
2814 //------------------------------seems_never_null-------------------------------
2815 // Use null_seen information if it is available from the profile.
2816 // If we see an unexpected null at a type check we record it and force a
2817 // recompile; the offending check will be recompiled to handle NULLs.
2818 // If we see several offending BCIs, then all checks in the
2819 // method will be recompiled.
2820 bool GraphKit::seems_never_null(Node* obj, ciProfileData* data, bool& speculating) {
2821   speculating = !_gvn.type(obj)->speculative_maybe_null();
2822   Deoptimization::DeoptReason reason = Deoptimization::reason_null_check(speculating);
2823   if (UncommonNullCast               // Cutout for this technique
2824       && obj != null()               // And not the -Xcomp stupid case?
2825       && !too_many_traps(reason)
2826       ) {
2827     if (speculating) {
2828       return true;
2829     }
2830     if (data == NULL)
2831       // Edge case:  no mature data.  Be optimistic here.
2832       return true;


< prev index next >