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