8202547: Move G1 runtime calls used by generated code to G1BarrierSetRuntime

Reviewed-by: rkennke, tschatzl
This commit is contained in:
Erik Österlund 2018-06-04 12:59:51 +02:00
parent 4dec1a457f
commit 6e9153ef8b
14 changed files with 167 additions and 100 deletions

View file

@ -29,6 +29,7 @@
#include "gc/g1/c1/g1BarrierSetC1.hpp" #include "gc/g1/c1/g1BarrierSetC1.hpp"
#include "gc/g1/g1BarrierSet.hpp" #include "gc/g1/g1BarrierSet.hpp"
#include "gc/g1/g1BarrierSetAssembler.hpp" #include "gc/g1/g1BarrierSetAssembler.hpp"
#include "gc/g1/g1BarrierSetRuntime.hpp"
#include "gc/g1/g1CardTable.hpp" #include "gc/g1/g1CardTable.hpp"
#include "gc/g1/g1ThreadLocalData.hpp" #include "gc/g1/g1ThreadLocalData.hpp"
#include "gc/g1/heapRegion.hpp" #include "gc/g1/heapRegion.hpp"
@ -60,9 +61,9 @@ void G1BarrierSetAssembler::gen_write_ref_array_pre_barrier(MacroAssembler* masm
__ mov(c_rarg1, count); __ mov(c_rarg1, count);
} }
if (UseCompressedOops) { if (UseCompressedOops) {
__ call_VM_leaf(CAST_FROM_FN_PTR(address, G1BarrierSet::write_ref_array_pre_narrow_oop_entry), 2); __ call_VM_leaf(CAST_FROM_FN_PTR(address, G1BarrierSetRuntime::write_ref_array_pre_narrow_oop_entry), 2);
} else { } else {
__ call_VM_leaf(CAST_FROM_FN_PTR(address, G1BarrierSet::write_ref_array_pre_oop_entry), 2); __ call_VM_leaf(CAST_FROM_FN_PTR(address, G1BarrierSetRuntime::write_ref_array_pre_oop_entry), 2);
} }
__ pop(saved_regs, sp); __ pop(saved_regs, sp);
} }
@ -78,7 +79,7 @@ void G1BarrierSetAssembler::gen_write_ref_array_post_barrier(MacroAssembler* mas
__ lsr(scratch, scratch, LogBytesPerHeapOop); // convert to element count __ lsr(scratch, scratch, LogBytesPerHeapOop); // convert to element count
__ mov(c_rarg0, start); __ mov(c_rarg0, start);
__ mov(c_rarg1, scratch); __ mov(c_rarg1, scratch);
__ call_VM_leaf(CAST_FROM_FN_PTR(address, G1BarrierSet::write_ref_array_post_entry), 2); __ call_VM_leaf(CAST_FROM_FN_PTR(address, G1BarrierSetRuntime::write_ref_array_post_entry), 2);
__ pop(saved_regs, sp); __ pop(saved_regs, sp);
} }
@ -161,9 +162,9 @@ void G1BarrierSetAssembler::g1_write_barrier_pre(MacroAssembler* masm,
if (expand_call) { if (expand_call) {
assert(pre_val != c_rarg1, "smashed arg"); assert(pre_val != c_rarg1, "smashed arg");
__ super_call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_pre), pre_val, thread); __ super_call_VM_leaf(CAST_FROM_FN_PTR(address, G1BarrierSetRuntime::write_ref_field_pre_entry), pre_val, thread);
} else { } else {
__ call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_pre), pre_val, thread); __ call_VM_leaf(CAST_FROM_FN_PTR(address, G1BarrierSetRuntime::write_ref_field_pre_entry), pre_val, thread);
} }
__ pop(saved, sp); __ pop(saved, sp);
@ -245,7 +246,7 @@ void G1BarrierSetAssembler::g1_write_barrier_post(MacroAssembler* masm,
// save the live input values // save the live input values
RegSet saved = RegSet::of(store_addr, new_val); RegSet saved = RegSet::of(store_addr, new_val);
__ push(saved, sp); __ push(saved, sp);
__ call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_post), card_addr, thread); __ call_VM_leaf(CAST_FROM_FN_PTR(address, G1BarrierSetRuntime::write_ref_field_post_entry), card_addr, thread);
__ pop(saved, sp); __ pop(saved, sp);
__ bind(done); __ bind(done);
@ -398,7 +399,7 @@ void G1BarrierSetAssembler::generate_c1_pre_barrier_runtime_stub(StubAssembler*
__ bind(runtime); __ bind(runtime);
__ push_call_clobbered_registers(); __ push_call_clobbered_registers();
__ load_parameter(0, pre_val); __ load_parameter(0, pre_val);
__ call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_pre), pre_val, thread); __ call_VM_leaf(CAST_FROM_FN_PTR(address, G1BarrierSetRuntime::write_ref_field_pre_entry), pre_val, thread);
__ pop_call_clobbered_registers(); __ pop_call_clobbered_registers();
__ bind(done); __ bind(done);
@ -468,7 +469,7 @@ void G1BarrierSetAssembler::generate_c1_post_barrier_runtime_stub(StubAssembler*
__ bind(runtime); __ bind(runtime);
__ push_call_clobbered_registers(); __ push_call_clobbered_registers();
__ call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_post), card_addr, thread); __ call_VM_leaf(CAST_FROM_FN_PTR(address, G1BarrierSetRuntime::write_ref_field_post_entry), card_addr, thread);
__ pop_call_clobbered_registers(); __ pop_call_clobbered_registers();
__ bind(done); __ bind(done);
__ epilogue(); __ epilogue();

