src/cpu/x86/vm/stubGenerator_x86_32.cpp

Print this page
rev 4534 : 8010927: Kitchensink crashed with SIGSEGV, Problematic frame: v ~StubRoutines::checkcast_arraycopy
Summary: Changed gen_write_ref_array_post_barrier() code on x64 to pass start address and number of copied oop elements. In generate_checkcast_copy() skip post barrier code if no elements are copied.
Reviewed-by: roland

*** 1532,1555 **** // It was a real error; we must depend on the caller to finish the job. // Register "count" = -1 * number of *remaining* oops, length_arg = *total* oops. // Emit GC store barriers for the oops we have copied (length_arg + count), // and report their number to the caller. __ addl(count, length_arg); // transfers = (length - remaining) __ movl2ptr(rax, count); // save the value ! __ notptr(rax); // report (-1^K) to caller ! __ movptr(to, to_arg); // reload ! assert_different_registers(to, count, rax); ! gen_write_ref_array_post_barrier(to, count); ! __ jmpb(L_done); // Come here on success only. __ BIND(L_do_card_marks); __ movl2ptr(count, length_arg); __ movptr(to, to_arg); // reload gen_write_ref_array_post_barrier(to, count); - __ xorptr(rax, rax); // return 0 on success // Common exit point (success or failure). __ BIND(L_done); __ pop(rbx); __ pop(rdi); --- 1532,1557 ---- // It was a real error; we must depend on the caller to finish the job. // Register "count" = -1 * number of *remaining* oops, length_arg = *total* oops. // Emit GC store barriers for the oops we have copied (length_arg + count), // and report their number to the caller. + assert_different_registers(to, count, rax); + Label L_post_barrier; __ addl(count, length_arg); // transfers = (length - remaining) __ movl2ptr(rax, count); // save the value ! __ notptr(rax); // report (-1^K) to caller (does not affect flags) ! __ jccb(Assembler::notZero, L_post_barrier); ! __ jmp(L_done); // K == 0, nothing was copied, skip post barrier // Come here on success only. __ BIND(L_do_card_marks); + __ xorptr(rax, rax); // return 0 on success __ movl2ptr(count, length_arg); + + __ BIND(L_post_barrier); __ movptr(to, to_arg); // reload gen_write_ref_array_post_barrier(to, count); // Common exit point (success or failure). __ BIND(L_done); __ pop(rbx); __ pop(rdi);