3709 Node* ccast = alloc->make_ideal_length(ary_type, &_gvn); 3710 if (ccast != length) { 3711 _gvn.set_type_bottom(ccast); 3712 record_for_igvn(ccast); 3713 replace_in_map(length, ccast); 3714 } 3715 } 3716 3717 return javaoop; 3718 } 3719 3720 // The following "Ideal_foo" functions are placed here because they recognize 3721 // the graph shapes created by the functions immediately above. 3722 3723 //---------------------------Ideal_allocation---------------------------------- 3724 // Given an oop pointer or raw pointer, see if it feeds from an AllocateNode. 3725 AllocateNode* AllocateNode::Ideal_allocation(Node* ptr, PhaseTransform* phase) { 3726 if (ptr == NULL) { // reduce dumb test in callers 3727 return NULL; 3728 } 3729 if (ptr->is_CheckCastPP()) { // strip only one raw-to-oop cast 3730 ptr = ptr->in(1); 3731 if (ptr == NULL) return NULL; 3732 } 3733 // Return NULL for allocations with several casts: 3734 // j.l.reflect.Array.newInstance(jobject, jint) 3735 // Object.clone() 3736 // to keep more precise type from last cast. 3737 if (ptr->is_Proj()) { 3738 Node* allo = ptr->in(0); 3739 if (allo != NULL && allo->is_Allocate()) { 3740 return allo->as_Allocate(); 3741 } 3742 } 3743 // Report failure to match. 3744 return NULL; 3745 } 3746 3747 // Fancy version which also strips off an offset (and reports it to caller). 3748 AllocateNode* AllocateNode::Ideal_allocation(Node* ptr, PhaseTransform* phase, | 3709 Node* ccast = alloc->make_ideal_length(ary_type, &_gvn); 3710 if (ccast != length) { 3711 _gvn.set_type_bottom(ccast); 3712 record_for_igvn(ccast); 3713 replace_in_map(length, ccast); 3714 } 3715 } 3716 3717 return javaoop; 3718 } 3719 3720 // The following "Ideal_foo" functions are placed here because they recognize 3721 // the graph shapes created by the functions immediately above. 3722 3723 //---------------------------Ideal_allocation---------------------------------- 3724 // Given an oop pointer or raw pointer, see if it feeds from an AllocateNode. 3725 AllocateNode* AllocateNode::Ideal_allocation(Node* ptr, PhaseTransform* phase) { 3726 if (ptr == NULL) { // reduce dumb test in callers 3727 return NULL; 3728 } 3729 3730 BarrierSetC2* bs = BarrierSet::barrier_set()->barrier_set_c2(); 3731 ptr = bs->step_over_gc_barrier(ptr); 3732 3733 if (ptr->is_CheckCastPP()) { // strip only one raw-to-oop cast 3734 ptr = ptr->in(1); 3735 if (ptr == NULL) return NULL; 3736 } 3737 // Return NULL for allocations with several casts: 3738 // j.l.reflect.Array.newInstance(jobject, jint) 3739 // Object.clone() 3740 // to keep more precise type from last cast. 3741 if (ptr->is_Proj()) { 3742 Node* allo = ptr->in(0); 3743 if (allo != NULL && allo->is_Allocate()) { 3744 return allo->as_Allocate(); 3745 } 3746 } 3747 // Report failure to match. 3748 return NULL; 3749 } 3750 3751 // Fancy version which also strips off an offset (and reports it to caller). 3752 AllocateNode* AllocateNode::Ideal_allocation(Node* ptr, PhaseTransform* phase, |