View file

@ -26,6 +26,7 @@
#include "asm/macroAssembler.inline.hpp" #include "asm/macroAssembler.inline.hpp"
#include "gc/g1/g1BarrierSet.hpp" #include "gc/g1/g1BarrierSet.hpp"
#include "gc/g1/g1BarrierSetAssembler.hpp" #include "gc/g1/g1BarrierSetAssembler.hpp"
#include "gc/g1/g1BarrierSetRuntime.hpp"
#include "gc/g1/g1ThreadLocalData.hpp" #include "gc/g1/g1ThreadLocalData.hpp"
#include "gc/g1/g1CardTable.hpp" #include "gc/g1/g1CardTable.hpp"
#include "gc/g1/g1ThreadLocalData.hpp" #include "gc/g1/g1ThreadLocalData.hpp"
@ -74,7 +75,7 @@ void G1BarrierSetAssembler::gen_write_ref_array_pre_barrier(MacroAssembler* masm
__ mov(R0, addr); __ mov(R0, addr);
} }
#ifdef AARCH64 #ifdef AARCH64
__ zero_extend(R1, count, 32); // G1BarrierSet::write_ref_array_pre_*_entry takes size_t __ zero_extend(R1, count, 32); // G1BarrierSetRuntime::write_ref_array_pre_*_entry takes size_t
#else #else
if (count != R1) { if (count != R1) {
__ mov(R1, count); __ mov(R1, count);
@ -82,9 +83,9 @@ void G1BarrierSetAssembler::gen_write_ref_array_pre_barrier(MacroAssembler* masm
#endif // AARCH64 #endif // AARCH64
if (UseCompressedOops) { if (UseCompressedOops) {
__ call(CAST_FROM_FN_PTR(address, G1BarrierSet::write_ref_array_pre_narrow_oop_entry)); __ call(CAST_FROM_FN_PTR(address, G1BarrierSetRuntime::write_ref_array_pre_narrow_oop_entry));
} else { } else {
__ call(CAST_FROM_FN_PTR(address, G1BarrierSet::write_ref_array_pre_oop_entry)); __ call(CAST_FROM_FN_PTR(address, G1BarrierSetRuntime::write_ref_array_pre_oop_entry));
} }
#ifdef AARCH64 #ifdef AARCH64
@ -106,7 +107,7 @@ void G1BarrierSetAssembler::gen_write_ref_array_post_barrier(MacroAssembler* mas
__ mov(R0, addr); __ mov(R0, addr);
} }
#ifdef AARCH64 #ifdef AARCH64
__ zero_extend(R1, count, 32); // G1BarrierSet::write_ref_array_post_entry takes size_t __ zero_extend(R1, count, 32); // G1BarrierSetRuntime::write_ref_array_post_entry takes size_t
#else #else
if (count != R1) { if (count != R1) {
__ mov(R1, count); __ mov(R1, count);
@ -120,7 +121,7 @@ void G1BarrierSetAssembler::gen_write_ref_array_post_barrier(MacroAssembler* mas
__ push(R9); __ push(R9);
#endif // !R9_IS_SCRATCHED #endif // !R9_IS_SCRATCHED
#endif // !AARCH64 #endif // !AARCH64
__ call(CAST_FROM_FN_PTR(address, G1BarrierSet::write_ref_array_post_entry)); __ call(CAST_FROM_FN_PTR(address, G1BarrierSetRuntime::write_ref_array_post_entry));
#ifndef AARCH64 #ifndef AARCH64
#if R9_IS_SCRATCHED #if R9_IS_SCRATCHED
__ pop(R9); __ pop(R9);
@ -205,7 +206,7 @@ void G1BarrierSetAssembler::g1_write_barrier_pre(MacroAssembler* masm,
} }
__ mov(R1, Rthread); __ mov(R1, Rthread);
__ call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_pre), R0, R1); __ call_VM_leaf(CAST_FROM_FN_PTR(address, G1BarrierSetRuntime::write_ref_field_pre_entry), R0, R1);
#ifdef AARCH64 #ifdef AARCH64
if (store_addr != noreg) { if (store_addr != noreg) {
@ -296,7 +297,7 @@ void G1BarrierSetAssembler::g1_write_barrier_post(MacroAssembler* masm,
__ mov(R0, card_addr); __ mov(R0, card_addr);
} }
__ mov(R1, Rthread); __ mov(R1, Rthread);
__ call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_post), R0, R1); __ call_VM_leaf(CAST_FROM_FN_PTR(address, G1BarrierSetRuntime::write_ref_field_post_entry), R0, R1);
__ bind(done); __ bind(done);
} }
@ -467,7 +468,7 @@ void G1BarrierSetAssembler::generate_c1_pre_barrier_runtime_stub(StubAssembler*
assert(r_pre_val_0 == c_rarg0, "pre_val should be in R0"); assert(r_pre_val_0 == c_rarg0, "pre_val should be in R0");
__ mov(c_rarg1, Rthread); __ mov(c_rarg1, Rthread);
__ call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_pre), c_rarg0, c_rarg1); __ call_VM_leaf(CAST_FROM_FN_PTR(address, G1BarrierSetRuntime::write_ref_field_pre_entry), c_rarg0, c_rarg1);
__ restore_live_registers_without_return(); __ restore_live_registers_without_return();
@ -574,7 +575,7 @@ void G1BarrierSetAssembler::generate_c1_post_barrier_runtime_stub(StubAssembler*
assert(r_card_addr_0 == c_rarg0, "card_addr should be in R0"); assert(r_card_addr_0 == c_rarg0, "card_addr should be in R0");
__ mov(c_rarg1, Rthread); __ mov(c_rarg1, Rthread);
__ call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_post), c_rarg0, c_rarg1); __ call_VM_leaf(CAST_FROM_FN_PTR(address, G1BarrierSetRuntime::write_ref_field_post_entry), c_rarg0, c_rarg1);
__ restore_live_registers_without_return(); __ restore_live_registers_without_return();

