< prev index next >

src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp

Print this page
rev 4139 : 8160591: Improve internal array handling
Reviewed-by: kvn
Contributed-by: Xiang Yuan <xiang.yuan@linaro.org>, Zoltan Majo <zoltan.majo@oracle.com>


2112     }
2113     __ bind(*stub->continuation());
2114     return;
2115   }
2116 
2117   assert(default_type != NULL && default_type->is_array_klass(), "must be true at this point");
2118 
2119   // make sure src and dst are non-null and load array length
2120   if (flags & LIR_OpArrayCopy::src_null_check) {
2121     __ tst(src);
2122     __ brx(Assembler::equal, false, Assembler::pn, *stub->entry());
2123     __ delayed()->nop();
2124   }
2125 
2126   if (flags & LIR_OpArrayCopy::dst_null_check) {
2127     __ tst(dst);
2128     __ brx(Assembler::equal, false, Assembler::pn, *stub->entry());
2129     __ delayed()->nop();
2130   }
2131 





















2132   if (flags & LIR_OpArrayCopy::src_pos_positive_check) {
2133     // test src_pos register
2134     __ cmp_zero_and_br(Assembler::less, src_pos, *stub->entry());
2135     __ delayed()->nop();
2136   }
2137 
2138   if (flags & LIR_OpArrayCopy::dst_pos_positive_check) {
2139     // test dst_pos register
2140     __ cmp_zero_and_br(Assembler::less, dst_pos, *stub->entry());
2141     __ delayed()->nop();
2142   }
2143 
2144   if (flags & LIR_OpArrayCopy::length_positive_check) {
2145     // make sure length isn't negative
2146     __ cmp_zero_and_br(Assembler::less, length, *stub->entry());
2147     __ delayed()->nop();
2148   }
2149 
2150   if (flags & LIR_OpArrayCopy::src_range_check) {
2151     __ ld(src, arrayOopDesc::length_offset_in_bytes(), tmp2);




2112     }
2113     __ bind(*stub->continuation());
2114     return;
2115   }
2116 
2117   assert(default_type != NULL && default_type->is_array_klass(), "must be true at this point");
2118 
2119   // make sure src and dst are non-null and load array length
2120   if (flags & LIR_OpArrayCopy::src_null_check) {
2121     __ tst(src);
2122     __ brx(Assembler::equal, false, Assembler::pn, *stub->entry());
2123     __ delayed()->nop();
2124   }
2125 
2126   if (flags & LIR_OpArrayCopy::dst_null_check) {
2127     __ tst(dst);
2128     __ brx(Assembler::equal, false, Assembler::pn, *stub->entry());
2129     __ delayed()->nop();
2130   }
2131 
2132   // If the compiler was not able to prove that exact type of the source or the destination
2133   // of the arraycopy is an array type, check at runtime if the source or the destination is
2134   // an instance type.
2135   if (flags & LIR_OpArrayCopy::type_check) {
2136     if (!(flags & LIR_OpArrayCopy::LIR_OpArrayCopy::dst_objarray)) {
2137       __ load_klass(dst, tmp);
2138       __ lduw(tmp, in_bytes(Klass::layout_helper_offset()), tmp2);
2139       __ cmp(tmp2, Klass::_lh_neutral_value);
2140       __ br(Assembler::greaterEqual, false, Assembler::pn, *stub->entry());
2141       __ delayed()->nop();
2142     }
2143 
2144     if (!(flags & LIR_OpArrayCopy::LIR_OpArrayCopy::src_objarray)) {
2145       __ load_klass(src, tmp);
2146       __ lduw(tmp, in_bytes(Klass::layout_helper_offset()), tmp2);
2147       __ cmp(tmp2, Klass::_lh_neutral_value);
2148       __ br(Assembler::greaterEqual, false, Assembler::pn, *stub->entry());
2149       __ delayed()->nop();
2150     }
2151   }
2152 
2153   if (flags & LIR_OpArrayCopy::src_pos_positive_check) {
2154     // test src_pos register
2155     __ cmp_zero_and_br(Assembler::less, src_pos, *stub->entry());
2156     __ delayed()->nop();
2157   }
2158 
2159   if (flags & LIR_OpArrayCopy::dst_pos_positive_check) {
2160     // test dst_pos register
2161     __ cmp_zero_and_br(Assembler::less, dst_pos, *stub->entry());
2162     __ delayed()->nop();
2163   }
2164 
2165   if (flags & LIR_OpArrayCopy::length_positive_check) {
2166     // make sure length isn't negative
2167     __ cmp_zero_and_br(Assembler::less, length, *stub->entry());
2168     __ delayed()->nop();
2169   }
2170 
2171   if (flags & LIR_OpArrayCopy::src_range_check) {
2172     __ ld(src, arrayOopDesc::length_offset_in_bytes(), tmp2);


< prev index next >