1.1 --- a/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp Thu Jun 30 23:08:42 2016 +0300 1.2 +++ b/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp Fri Jul 01 09:33:34 2016 +0200 1.3 @@ -3275,6 +3275,23 @@ 1.4 __ jcc(Assembler::zero, *stub->entry()); 1.5 } 1.6 1.7 + // If the compiler was not able to prove that exact type of the source or the destination 1.8 + // of the arraycopy is an array type, check at runtime if the source or the destination is 1.9 + // an instance type. 1.10 + if (flags & LIR_OpArrayCopy::type_check) { 1.11 + if (!(flags & LIR_OpArrayCopy::dst_objarray)) { 1.12 + __ load_klass(tmp, dst); 1.13 + __ cmpl(Address(tmp, in_bytes(Klass::layout_helper_offset())), Klass::_lh_neutral_value); 1.14 + __ jcc(Assembler::greaterEqual, *stub->entry()); 1.15 + } 1.16 + 1.17 + if (!(flags & LIR_OpArrayCopy::src_objarray)) { 1.18 + __ load_klass(tmp, src); 1.19 + __ cmpl(Address(tmp, in_bytes(Klass::layout_helper_offset())), Klass::_lh_neutral_value); 1.20 + __ jcc(Assembler::greaterEqual, *stub->entry()); 1.21 + } 1.22 + } 1.23 + 1.24 // check if negative 1.25 if (flags & LIR_OpArrayCopy::src_pos_positive_check) { 1.26 __ testl(src_pos, src_pos);