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