View file

@ -27,6 +27,7 @@
#include "asm/macroAssembler.inline.hpp" #include "asm/macroAssembler.inline.hpp"
#include "gc/g1/g1BarrierSet.hpp" #include "gc/g1/g1BarrierSet.hpp"
#include "gc/g1/g1BarrierSetAssembler.hpp" #include "gc/g1/g1BarrierSetAssembler.hpp"
#include "gc/g1/g1BarrierSetRuntime.hpp"
#include "gc/g1/g1CardTable.hpp" #include "gc/g1/g1CardTable.hpp"
#include "gc/g1/g1ThreadLocalData.hpp" #include "gc/g1/g1ThreadLocalData.hpp"
#include "gc/g1/heapRegion.hpp" #include "gc/g1/heapRegion.hpp"
@ -72,9 +73,9 @@ void G1BarrierSetAssembler::gen_write_ref_array_pre_barrier(MacroAssembler* masm
if (preserve2 != noreg) { __ std(preserve2, frame_size - (++slot_nr) * wordSize, R1_SP); } if (preserve2 != noreg) { __ std(preserve2, frame_size - (++slot_nr) * wordSize, R1_SP); }
if (UseCompressedOops) { if (UseCompressedOops) {
__ call_VM_leaf(CAST_FROM_FN_PTR(address, G1BarrierSet::write_ref_array_pre_narrow_oop_entry), to, count); __ call_VM_leaf(CAST_FROM_FN_PTR(address, G1BarrierSetRuntime::write_ref_array_pre_narrow_oop_entry), to, count);
} else { } else {
__ call_VM_leaf(CAST_FROM_FN_PTR(address, G1BarrierSet::write_ref_array_pre_oop_entry), to, count); __ call_VM_leaf(CAST_FROM_FN_PTR(address, G1BarrierSetRuntime::write_ref_array_pre_oop_entry), to, count);
} }
slot_nr = 0; slot_nr = 0;
@ -98,7 +99,7 @@ void G1BarrierSetAssembler::gen_write_ref_array_post_barrier(MacroAssembler* mas
__ save_LR_CR(R0); __ save_LR_CR(R0);
__ push_frame(frame_size, R0); __ push_frame(frame_size, R0);
if (preserve != noreg) { __ std(preserve, frame_size - 1 * wordSize, R1_SP); } if (preserve != noreg) { __ std(preserve, frame_size - 1 * wordSize, R1_SP); }
__ call_VM_leaf(CAST_FROM_FN_PTR(address, G1BarrierSet::write_ref_array_post_entry), addr, count); __ call_VM_leaf(CAST_FROM_FN_PTR(address, G1BarrierSetRuntime::write_ref_array_post_entry), addr, count);
if (preserve != noreg) { __ ld(preserve, frame_size - 1 * wordSize, R1_SP); } if (preserve != noreg) { __ ld(preserve, frame_size - 1 * wordSize, R1_SP); }
__ addi(R1_SP, R1_SP, frame_size); // pop_frame(); __ addi(R1_SP, R1_SP, frame_size); // pop_frame();
__ restore_LR_CR(R0); __ restore_LR_CR(R0);
@ -191,7 +192,7 @@ void G1BarrierSetAssembler::g1_write_barrier_pre(MacroAssembler* masm, Decorator
} }
if (pre_val->is_volatile() && preloaded) { __ mr(nv_save, pre_val); } // Save pre_val across C call if it was preloaded. if (pre_val->is_volatile() && preloaded) { __ mr(nv_save, pre_val); } // Save pre_val across C call if it was preloaded.
__ call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_pre), pre_val, R16_thread); __ call_VM_leaf(CAST_FROM_FN_PTR(address, G1BarrierSetRuntime::write_ref_field_pre_entry), pre_val, R16_thread);
if (pre_val->is_volatile() && preloaded) { __ mr(pre_val, nv_save); } // restore if (pre_val->is_volatile() && preloaded) { __ mr(pre_val, nv_save); } // restore
if (needs_frame) { if (needs_frame) {
@ -272,7 +273,7 @@ void G1BarrierSetAssembler::g1_write_barrier_post(MacroAssembler* masm, Decorato
__ bind(runtime); __ bind(runtime);
// Save the live input values. // Save the live input values.
__ call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_post), Rcard_addr, R16_thread); __ call_VM_leaf(CAST_FROM_FN_PTR(address, G1BarrierSetRuntime::write_ref_field_post_entry), Rcard_addr, R16_thread);
__ bind(filtered); __ bind(filtered);
} }

View file

