8160591: Improve internal array handling

Co-authored-by: Xiang Yuan <xiang.yuan@linaro.org>
Reviewed-by: kvn
This commit is contained in:
Zoltan Majo 2016-07-01 09:33:34 +02:00
parent 5f49daa2c4
commit 154d568edd
3 changed files with 102 additions and 0 deletions

View file

@ -2034,6 +2034,27 @@ void LIR_Assembler::emit_arraycopy(LIR_OpArrayCopy* op) {
__ delayed()->nop();
}
// If the compiler was not able to prove that exact type of the source or the destination
// of the arraycopy is an array type, check at runtime if the source or the destination is
// an instance type.
if (flags & LIR_OpArrayCopy::type_check) {
if (!(flags & LIR_OpArrayCopy::LIR_OpArrayCopy::dst_objarray)) {
__ load_klass(dst, tmp);
__ lduw(tmp, in_bytes(Klass::layout_helper_offset()), tmp2);
__ cmp(tmp2, Klass::_lh_neutral_value);
__ br(Assembler::greaterEqual, false, Assembler::pn, *stub->entry());
__ delayed()->nop();
}
if (!(flags & LIR_OpArrayCopy::LIR_OpArrayCopy::src_objarray)) {
__ load_klass(src, tmp);
__ lduw(tmp, in_bytes(Klass::layout_helper_offset()), tmp2);
__ cmp(tmp2, Klass::_lh_neutral_value);
__ br(Assembler::greaterEqual, false, Assembler::pn, *stub->entry());
__ delayed()->nop();
}
}
if (flags & LIR_OpArrayCopy::src_pos_positive_check) {
// test src_pos register
__ cmp_zero_and_br(Assembler::less, src_pos, *stub->entry());