< prev index next >

src/hotspot/share/opto/graphKit.cpp

Print this page

3965     // Try to get a better type than POS for the size
3966     ary_type = ary_type->is_aryptr()->cast_to_size(length_type);
3967   }
3968 
3969   Node* javaoop = set_output_for_allocation(alloc, ary_type, deoptimize_on_exception);
3970 
3971   array_ideal_length(alloc, ary_type, true);
3972   return javaoop;
3973 }
3974 
3975 // The following "Ideal_foo" functions are placed here because they recognize
3976 // the graph shapes created by the functions immediately above.
3977 
3978 //---------------------------Ideal_allocation----------------------------------
3979 // Given an oop pointer or raw pointer, see if it feeds from an AllocateNode.
3980 AllocateNode* AllocateNode::Ideal_allocation(Node* ptr) {
3981   if (ptr == nullptr) {     // reduce dumb test in callers
3982     return nullptr;
3983   }
3984 
3985   BarrierSetC2* bs = BarrierSet::barrier_set()->barrier_set_c2();
3986   ptr = bs->step_over_gc_barrier(ptr);
3987 
3988   if (ptr->is_CheckCastPP()) { // strip only one raw-to-oop cast
3989     ptr = ptr->in(1);
3990     if (ptr == nullptr) return nullptr;
3991   }
3992   // Return null for allocations with several casts:
3993   //   j.l.reflect.Array.newInstance(jobject, jint)
3994   //   Object.clone()
3995   // to keep more precise type from last cast.
3996   if (ptr->is_Proj()) {
3997     Node* allo = ptr->in(0);
3998     if (allo != nullptr && allo->is_Allocate()) {
3999       return allo->as_Allocate();
4000     }
4001   }
4002   // Report failure to match.
4003   return nullptr;
4004 }
4005 
4006 // Fancy version which also strips off an offset (and reports it to caller).
4007 AllocateNode* AllocateNode::Ideal_allocation(Node* ptr, PhaseValues* phase,

3965     // Try to get a better type than POS for the size
3966     ary_type = ary_type->is_aryptr()->cast_to_size(length_type);
3967   }
3968 
3969   Node* javaoop = set_output_for_allocation(alloc, ary_type, deoptimize_on_exception);
3970 
3971   array_ideal_length(alloc, ary_type, true);
3972   return javaoop;
3973 }
3974 
3975 // The following "Ideal_foo" functions are placed here because they recognize
3976 // the graph shapes created by the functions immediately above.
3977 
3978 //---------------------------Ideal_allocation----------------------------------
3979 // Given an oop pointer or raw pointer, see if it feeds from an AllocateNode.
3980 AllocateNode* AllocateNode::Ideal_allocation(Node* ptr) {
3981   if (ptr == nullptr) {     // reduce dumb test in callers
3982     return nullptr;
3983   }
3984 



3985   if (ptr->is_CheckCastPP()) { // strip only one raw-to-oop cast
3986     ptr = ptr->in(1);
3987     if (ptr == nullptr) return nullptr;
3988   }
3989   // Return null for allocations with several casts:
3990   //   j.l.reflect.Array.newInstance(jobject, jint)
3991   //   Object.clone()
3992   // to keep more precise type from last cast.
3993   if (ptr->is_Proj()) {
3994     Node* allo = ptr->in(0);
3995     if (allo != nullptr && allo->is_Allocate()) {
3996       return allo->as_Allocate();
3997     }
3998   }
3999   // Report failure to match.
4000   return nullptr;
4001 }
4002 
4003 // Fancy version which also strips off an offset (and reports it to caller).
4004 AllocateNode* AllocateNode::Ideal_allocation(Node* ptr, PhaseValues* phase,
< prev index next >