@ -29,6 +29,7 @@
#include "gc/g1/g1CardTable.hpp" #include "gc/g1/g1CardTable.hpp"
#include "gc/g1/g1BarrierSet.hpp" #include "gc/g1/g1BarrierSet.hpp"
#include "gc/g1/g1BarrierSetAssembler.hpp" #include "gc/g1/g1BarrierSetAssembler.hpp"
#include "gc/g1/g1BarrierSetRuntime.hpp"
#include "gc/g1/g1ThreadLocalData.hpp" #include "gc/g1/g1ThreadLocalData.hpp"
#include "gc/g1/heapRegion.hpp" #include "gc/g1/heapRegion.hpp"
#include "interpreter/interp_masm.hpp" #include "interpreter/interp_masm.hpp"
@ -66,9 +67,9 @@ void G1BarrierSetAssembler::gen_write_ref_array_pre_barrier(MacroAssembler* masm
RegisterSaver::save_live_registers(masm, RegisterSaver::arg_registers); // Creates frame. RegisterSaver::save_live_registers(masm, RegisterSaver::arg_registers); // Creates frame.
if (UseCompressedOops) { if (UseCompressedOops) {
__ call_VM_leaf(CAST_FROM_FN_PTR(address, G1BarrierSet::write_ref_array_pre_narrow_oop_entry), addr, count); __ call_VM_leaf(CAST_FROM_FN_PTR(address, G1BarrierSetRuntime::write_ref_array_pre_narrow_oop_entry), addr, count);
} else { } else {
__ call_VM_leaf(CAST_FROM_FN_PTR(address, G1BarrierSet::write_ref_array_pre_oop_entry), addr, count); __ call_VM_leaf(CAST_FROM_FN_PTR(address, G1BarrierSetRuntime::write_ref_array_pre_oop_entry), addr, count);
} }
RegisterSaver::restore_live_registers(masm, RegisterSaver::arg_registers); RegisterSaver::restore_live_registers(masm, RegisterSaver::arg_registers);
@ -79,7 +80,7 @@ void G1BarrierSetAssembler::gen_write_ref_array_pre_barrier(MacroAssembler* masm
void G1BarrierSetAssembler::gen_write_ref_array_post_barrier(MacroAssembler* masm, DecoratorSet decorators, void G1BarrierSetAssembler::gen_write_ref_array_post_barrier(MacroAssembler* masm, DecoratorSet decorators,
Register addr, Register count, bool do_return) { Register addr, Register count, bool do_return) {
address entry_point = CAST_FROM_FN_PTR(address, G1BarrierSet::write_ref_array_post_entry); address entry_point = CAST_FROM_FN_PTR(address, G1BarrierSetRuntime::write_ref_array_post_entry);
if (!do_return) { if (!do_return) {
assert_different_registers(addr, Z_R0_scratch); // would be destroyed by push_frame() assert_different_registers(addr, Z_R0_scratch); // would be destroyed by push_frame()
assert_different_registers(count, Z_R0_scratch); // would be destroyed by push_frame() assert_different_registers(count, Z_R0_scratch); // would be destroyed by push_frame()
@ -234,7 +235,7 @@ void G1BarrierSetAssembler::g1_write_barrier_pre(MacroAssembler* masm, Decorator
__ push_frame_abi160(0); // Will use Z_R0 as tmp. __ push_frame_abi160(0); // Will use Z_R0 as tmp.
// Rpre_val may be destroyed by push_frame(). // Rpre_val may be destroyed by push_frame().
__ call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_pre), Rpre_save, Z_thread); __ call_VM_leaf(CAST_FROM_FN_PTR(address, G1BarrierSetRuntime::write_ref_field_pre_entry), Rpre_save, Z_thread);
__ pop_frame(); __ pop_frame();
__ restore_return_pc(); __ restore_return_pc();
@ -359,7 +360,7 @@ void G1BarrierSetAssembler::g1_write_barrier_post(MacroAssembler* masm, Decorato
} }
// Save the live input values. // Save the live input values.
__ call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_post), Rcard_addr, Z_thread); __ call_VM_leaf(CAST_FROM_FN_PTR(address, G1BarrierSetRuntime::write_ref_field_post_entry), Rcard_addr, Z_thread);
if (needs_frame) { if (needs_frame) {
__ pop_frame(); __ pop_frame();

View file

@ -26,6 +26,7 @@
#include "asm/macroAssembler.inline.hpp" #include "asm/macroAssembler.inline.hpp"
#include "gc/g1/g1BarrierSet.hpp" #include "gc/g1/g1BarrierSet.hpp"
#include "gc/g1/g1BarrierSetAssembler.hpp" #include "gc/g1/g1BarrierSetAssembler.hpp"
#include "gc/g1/g1BarrierSetRuntime.hpp"
#include "gc/g1/g1CardTable.hpp" #include "gc/g1/g1CardTable.hpp"
#include "gc/g1/g1ThreadLocalData.hpp" #include "gc/g1/g1ThreadLocalData.hpp"
#include "gc/g1/heapRegion.hpp" #include "gc/g1/heapRegion.hpp"
@ -68,8 +69,8 @@ void G1BarrierSetAssembler::gen_write_ref_array_pre_barrier(MacroAssembler* masm
} }
__ mov(addr->after_save(), O0); __ mov(addr->after_save(), O0);
// Get the count into O1 // Get the count into O1
address slowpath = UseCompressedOops ? CAST_FROM_FN_PTR(address, G1BarrierSet::write_ref_array_pre_narrow_oop_entry) address slowpath = UseCompressedOops ? CAST_FROM_FN_PTR(address, G1BarrierSetRuntime::write_ref_array_pre_narrow_oop_entry)
: CAST_FROM_FN_PTR(address, G1BarrierSet::write_ref_array_pre_oop_entry); : CAST_FROM_FN_PTR(address, G1BarrierSetRuntime::write_ref_array_pre_oop_entry);
__ call(slowpath); __ call(slowpath);
__ delayed()->mov(count->after_save(), O1); __ delayed()->mov(count->after_save(), O1);
if (addr->is_global()) { if (addr->is_global()) {
@ -90,7 +91,7 @@ void G1BarrierSetAssembler::gen_write_ref_array_post_barrier(MacroAssembler* mas
// Get some new fresh output registers. // Get some new fresh output registers.
__ save_frame(0); __ save_frame(0);
__ mov(addr->after_save(), O0); __ mov(addr->after_save(), O0);
__ call(CAST_FROM_FN_PTR(address, G1BarrierSet::write_ref_array_post_entry)); __ call(CAST_FROM_FN_PTR(address, G1BarrierSetRuntime::write_ref_array_post_entry));
__ delayed()->mov(count->after_save(), O1); __ delayed()->mov(count->after_save(), O1);
__ restore(); __ restore();
} }

View file

@ -26,6 +26,7 @@
#include "asm/macroAssembler.inline.hpp" #include "asm/macroAssembler.inline.hpp"
#include "gc/g1/g1BarrierSet.hpp" #include "gc/g1/g1BarrierSet.hpp"
#include "gc/g1/g1BarrierSetAssembler.hpp" #include "gc/g1/g1BarrierSetAssembler.hpp"
#include "gc/g1/g1BarrierSetRuntime.hpp"
#include "gc/g1/g1CardTable.hpp" #include "gc/g1/g1CardTable.hpp"
#include "gc/g1/g1ThreadLocalData.hpp" #include "gc/g1/g1ThreadLocalData.hpp"
#include "gc/g1/heapRegion.hpp" #include "gc/g1/heapRegion.hpp"
@ -80,12 +81,12 @@ void G1BarrierSetAssembler::gen_write_ref_array_pre_barrier(MacroAssembler* masm
__ movptr(c_rarg1, count); __ movptr(c_rarg1, count);
} }
if (UseCompressedOops) { if (UseCompressedOops) {
__ call_VM_leaf(CAST_FROM_FN_PTR(address, G1BarrierSet::write_ref_array_pre_narrow_oop_entry), 2); __ call_VM_leaf(CAST_FROM_FN_PTR(address, G1BarrierSetRuntime::write_ref_array_pre_narrow_oop_entry), 2);
} else { } else {
__ call_VM_leaf(CAST_FROM_FN_PTR(address, G1BarrierSet::write_ref_array_pre_oop_entry), 2); __ call_VM_leaf(CAST_FROM_FN_PTR(address, G1BarrierSetRuntime::write_ref_array_pre_oop_entry), 2);
} }
#else #else
__ call_VM_leaf(CAST_FROM_FN_PTR(address, G1BarrierSet::write_ref_array_pre_oop_entry), __ call_VM_leaf(CAST_FROM_FN_PTR(address, G1BarrierSetRuntime::write_ref_array_pre_oop_entry),
addr, count); addr, count);
#endif #endif
__ popa(); __ popa();
@ -107,9 +108,9 @@ void G1BarrierSetAssembler::gen_write_ref_array_post_barrier(MacroAssembler* mas
__ mov(c_rarg0, addr); __ mov(c_rarg0, addr);
__ mov(c_rarg1, count); __ mov(c_rarg1, count);
} }
__ call_VM_leaf(CAST_FROM_FN_PTR(address, G1BarrierSet::write_ref_array_post_entry), 2); __ call_VM_leaf(CAST_FROM_FN_PTR(address, G1BarrierSetRuntime::write_ref_array_post_entry), 2);
#else #else
__ call_VM_leaf(CAST_FROM_FN_PTR(address, G1BarrierSet::write_ref_array_post_entry), __ call_VM_leaf(CAST_FROM_FN_PTR(address, G1BarrierSetRuntime::write_ref_array_post_entry),
addr, count); addr, count);
#endif #endif
__ popa(); __ popa();
@ -238,9 +239,9 @@ void G1BarrierSetAssembler::g1_write_barrier_pre(MacroAssembler* masm,
__ push(thread); __ push(thread);
__ push(pre_val); __ push(pre_val);
#endif #endif
__ MacroAssembler::call_VM_leaf_base(CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_pre), 2); __ MacroAssembler::call_VM_leaf_base(CAST_FROM_FN_PTR(address, G1BarrierSetRuntime::write_ref_field_pre_entry), 2);
} else { } else {
__ call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_pre), pre_val, thread); __ call_VM_leaf(CAST_FROM_FN_PTR(address, G1BarrierSetRuntime::write_ref_field_pre_entry), pre_val, thread);
} }
NOT_LP64( __ pop(thread); ) NOT_LP64( __ pop(thread); )
@ -333,10 +334,10 @@ void G1BarrierSetAssembler::g1_write_barrier_post(MacroAssembler* masm,
__ push(store_addr); __ push(store_addr);
__ push(new_val); __ push(new_val);
#ifdef _LP64 #ifdef _LP64
__ call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_post), card_addr, r15_thread); __ call_VM_leaf(CAST_FROM_FN_PTR(address, G1BarrierSetRuntime::write_ref_field_post_entry), card_addr, r15_thread);
#else #else
__ push(thread); __ push(thread);
__ call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_post), card_addr, thread); __ call_VM_leaf(CAST_FROM_FN_PTR(address, G1BarrierSetRuntime::write_ref_field_post_entry), card_addr, thread);
__ pop(thread); __ pop(thread);
#endif #endif
__ pop(new_val); __ pop(new_val);
@ -500,7 +501,7 @@ void G1BarrierSetAssembler::generate_c1_pre_barrier_runtime_stub(StubAssembler*
// load the pre-value // load the pre-value
__ load_parameter(0, rcx); __ load_parameter(0, rcx);
__ call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_pre), rcx, thread); __ call_VM_leaf(CAST_FROM_FN_PTR(address, G1BarrierSetRuntime::write_ref_field_pre_entry), rcx, thread);
__ restore_live_registers(true); __ restore_live_registers(true);
@ -577,7 +578,7 @@ void G1BarrierSetAssembler::generate_c1_post_barrier_runtime_stub(StubAssembler*
__ save_live_registers_no_oop_map(true); __ save_live_registers_no_oop_map(true);
__ call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_post), card_addr, thread); __ call_VM_leaf(CAST_FROM_FN_PTR(address, G1BarrierSetRuntime::write_ref_field_post_entry), card_addr, thread);
__ restore_live_registers(true); __ restore_live_registers(true);

