976 // The inline_native_clone() case when the arraycopy stub is called
977 // after the allocation before Initialize and CheckCastPP nodes.
978 // Or normal arraycopy for object arrays case.
979 //
980 // Set AddP's base (Allocate) as not scalar replaceable since
981 // pointer to the base (with offset) is passed as argument.
982 //
983 arg = get_addp_base(arg);
984 }
985 PointsToNode* arg_ptn = ptnode_adr(arg->_idx);
986 assert(arg_ptn != NULL, "should be registered");
987 PointsToNode::EscapeState arg_esc = arg_ptn->escape_state();
988 if (is_arraycopy || arg_esc < PointsToNode::ArgEscape) {
989 assert(aat == Type::TOP || aat == TypePtr::NULL_PTR ||
990 aat->isa_ptr() != NULL, "expecting an Ptr");
991 bool arg_has_oops = aat->isa_oopptr() &&
992 (aat->isa_oopptr()->klass() == NULL || aat->isa_instptr() ||
993 (aat->isa_aryptr() && aat->isa_aryptr()->klass()->is_obj_array_klass()) ||
994 (aat->isa_aryptr() && aat->isa_aryptr()->elem() != NULL &&
995 aat->isa_aryptr()->elem()->isa_valuetype() &&
996 aat->isa_aryptr()->elem()->isa_valuetype()->value_klass()->contains_oops()));
997 if (i == TypeFunc::Parms) {
998 src_has_oops = arg_has_oops;
999 }
1000 //
1001 // src or dst could be j.l.Object when other is basic type array:
1002 //
1003 // arraycopy(char[],0,Object*,0,size);
1004 // arraycopy(Object*,0,char[],0,size);
1005 //
1006 // Don't add edges in such cases.
1007 //
1008 bool arg_is_arraycopy_dest = src_has_oops && is_arraycopy &&
1009 arg_has_oops && (i > TypeFunc::Parms);
1010 #ifdef ASSERT
1011 if (!(is_arraycopy ||
1012 BarrierSet::barrier_set()->barrier_set_c2()->is_gc_barrier_node(call) ||
1013 (call->as_CallLeaf()->_name != NULL &&
1014 (strcmp(call->as_CallLeaf()->_name, "updateBytesCRC32") == 0 ||
1015 strcmp(call->as_CallLeaf()->_name, "updateBytesCRC32C") == 0 ||
1016 strcmp(call->as_CallLeaf()->_name, "updateBytesAdler32") == 0 ||
2114 if (field != NULL) {
2115 bt = field->layout_type();
2116 } else {
2117 // Check for unsafe oop field access
2118 if (n->has_out_with(Op_StoreP, Op_LoadP, Op_StoreN, Op_LoadN) ||
2119 n->has_out_with(Op_GetAndSetP, Op_GetAndSetN, Op_CompareAndExchangeP, Op_CompareAndExchangeN) ||
2120 n->has_out_with(Op_CompareAndSwapP, Op_CompareAndSwapN, Op_WeakCompareAndSwapP, Op_WeakCompareAndSwapN) ||
2121 BarrierSet::barrier_set()->barrier_set_c2()->escape_has_out_with_unsafe_object(n)) {
2122 bt = T_OBJECT;
2123 (*unsafe) = true;
2124 }
2125 }
2126 } else if (adr_type->isa_aryptr()) {
2127 if (offset == arrayOopDesc::length_offset_in_bytes()) {
2128 // Ignore array length load.
2129 } else if (find_second_addp(n, n->in(AddPNode::Base)) != NULL) {
2130 // Ignore first AddP.
2131 } else {
2132 const Type* elemtype = adr_type->isa_aryptr()->elem();
2133 if (elemtype->isa_valuetype() && field_offset != Type::OffsetBot) {
2134 ciValueKlass* vk = elemtype->is_valuetype()->value_klass();
2135 field_offset += vk->first_field_offset();
2136 bt = vk->get_field_by_offset(field_offset, false)->layout_type();
2137 } else {
2138 bt = elemtype->array_element_basic_type();
2139 }
2140 }
2141 } else if (adr_type->isa_rawptr() || adr_type->isa_klassptr()) {
2142 // Allocation initialization, ThreadLocal field access, unsafe access
2143 if (n->has_out_with(Op_StoreP, Op_LoadP, Op_StoreN, Op_LoadN) ||
2144 n->has_out_with(Op_GetAndSetP, Op_GetAndSetN, Op_CompareAndExchangeP, Op_CompareAndExchangeN) ||
2145 n->has_out_with(Op_CompareAndSwapP, Op_CompareAndSwapN, Op_WeakCompareAndSwapP, Op_WeakCompareAndSwapN) ||
2146 BarrierSet::barrier_set()->barrier_set_c2()->escape_has_out_with_unsafe_object(n)) {
2147 bt = T_OBJECT;
2148 }
2149 }
2150 }
2151 return (bt == T_OBJECT || bt == T_VALUETYPE || bt == T_NARROWOOP || bt == T_ARRAY);
2152 }
2153
2154 // Returns unique pointed java object or NULL.
|
976 // The inline_native_clone() case when the arraycopy stub is called
977 // after the allocation before Initialize and CheckCastPP nodes.
978 // Or normal arraycopy for object arrays case.
979 //
980 // Set AddP's base (Allocate) as not scalar replaceable since
981 // pointer to the base (with offset) is passed as argument.
982 //
983 arg = get_addp_base(arg);
984 }
985 PointsToNode* arg_ptn = ptnode_adr(arg->_idx);
986 assert(arg_ptn != NULL, "should be registered");
987 PointsToNode::EscapeState arg_esc = arg_ptn->escape_state();
988 if (is_arraycopy || arg_esc < PointsToNode::ArgEscape) {
989 assert(aat == Type::TOP || aat == TypePtr::NULL_PTR ||
990 aat->isa_ptr() != NULL, "expecting an Ptr");
991 bool arg_has_oops = aat->isa_oopptr() &&
992 (aat->isa_oopptr()->klass() == NULL || aat->isa_instptr() ||
993 (aat->isa_aryptr() && aat->isa_aryptr()->klass()->is_obj_array_klass()) ||
994 (aat->isa_aryptr() && aat->isa_aryptr()->elem() != NULL &&
995 aat->isa_aryptr()->elem()->isa_valuetype() &&
996 aat->isa_aryptr()->elem()->value_klass()->contains_oops()));
997 if (i == TypeFunc::Parms) {
998 src_has_oops = arg_has_oops;
999 }
1000 //
1001 // src or dst could be j.l.Object when other is basic type array:
1002 //
1003 // arraycopy(char[],0,Object*,0,size);
1004 // arraycopy(Object*,0,char[],0,size);
1005 //
1006 // Don't add edges in such cases.
1007 //
1008 bool arg_is_arraycopy_dest = src_has_oops && is_arraycopy &&
1009 arg_has_oops && (i > TypeFunc::Parms);
1010 #ifdef ASSERT
1011 if (!(is_arraycopy ||
1012 BarrierSet::barrier_set()->barrier_set_c2()->is_gc_barrier_node(call) ||
1013 (call->as_CallLeaf()->_name != NULL &&
1014 (strcmp(call->as_CallLeaf()->_name, "updateBytesCRC32") == 0 ||
1015 strcmp(call->as_CallLeaf()->_name, "updateBytesCRC32C") == 0 ||
1016 strcmp(call->as_CallLeaf()->_name, "updateBytesAdler32") == 0 ||
2114 if (field != NULL) {
2115 bt = field->layout_type();
2116 } else {
2117 // Check for unsafe oop field access
2118 if (n->has_out_with(Op_StoreP, Op_LoadP, Op_StoreN, Op_LoadN) ||
2119 n->has_out_with(Op_GetAndSetP, Op_GetAndSetN, Op_CompareAndExchangeP, Op_CompareAndExchangeN) ||
2120 n->has_out_with(Op_CompareAndSwapP, Op_CompareAndSwapN, Op_WeakCompareAndSwapP, Op_WeakCompareAndSwapN) ||
2121 BarrierSet::barrier_set()->barrier_set_c2()->escape_has_out_with_unsafe_object(n)) {
2122 bt = T_OBJECT;
2123 (*unsafe) = true;
2124 }
2125 }
2126 } else if (adr_type->isa_aryptr()) {
2127 if (offset == arrayOopDesc::length_offset_in_bytes()) {
2128 // Ignore array length load.
2129 } else if (find_second_addp(n, n->in(AddPNode::Base)) != NULL) {
2130 // Ignore first AddP.
2131 } else {
2132 const Type* elemtype = adr_type->isa_aryptr()->elem();
2133 if (elemtype->isa_valuetype() && field_offset != Type::OffsetBot) {
2134 ciValueKlass* vk = elemtype->value_klass();
2135 field_offset += vk->first_field_offset();
2136 bt = vk->get_field_by_offset(field_offset, false)->layout_type();
2137 } else {
2138 bt = elemtype->array_element_basic_type();
2139 }
2140 }
2141 } else if (adr_type->isa_rawptr() || adr_type->isa_klassptr()) {
2142 // Allocation initialization, ThreadLocal field access, unsafe access
2143 if (n->has_out_with(Op_StoreP, Op_LoadP, Op_StoreN, Op_LoadN) ||
2144 n->has_out_with(Op_GetAndSetP, Op_GetAndSetN, Op_CompareAndExchangeP, Op_CompareAndExchangeN) ||
2145 n->has_out_with(Op_CompareAndSwapP, Op_CompareAndSwapN, Op_WeakCompareAndSwapP, Op_WeakCompareAndSwapN) ||
2146 BarrierSet::barrier_set()->barrier_set_c2()->escape_has_out_with_unsafe_object(n)) {
2147 bt = T_OBJECT;
2148 }
2149 }
2150 }
2151 return (bt == T_OBJECT || bt == T_VALUETYPE || bt == T_NARROWOOP || bt == T_ARRAY);
2152 }
2153
2154 // Returns unique pointed java object or NULL.
|