< prev index next >

src/hotspot/share/opto/graphKit.cpp

Print this page

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

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



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