View file

@ -25,6 +25,7 @@
#include "precompiled.hpp" #include "precompiled.hpp"
#include "gc/g1/c2/g1BarrierSetC2.hpp" #include "gc/g1/c2/g1BarrierSetC2.hpp"
#include "gc/g1/g1BarrierSet.hpp" #include "gc/g1/g1BarrierSet.hpp"
#include "gc/g1/g1BarrierSetRuntime.hpp"
#include "gc/g1/g1CardTable.hpp" #include "gc/g1/g1CardTable.hpp"
#include "gc/g1/g1ThreadLocalData.hpp" #include "gc/g1/g1ThreadLocalData.hpp"
#include "gc/g1/heapRegion.hpp" #include "gc/g1/heapRegion.hpp"
@ -33,10 +34,9 @@
#include "opto/idealKit.hpp" #include "opto/idealKit.hpp"
#include "opto/macro.hpp" #include "opto/macro.hpp"
#include "opto/type.hpp" #include "opto/type.hpp"
#include "runtime/sharedRuntime.hpp"
#include "utilities/macros.hpp" #include "utilities/macros.hpp"
const TypeFunc *G1BarrierSetC2::g1_wb_pre_Type() { const TypeFunc *G1BarrierSetC2::write_ref_field_pre_entry_Type() {
const Type **fields = TypeTuple::fields(2); const Type **fields = TypeTuple::fields(2);
fields[TypeFunc::Parms+0] = TypeInstPtr::NOTNULL; // original field value fields[TypeFunc::Parms+0] = TypeInstPtr::NOTNULL; // original field value
fields[TypeFunc::Parms+1] = TypeRawPtr::NOTNULL; // thread fields[TypeFunc::Parms+1] = TypeRawPtr::NOTNULL; // thread
@ -49,7 +49,7 @@ const TypeFunc *G1BarrierSetC2::g1_wb_pre_Type() {
return TypeFunc::make(domain, range); return TypeFunc::make(domain, range);
} }
const TypeFunc *G1BarrierSetC2::g1_wb_post_Type() { const TypeFunc *G1BarrierSetC2::write_ref_field_post_entry_Type() {
const Type **fields = TypeTuple::fields(2); const Type **fields = TypeTuple::fields(2);
fields[TypeFunc::Parms+0] = TypeRawPtr::NOTNULL; // Card addr fields[TypeFunc::Parms+0] = TypeRawPtr::NOTNULL; // Card addr
fields[TypeFunc::Parms+1] = TypeRawPtr::NOTNULL; // thread fields[TypeFunc::Parms+1] = TypeRawPtr::NOTNULL; // thread
@ -264,8 +264,8 @@ void G1BarrierSetC2::pre_barrier(GraphKit* kit,
} __ else_(); { } __ else_(); {
// logging buffer is full, call the runtime // logging buffer is full, call the runtime
const TypeFunc *tf = g1_wb_pre_Type(); const TypeFunc *tf = write_ref_field_pre_entry_Type();
__ make_leaf_call(tf, CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_pre), "g1_wb_pre", pre_val, tls); __ make_leaf_call(tf, CAST_FROM_FN_PTR(address, G1BarrierSetRuntime::write_ref_field_pre_entry), "write_ref_field_pre_entry", pre_val, tls);
} __ end_if(); // (!index) } __ end_if(); // (!index)
} __ end_if(); // (pre_val != NULL) } __ end_if(); // (pre_val != NULL)
} __ end_if(); // (!marking) } __ end_if(); // (!marking)
@ -364,7 +364,7 @@ void G1BarrierSetC2::g1_mark_card(GraphKit* kit,
__ store(__ ctrl(), index_adr, next_index, TypeX_X->basic_type(), Compile::AliasIdxRaw, MemNode::unordered); __ store(__ ctrl(), index_adr, next_index, TypeX_X->basic_type(), Compile::AliasIdxRaw, MemNode::unordered);
} __ else_(); { } __ else_(); {
__ make_leaf_call(tf, CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_post), "g1_wb_post", card_adr, __ thread()); __ make_leaf_call(tf, CAST_FROM_FN_PTR(address, G1BarrierSetRuntime::write_ref_field_post_entry), "write_ref_field_post_entry", card_adr, __ thread());
} __ end_if(); } __ end_if();
} }
@ -419,7 +419,7 @@ void G1BarrierSetC2::post_barrier(GraphKit* kit,
Node* dirty_card = __ ConI((jint)G1CardTable::dirty_card_val()); Node* dirty_card = __ ConI((jint)G1CardTable::dirty_card_val());
Node* zeroX = __ ConX(0); Node* zeroX = __ ConX(0);
const TypeFunc *tf = g1_wb_post_Type(); const TypeFunc *tf = write_ref_field_post_entry_Type();
// Offsets into the thread // Offsets into the thread
const int index_offset = in_bytes(G1ThreadLocalData::dirty_card_queue_index_offset()); const int index_offset = in_bytes(G1ThreadLocalData::dirty_card_queue_index_offset());
@ -652,7 +652,7 @@ bool G1BarrierSetC2::is_gc_barrier_node(Node* node) const {
return false; return false;
} }
return strcmp(call->_name, "g1_wb_pre") == 0 || strcmp(call->_name, "g1_wb_post") == 0; return strcmp(call->_name, "write_ref_field_pre_entry") == 0 || strcmp(call->_name, "write_ref_field_post_entry") == 0;
} }
void G1BarrierSetC2::eliminate_gc_barrier(PhaseMacroExpand* macro, Node* node) const { void G1BarrierSetC2::eliminate_gc_barrier(PhaseMacroExpand* macro, Node* node) const {
@ -747,7 +747,7 @@ Node* G1BarrierSetC2::step_over_gc_barrier(Node* c) const {
if (r->in(j) != NULL && r->in(j)->is_Proj() && if (r->in(j) != NULL && r->in(j)->is_Proj() &&
r->in(j)->in(0) != NULL && r->in(j)->in(0) != NULL &&
r->in(j)->in(0)->Opcode() == Op_CallLeaf && r->in(j)->in(0)->Opcode() == Op_CallLeaf &&
r->in(j)->in(0)->as_Call()->entry_point() == CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_post)) { r->in(j)->in(0)->as_Call()->entry_point() == CAST_FROM_FN_PTR(address, G1BarrierSetRuntime::write_ref_field_post_entry)) {
Node* call = r->in(j)->in(0); Node* call = r->in(j)->in(0);
c = c->in(i == 1 ? 2 : 1); c = c->in(i == 1 ? 2 : 1);
if (c != NULL) { if (c != NULL) {

View file

@ -79,8 +79,8 @@ protected:
// Unsafe.getObject should be recorded in an SATB log buffer. // Unsafe.getObject should be recorded in an SATB log buffer.
void insert_pre_barrier(GraphKit* kit, Node* base_oop, Node* offset, Node* pre_val, bool need_mem_bar) const; void insert_pre_barrier(GraphKit* kit, Node* base_oop, Node* offset, Node* pre_val, bool need_mem_bar) const;
static const TypeFunc* g1_wb_pre_Type(); static const TypeFunc* write_ref_field_pre_entry_Type();
static const TypeFunc* g1_wb_post_Type(); static const TypeFunc* write_ref_field_post_entry_Type();
virtual Node* load_at_resolved(C2Access& access, const Type* val_type) const; virtual Node* load_at_resolved(C2Access& access, const Type* val_type) const;

View file

@ -72,21 +72,6 @@ void G1BarrierSet::enqueue(oop pre_val) {
} }
} }
void G1BarrierSet::write_ref_array_pre_oop_entry(oop* dst, size_t length) {
G1BarrierSet *bs = barrier_set_cast<G1BarrierSet>(BarrierSet::barrier_set());
bs->write_ref_array_pre(dst, length, false);
}
void G1BarrierSet::write_ref_array_pre_narrow_oop_entry(narrowOop* dst, size_t length) {
G1BarrierSet *bs = barrier_set_cast<G1BarrierSet>(BarrierSet::barrier_set());
bs->write_ref_array_pre(dst, length, false);
}
void G1BarrierSet::write_ref_array_post_entry(HeapWord* dst, size_t length) {
G1BarrierSet *bs = barrier_set_cast<G1BarrierSet>(BarrierSet::barrier_set());
bs->G1BarrierSet::write_ref_array(dst, length);
}
template <class T> void template <class T> void
G1BarrierSet::write_ref_array_pre_work(T* dst, size_t count) { G1BarrierSet::write_ref_array_pre_work(T* dst, size_t count) {
if (!_satb_mark_queue_set.is_active()) return; if (!_satb_mark_queue_set.is_active()) return;

View file

@ -56,10 +56,6 @@ class G1BarrierSet: public CardTableBarrierSet {
virtual void write_ref_array_pre(oop* dst, size_t count, bool dest_uninitialized); virtual void write_ref_array_pre(oop* dst, size_t count, bool dest_uninitialized);
virtual void write_ref_array_pre(narrowOop* dst, size_t count, bool dest_uninitialized); virtual void write_ref_array_pre(narrowOop* dst, size_t count, bool dest_uninitialized);
static void write_ref_array_pre_oop_entry(oop* dst, size_t length);
static void write_ref_array_pre_narrow_oop_entry(narrowOop* dst, size_t length);
static void write_ref_array_post_entry(HeapWord* dst, size_t length);
template <DecoratorSet decorators, typename T> template <DecoratorSet decorators, typename T>
void write_ref_field_pre(T* field); void write_ref_field_pre(T* field);

View file

@ -0,0 +1,61 @@
/*
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#include "precompiled.hpp"
#include "gc/g1/g1BarrierSet.inline.hpp"
#include "gc/g1/g1BarrierSetRuntime.hpp"
#include "gc/g1/g1ThreadLocalData.hpp"
#include "runtime/interfaceSupport.inline.hpp"
#include "utilities/macros.hpp"
void G1BarrierSetRuntime::write_ref_array_pre_oop_entry(oop* dst, size_t length) {
G1BarrierSet *bs = barrier_set_cast<G1BarrierSet>(BarrierSet::barrier_set());
bs->write_ref_array_pre(dst, length, false);
}
void G1BarrierSetRuntime::write_ref_array_pre_narrow_oop_entry(narrowOop* dst, size_t length) {
G1BarrierSet *bs = barrier_set_cast<G1BarrierSet>(BarrierSet::barrier_set());
bs->write_ref_array_pre(dst, length, false);
}
void G1BarrierSetRuntime::write_ref_array_post_entry(HeapWord* dst, size_t length) {
G1BarrierSet *bs = barrier_set_cast<G1BarrierSet>(BarrierSet::barrier_set());
bs->G1BarrierSet::write_ref_array(dst, length);
}
// G1 pre write barrier slowpath
JRT_LEAF(void, G1BarrierSetRuntime::write_ref_field_pre_entry(oopDesc* orig, JavaThread *thread))
if (orig == NULL) {
assert(false, "should be optimized out");
return;
}
assert(oopDesc::is_oop(orig, true /* ignore mark word */), "Error");
// store the original value that was in the field reference
G1ThreadLocalData::satb_mark_queue(thread).enqueue(orig);
JRT_END
// G1 post write barrier slowpath
JRT_LEAF(void, G1BarrierSetRuntime::write_ref_field_post_entry(void* card_addr, JavaThread* thread))
G1ThreadLocalData::dirty_card_queue(thread).enqueue(card_addr);
JRT_END

View file

@ -0,0 +1,48 @@
/*
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#ifndef SHARE_GC_G1_G1BARRIERSETRUNTIME_HPP
#define SHARE_GC_G1_G1BARRIERSETRUNTIME_HPP
#include "memory/allocation.hpp"
#include "oops/oopsHierarchy.hpp"
#include "utilities/globalDefinitions.hpp"
#include "utilities/macros.hpp"
class oopDesc;
class JavaThread;
class G1BarrierSetRuntime: public AllStatic {
public:
// Arraycopy stub generator
static void write_ref_array_pre_oop_entry(oop* dst, size_t length);
static void write_ref_array_pre_narrow_oop_entry(narrowOop* dst, size_t length);
static void write_ref_array_post_entry(HeapWord* dst, size_t length);
// C2 slow-path runtime calls.
static void write_ref_field_pre_entry(oopDesc* orig, JavaThread *thread);
static void write_ref_field_post_entry(void* card_addr, JavaThread* thread);
};
#endif // SHARE_GC_G1_G1BARRIERSETRUNTIME_HPP

View file

@ -76,9 +76,6 @@
#ifdef COMPILER1 #ifdef COMPILER1
#include "c1/c1_Runtime1.hpp" #include "c1/c1_Runtime1.hpp"
#endif #endif
#if INCLUDE_G1GC
#include "gc/g1/g1ThreadLocalData.hpp"
#endif // INCLUDE_G1GC
// Shared stub locations // Shared stub locations
RuntimeStub* SharedRuntime::_wrong_method_blob; RuntimeStub* SharedRuntime::_wrong_method_blob;
@ -208,26 +205,6 @@ void SharedRuntime::print_ic_miss_histogram() {
} }
#endif // PRODUCT #endif // PRODUCT
#if INCLUDE_G1GC
// G1 write-barrier pre: executed before a pointer store.
JRT_LEAF(void, SharedRuntime::g1_wb_pre(oopDesc* orig, JavaThread *thread))
if (orig == NULL) {
assert(false, "should be optimized out");
return;
}
assert(oopDesc::is_oop(orig, true /* ignore mark word */), "Error");
// store the original value that was in the field reference
G1ThreadLocalData::satb_mark_queue(thread).enqueue(orig);
JRT_END
// G1 write-barrier post: executed after a pointer store.
JRT_LEAF(void, SharedRuntime::g1_wb_post(void* card_addr, JavaThread* thread))
G1ThreadLocalData::dirty_card_queue(thread).enqueue(card_addr);
JRT_END
#endif // INCLUDE_G1GC
JRT_LEAF(jlong, SharedRuntime::lmul(jlong y, jlong x)) JRT_LEAF(jlong, SharedRuntime::lmul(jlong y, jlong x))
return x * y; return x * y;

View file

@ -182,12 +182,6 @@ class SharedRuntime: AllStatic {
static address raw_exception_handler_for_return_address(JavaThread* thread, address return_address); static address raw_exception_handler_for_return_address(JavaThread* thread, address return_address);
static address exception_handler_for_return_address(JavaThread* thread, address return_address); static address exception_handler_for_return_address(JavaThread* thread, address return_address);
#if INCLUDE_G1GC
// G1 write barriers
static void g1_wb_pre(oopDesc* orig, JavaThread *thread);
static void g1_wb_post(void* card_addr, JavaThread* thread);
#endif // INCLUDE_G1GC
// exception handling and implicit exceptions // exception handling and implicit exceptions
static address compute_compiled_exc_handler(CompiledMethod* nm, address ret_pc, Handle& exception, static address compute_compiled_exc_handler(CompiledMethod* nm, address ret_pc, Handle& exception,
bool force_unwind, bool top_frame_only, bool& recursive_exception_occurred); bool force_unwind, bool top_frame_only, bool& recursive_exception_occurred);