提交 44227033 编写于 作者: I iveresov

7020521: arraycopy stubs place prebarriers incorrectly

Summary: Rearranged the pre-barrier placement in arraycopy stubs so that they are properly called in case of chained calls. Also refactored the code a little bit so that it looks uniform across the platforms and is more readable.
Reviewed-by: never, kvn
上级 3757fbff
...@@ -945,6 +945,12 @@ class StubGenerator: public StubCodeGenerator { ...@@ -945,6 +945,12 @@ class StubGenerator: public StubCodeGenerator {
__ movptr(from , Address(rsp, 12+ 4)); __ movptr(from , Address(rsp, 12+ 4));
__ movptr(to , Address(rsp, 12+ 8)); __ movptr(to , Address(rsp, 12+ 8));
__ movl(count, Address(rsp, 12+ 12)); __ movl(count, Address(rsp, 12+ 12));
if (entry != NULL) {
*entry = __ pc(); // Entry point from conjoint arraycopy stub.
BLOCK_COMMENT("Entry:");
}
if (t == T_OBJECT) { if (t == T_OBJECT) {
__ testl(count, count); __ testl(count, count);
__ jcc(Assembler::zero, L_0_count); __ jcc(Assembler::zero, L_0_count);
...@@ -952,9 +958,6 @@ class StubGenerator: public StubCodeGenerator { ...@@ -952,9 +958,6 @@ class StubGenerator: public StubCodeGenerator {
__ mov(saved_to, to); // save 'to' __ mov(saved_to, to); // save 'to'
} }
*entry = __ pc(); // Entry point from conjoint arraycopy stub.
BLOCK_COMMENT("Entry:");
__ subptr(to, from); // to --> to_from __ subptr(to, from); // to --> to_from
__ cmpl(count, 2<<shift); // Short arrays (< 8 bytes) copy by element __ cmpl(count, 2<<shift); // Short arrays (< 8 bytes) copy by element
__ jcc(Assembler::below, L_copy_4_bytes); // use unsigned cmp __ jcc(Assembler::below, L_copy_4_bytes); // use unsigned cmp
...@@ -1108,23 +1111,17 @@ class StubGenerator: public StubCodeGenerator { ...@@ -1108,23 +1111,17 @@ class StubGenerator: public StubCodeGenerator {
__ movptr(src , Address(rsp, 12+ 4)); // from __ movptr(src , Address(rsp, 12+ 4)); // from
__ movptr(dst , Address(rsp, 12+ 8)); // to __ movptr(dst , Address(rsp, 12+ 8)); // to
__ movl2ptr(count, Address(rsp, 12+12)); // count __ movl2ptr(count, Address(rsp, 12+12)); // count
if (t == T_OBJECT) {
gen_write_ref_array_pre_barrier(dst, count);
}
if (entry != NULL) { if (entry != NULL) {
*entry = __ pc(); // Entry point from generic arraycopy stub. *entry = __ pc(); // Entry point from generic arraycopy stub.
BLOCK_COMMENT("Entry:"); BLOCK_COMMENT("Entry:");
} }
if (t == T_OBJECT) { // nooverlap_target expects arguments in rsi and rdi.
__ testl(count, count);
__ jcc(Assembler::zero, L_0_count);
}
__ mov(from, src); __ mov(from, src);
__ mov(to , dst); __ mov(to , dst);
// arrays overlap test // arrays overlap test: dispatch to disjoint stub if necessary.
RuntimeAddress nooverlap(nooverlap_target); RuntimeAddress nooverlap(nooverlap_target);
__ cmpptr(dst, src); __ cmpptr(dst, src);
__ lea(end, Address(src, count, sf, 0)); // src + count * elem_size __ lea(end, Address(src, count, sf, 0)); // src + count * elem_size
...@@ -1132,6 +1129,12 @@ class StubGenerator: public StubCodeGenerator { ...@@ -1132,6 +1129,12 @@ class StubGenerator: public StubCodeGenerator {
__ cmpptr(dst, end); __ cmpptr(dst, end);
__ jump_cc(Assembler::aboveEqual, nooverlap); __ jump_cc(Assembler::aboveEqual, nooverlap);
if (t == T_OBJECT) {
__ testl(count, count);
__ jcc(Assembler::zero, L_0_count);
gen_write_ref_array_pre_barrier(dst, count);
}
// copy from high to low // copy from high to low
__ cmpl(count, 2<<shift); // Short arrays (< 8 bytes) copy by element __ cmpl(count, 2<<shift); // Short arrays (< 8 bytes) copy by element
__ jcc(Assembler::below, L_copy_4_bytes); // use unsigned cmp __ jcc(Assembler::below, L_copy_4_bytes); // use unsigned cmp
...@@ -1451,8 +1454,10 @@ class StubGenerator: public StubCodeGenerator { ...@@ -1451,8 +1454,10 @@ class StubGenerator: public StubCodeGenerator {
__ movptr(to, to_arg); __ movptr(to, to_arg);
__ movl2ptr(length, length_arg); __ movl2ptr(length, length_arg);
if (entry != NULL) {
*entry = __ pc(); // Entry point from generic arraycopy stub. *entry = __ pc(); // Entry point from generic arraycopy stub.
BLOCK_COMMENT("Entry:"); BLOCK_COMMENT("Entry:");
}
//--------------------------------------------------------------- //---------------------------------------------------------------
// Assembler stub will be used for this call to arraycopy // Assembler stub will be used for this call to arraycopy
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册