# HG changeset patch # User rkennke # Date 1528969904 -7200 # Thu Jun 14 11:51:44 2018 +0200 # Node ID 2fad78e5d000e48eb1ca1c349be22856e2ffff0c # Parent 5221db08e2cdabc404c4c3b9f8b369afba6f8094 Move Shenandoah stubs generation into ShenandoahBarrierSetAssembler diff --git a/src/hotspot/cpu/aarch64/gc/shenandoah/shenandoahBarrierSetAssembler_aarch64.cpp b/src/hotspot/cpu/aarch64/gc/shenandoah/shenandoahBarrierSetAssembler_aarch64.cpp --- a/src/hotspot/cpu/aarch64/gc/shenandoah/shenandoahBarrierSetAssembler_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/gc/shenandoah/shenandoahBarrierSetAssembler_aarch64.cpp @@ -40,6 +40,9 @@ #define __ masm-> +address ShenandoahBarrierSetAssembler::_shenandoah_wb = NULL; +address ShenandoahBarrierSetAssembler::_shenandoah_wb_C = NULL; + void ShenandoahBarrierSetAssembler::arraycopy_prologue(MacroAssembler* masm, DecoratorSet decorators, bool is_oop, Register addr, Register count, RegSet saved_regs) { if (is_oop) { @@ -574,3 +577,78 @@ #undef __ #endif // COMPILER1 + +address ShenandoahBarrierSetAssembler::shenandoah_wb() { + return _shenandoah_wb; +} + +address ShenandoahBarrierSetAssembler::shenandoah_wb_C() { + return _shenandoah_wb_C; +} + +#define __ cgen->assembler()-> + +// Shenandoah write barrier. +// +// Input: +// r0: OOP to evacuate. Not null. +// +// Output: +// r0: Pointer to evacuated OOP. +// +// Trash rscratch1, rscratch2. Preserve everything else. +address ShenandoahBarrierSetAssembler::generate_shenandoah_wb(StubCodeGenerator* cgen, bool c_abi, bool do_cset_test) { + + __ align(6); + StubCodeMark mark(cgen, "StubRoutines", "shenandoah_wb"); + address start = __ pc(); + + if (do_cset_test) { + Label work; + __ mov(rscratch2, ShenandoahHeap::in_cset_fast_test_addr()); + __ lsr(rscratch1, r0, ShenandoahHeapRegion::region_size_bytes_shift_jint()); + __ ldrb(rscratch2, Address(rscratch2, rscratch1)); + __ tbnz(rscratch2, 0, work); + __ ret(lr); + __ bind(work); + } + + Register obj = r0; + + __ enter(); // required for proper stackwalking of RuntimeStub frame + + if (!c_abi) { + __ push_call_clobbered_registers(); + } else { + __ push_call_clobbered_fp_registers(); + } + + __ mov(lr, CAST_FROM_FN_PTR(address, ShenandoahRuntime::write_barrier_JRT)); + __ blrt(lr, 1, 0, MacroAssembler::ret_type_integral); + if (!c_abi) { + __ mov(rscratch1, obj); + __ pop_call_clobbered_registers(); + __ mov(obj, rscratch1); + } else { + __ pop_call_clobbered_fp_registers(); + } + + __ leave(); // required for proper stackwalking of RuntimeStub frame + __ ret(lr); + + return start; +} + +#undef __ + +void ShenandoahBarrierSetAssembler::barrier_stubs_init() { + if (ShenandoahWriteBarrier || ShenandoahStoreValEnqueueBarrier) { + int stub_code_size = 2048; + ResourceMark rm; + BufferBlob* bb = BufferBlob::create("shenandoah_barrier_stubs", stub_code_size); + CodeBuffer buf(bb); + StubCodeGenerator cgen(&buf); + _shenandoah_wb = generate_shenandoah_wb(&cgen, false, true); + _shenandoah_wb_C = generate_shenandoah_wb(&cgen, true, !ShenandoahWriteBarrierCsetTestInIR); + } +} diff --git a/src/hotspot/cpu/aarch64/gc/shenandoah/shenandoahBarrierSetAssembler_aarch64.hpp b/src/hotspot/cpu/aarch64/gc/shenandoah/shenandoahBarrierSetAssembler_aarch64.hpp --- a/src/hotspot/cpu/aarch64/gc/shenandoah/shenandoahBarrierSetAssembler_aarch64.hpp +++ b/src/hotspot/cpu/aarch64/gc/shenandoah/shenandoahBarrierSetAssembler_aarch64.hpp @@ -33,6 +33,10 @@ class ShenandoahBarrierSetAssembler: public BarrierSetAssembler { private: + + static address _shenandoah_wb; + static address _shenandoah_wb_C; + void satb_write_barrier_pre(MacroAssembler* masm, Register obj, Register pre_val, @@ -63,7 +67,12 @@ void storeval_barrier(MacroAssembler* masm, Register dst, Register tmp); void asm_acmp_barrier(MacroAssembler* masm, Register op1, Register op2); + address generate_shenandoah_wb(StubCodeGenerator* cgen, bool c_abi, bool do_cset_test); + public: + static address shenandoah_wb(); + static address shenandoah_wb_C(); + #ifdef COMPILER1 void gen_pre_barrier_stub(LIR_Assembler* ce, ShenandoahPreBarrierStub* stub); void generate_c1_pre_barrier_runtime_stub(StubAssembler* sasm); @@ -85,6 +94,8 @@ bool acquire, bool release, bool weak, bool encode, Register tmp1, Register tmp2, Register tmp3, Register result); + + virtual void barrier_stubs_init(); }; #endif // CPU_AARCH64_GC_SHENANDOAH_SHENANDOAHBARRIERSETASSEMBLER_AARCH64_HPP diff --git a/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp b/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp --- a/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp @@ -37,6 +37,7 @@ #include "compiler/disassembler.hpp" #include "gc/shared/collectedHeap.hpp" #include "gc/shenandoah/brooksPointer.hpp" +#include "gc/shenandoah/shenandoahBarrierSetAssembler.hpp" #include "gc/shenandoah/shenandoahHeap.hpp" #include "gc/shenandoah/shenandoahHeap.inline.hpp" #include "gc/shenandoah/shenandoahHeapRegion.hpp" @@ -4095,8 +4096,8 @@ mov(r0, dst); } - assert(StubRoutines::aarch64::shenandoah_wb() != NULL, "need write barrier stub"); - far_call(RuntimeAddress(CAST_FROM_FN_PTR(address, StubRoutines::aarch64::shenandoah_wb()))); + assert(ShenandoahBarrierSetAssembler::shenandoah_wb() != NULL, "need write barrier stub"); + far_call(RuntimeAddress(CAST_FROM_FN_PTR(address, ShenandoahBarrierSetAssembler::shenandoah_wb()))); if (dst != r0) { mov(dst, r0); diff --git a/src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp b/src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp --- a/src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp @@ -42,16 +42,9 @@ #include "runtime/stubRoutines.hpp" #include "runtime/thread.inline.hpp" #include "utilities/align.hpp" -#include "utilities/macros.hpp" #ifdef COMPILER2 #include "opto/runtime.hpp" #endif -#if INCLUDE_SHENANDOAHGC -#include "gc/shenandoah/brooksPointer.hpp" -#include "gc/shenandoah/shenandoahHeap.hpp" -#include "gc/shenandoah/shenandoahHeapRegion.hpp" -#include "gc/shenandoah/shenandoahRuntime.hpp" -#endif #ifdef BUILTIN_SIM #include "../../../../../../simulator/simulator.hpp" @@ -553,60 +546,6 @@ return start; } -#if INCLUDE_SHENANDOAHGC - // Shenandoah write barrier. - // - // Input: - // r0: OOP to evacuate. Not null. - // - // Output: - // r0: Pointer to evacuated OOP. - // - // Trash rscratch1, rscratch2. Preserve everything else. - - address generate_shenandoah_wb(bool c_abi, bool do_cset_test) { - StubCodeMark mark(this, "StubRoutines", "shenandoah_wb"); - - __ align(6); - address start = __ pc(); - - if (do_cset_test) { - Label work; - __ mov(rscratch2, ShenandoahHeap::in_cset_fast_test_addr()); - __ lsr(rscratch1, r0, ShenandoahHeapRegion::region_size_bytes_shift_jint()); - __ ldrb(rscratch2, Address(rscratch2, rscratch1)); - __ tbnz(rscratch2, 0, work); - __ ret(lr); - __ bind(work); - } - - Register obj = r0; - - __ enter(); // required for proper stackwalking of RuntimeStub frame - - if (!c_abi) { - __ push_call_clobbered_registers(); - } else { - __ push_call_clobbered_fp_registers(); - } - - __ mov(lr, CAST_FROM_FN_PTR(address, ShenandoahRuntime::write_barrier_JRT)); - __ blrt(lr, 1, 0, MacroAssembler::ret_type_integral); - if (!c_abi) { - __ mov(rscratch1, obj); - __ pop_call_clobbered_registers(); - __ mov(obj, rscratch1); - } else { - __ pop_call_clobbered_fp_registers(); - } - - __ leave(); // required for proper stackwalking of RuntimeStub frame - __ ret(lr); - - return start; - } -#endif - // Non-destructive plausibility checks for oops // // Arguments: @@ -5165,13 +5104,6 @@ StubRoutines::_montgomerySquare = g.generate_multiply(); } -#if INCLUDE_SHENANDOAHGC - if (UseShenandoahGC && (ShenandoahWriteBarrier || ShenandoahStoreValEnqueueBarrier)) { - StubRoutines::aarch64::_shenandoah_wb = generate_shenandoah_wb(false, true); - StubRoutines::_shenandoah_wb_C = generate_shenandoah_wb(true, !ShenandoahWriteBarrierCsetTestInIR); - } -#endif - #ifndef BUILTIN_SIM // generate GHASH intrinsics code if (UseGHASHIntrinsics) { diff --git a/src/hotspot/cpu/aarch64/stubRoutines_aarch64.cpp b/src/hotspot/cpu/aarch64/stubRoutines_aarch64.cpp --- a/src/hotspot/cpu/aarch64/stubRoutines_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/stubRoutines_aarch64.cpp @@ -33,7 +33,6 @@ // Implementation of the platform-specific part of StubRoutines - for // a description of how to extend it, see the stubRoutines.hpp file. -address StubRoutines::aarch64::_shenandoah_wb = NULL; address StubRoutines::aarch64::_get_previous_fp_entry = NULL; address StubRoutines::aarch64::_get_previous_sp_entry = NULL; diff --git a/src/hotspot/cpu/aarch64/stubRoutines_aarch64.hpp b/src/hotspot/cpu/aarch64/stubRoutines_aarch64.hpp --- a/src/hotspot/cpu/aarch64/stubRoutines_aarch64.hpp +++ b/src/hotspot/cpu/aarch64/stubRoutines_aarch64.hpp @@ -41,15 +41,13 @@ enum platform_dependent_constants { code_size1 = 19000, // simply increase if too small (assembler will crash if too small) - code_size2 = 23000 // simply increase if too small (assembler will crash if too small) + code_size2 = 22000 // simply increase if too small (assembler will crash if too small) }; class aarch64 { friend class StubGenerator; private: - static address _shenandoah_wb; - static address _get_previous_fp_entry; static address _get_previous_sp_entry; @@ -122,11 +120,6 @@ return _double_sign_flip; } - static address shenandoah_wb() - { - return _shenandoah_wb; - } - static address zero_blocks() { return _zero_blocks; } diff --git a/src/hotspot/cpu/x86/gc/shenandoah/shenandoahBarrierSetAssembler_x86.cpp b/src/hotspot/cpu/x86/gc/shenandoah/shenandoahBarrierSetAssembler_x86.cpp --- a/src/hotspot/cpu/x86/gc/shenandoah/shenandoahBarrierSetAssembler_x86.cpp +++ b/src/hotspot/cpu/x86/gc/shenandoah/shenandoahBarrierSetAssembler_x86.cpp @@ -41,6 +41,9 @@ #define __ masm-> +address ShenandoahBarrierSetAssembler::_shenandoah_wb = NULL; +address ShenandoahBarrierSetAssembler::_shenandoah_wb_C = NULL; + void ShenandoahBarrierSetAssembler::arraycopy_prologue(MacroAssembler* masm, DecoratorSet decorators, BasicType type, Register src, Register dst, Register count) { @@ -838,3 +841,116 @@ #endif // COMPILER1 +address ShenandoahBarrierSetAssembler::shenandoah_wb() { + return _shenandoah_wb; +} + +address ShenandoahBarrierSetAssembler::shenandoah_wb_C() { + return _shenandoah_wb_C; +} + +#define __ cgen->assembler()-> + +address ShenandoahBarrierSetAssembler::generate_shenandoah_wb(StubCodeGenerator* cgen, bool c_abi, bool do_cset_test) { + __ align(CodeEntryAlignment); + StubCodeMark mark(cgen, "StubRoutines", "shenandoah_wb"); + address start = __ pc(); + + Label not_done; + + // We use RDI, which also serves as argument register for slow call. + // RAX always holds the src object ptr, except after the slow call and + // the cmpxchg, then it holds the result. + // R8 and RCX are used as temporary registers. + if (!c_abi) { + __ push(rdi); + __ push(r8); + } + + // Check for object beeing in the collection set. + // TODO: Can we use only 1 register here? + // The source object arrives here in rax. + // live: rax + // live: rdi + if (!c_abi) { + __ mov(rdi, rax); + } else { + if (rax != c_rarg0) { + __ mov(rax, c_rarg0); + } + } + if (do_cset_test) { + __ shrptr(rdi, ShenandoahHeapRegion::region_size_bytes_shift_jint()); + // live: r8 + __ movptr(r8, (intptr_t) ShenandoahHeap::in_cset_fast_test_addr()); + __ movbool(r8, Address(r8, rdi, Address::times_1)); + // unlive: rdi + __ testbool(r8); + // unlive: r8 + __ jccb(Assembler::notZero, not_done); + + if (!c_abi) { + __ pop(r8); + __ pop(rdi); + } + __ ret(0); + + __ bind(not_done); + } + + if (!c_abi) { + __ push(rcx); + } + + if (!c_abi) { + __ push(rdx); + __ push(rdi); + __ push(rsi); + __ push(r8); + __ push(r9); + __ push(r10); + __ push(r11); + __ push(r12); + __ push(r13); + __ push(r14); + __ push(r15); + } + __ save_vector_registers(); + __ movptr(rdi, rax); + __ call_VM_leaf(CAST_FROM_FN_PTR(address, ShenandoahRuntime::write_barrier_JRT), rdi); + __ restore_vector_registers(); + if (!c_abi) { + __ pop(r15); + __ pop(r14); + __ pop(r13); + __ pop(r12); + __ pop(r11); + __ pop(r10); + __ pop(r9); + __ pop(r8); + __ pop(rsi); + __ pop(rdi); + __ pop(rdx); + + __ pop(rcx); + __ pop(r8); + __ pop(rdi); + } + __ ret(0); + + return start; +} + +#undef __ + +void ShenandoahBarrierSetAssembler::barrier_stubs_init() { + if (ShenandoahWriteBarrier || ShenandoahStoreValEnqueueBarrier) { + int stub_code_size = 1536; + ResourceMark rm; + BufferBlob* bb = BufferBlob::create("shenandoah_barrier_stubs", stub_code_size); + CodeBuffer buf(bb); + StubCodeGenerator cgen(&buf); + _shenandoah_wb = generate_shenandoah_wb(&cgen, false, true); + _shenandoah_wb_C = generate_shenandoah_wb(&cgen, true, !ShenandoahWriteBarrierCsetTestInIR); + } +} diff --git a/src/hotspot/cpu/x86/gc/shenandoah/shenandoahBarrierSetAssembler_x86.hpp b/src/hotspot/cpu/x86/gc/shenandoah/shenandoahBarrierSetAssembler_x86.hpp --- a/src/hotspot/cpu/x86/gc/shenandoah/shenandoahBarrierSetAssembler_x86.hpp +++ b/src/hotspot/cpu/x86/gc/shenandoah/shenandoahBarrierSetAssembler_x86.hpp @@ -33,6 +33,10 @@ class ShenandoahBarrierSetAssembler: public BarrierSetAssembler { private: + + static address _shenandoah_wb; + static address _shenandoah_wb_C; + void satb_write_barrier_pre(MacroAssembler* masm, Register obj, Register pre_val, @@ -67,7 +71,13 @@ void storeval_barrier(MacroAssembler* masm, Register dst, Register tmp); void storeval_barrier_impl(MacroAssembler* masm, Register dst, Register tmp); + address generate_shenandoah_wb(StubCodeGenerator* cgen, bool c_abi, bool do_cset_test); + public: + static address shenandoah_wb(); + static address shenandoah_wb_C(); + + #ifdef COMPILER1 void gen_pre_barrier_stub(LIR_Assembler* ce, ShenandoahPreBarrierStub* stub); void generate_c1_pre_barrier_runtime_stub(StubAssembler* sasm); @@ -94,6 +104,8 @@ virtual void resolve_for_read(MacroAssembler* masm, DecoratorSet decorators, Register obj); virtual void resolve_for_write(MacroAssembler* masm, DecoratorSet decorators, Register obj); + virtual void barrier_stubs_init(); + }; #endif // CPU_X86_GC_SHENANDOAH_SHENANDOAHBARRIERSETASSEMBLER_X86_HPP diff --git a/src/hotspot/cpu/x86/macroAssembler_x86.cpp b/src/hotspot/cpu/x86/macroAssembler_x86.cpp --- a/src/hotspot/cpu/x86/macroAssembler_x86.cpp +++ b/src/hotspot/cpu/x86/macroAssembler_x86.cpp @@ -5313,8 +5313,8 @@ xchgptr(dst, rax); // Move obj into rax and save rax into obj. } - assert(StubRoutines::x86::shenandoah_wb() != NULL, "need write barrier stub"); - call(RuntimeAddress(CAST_FROM_FN_PTR(address, StubRoutines::x86::shenandoah_wb()))); + assert(ShenandoahBarrierSetAssembler::shenandoah_wb() != NULL, "need write barrier stub"); + call(RuntimeAddress(CAST_FROM_FN_PTR(address, ShenandoahBarrierSetAssembler::shenandoah_wb()))); if (dst != rax) { xchgptr(rax, dst); // Swap back obj with rax. diff --git a/src/hotspot/cpu/x86/stubGenerator_x86_64.cpp b/src/hotspot/cpu/x86/stubGenerator_x86_64.cpp --- a/src/hotspot/cpu/x86/stubGenerator_x86_64.cpp +++ b/src/hotspot/cpu/x86/stubGenerator_x86_64.cpp @@ -41,16 +41,9 @@ #include "runtime/stubCodeGenerator.hpp" #include "runtime/stubRoutines.hpp" #include "runtime/thread.inline.hpp" -#include "utilities/macros.hpp" #ifdef COMPILER2 #include "opto/runtime.hpp" #endif -#if INCLUDE_SHENANDOAHGC -#include "gc/shenandoah/brooksPointer.hpp" -#include "gc/shenandoah/shenandoahHeap.hpp" -#include "gc/shenandoah/shenandoahHeapRegion.hpp" -#include "gc/shenandoah/shenandoahRuntime.hpp" -#endif #if INCLUDE_ZGC #include "gc/z/zThreadLocalData.hpp" #endif @@ -808,97 +801,6 @@ return start; } -#if INCLUDE_SHENANDOAHGC - address generate_shenandoah_wb(bool c_abi, bool do_cset_test) { - StubCodeMark mark(this, "StubRoutines", "shenandoah_wb"); - address start = __ pc(); - - Label not_done; - - // We use RDI, which also serves as argument register for slow call. - // RAX always holds the src object ptr, except after the slow call and - // the cmpxchg, then it holds the result. - // R8 and RCX are used as temporary registers. - if (!c_abi) { - __ push(rdi); - __ push(r8); - } - - // Check for object beeing in the collection set. - // TODO: Can we use only 1 register here? - // The source object arrives here in rax. - // live: rax - // live: rdi - if (!c_abi) { - __ mov(rdi, rax); - } else { - if (rax != c_rarg0) { - __ mov(rax, c_rarg0); - } - } - if (do_cset_test) { - __ shrptr(rdi, ShenandoahHeapRegion::region_size_bytes_shift_jint()); - // live: r8 - __ movptr(r8, (intptr_t) ShenandoahHeap::in_cset_fast_test_addr()); - __ movbool(r8, Address(r8, rdi, Address::times_1)); - // unlive: rdi - __ testbool(r8); - // unlive: r8 - __ jccb(Assembler::notZero, not_done); - - if (!c_abi) { - __ pop(r8); - __ pop(rdi); - } - __ ret(0); - - __ bind(not_done); - } - - if (!c_abi) { - __ push(rcx); - } - - if (!c_abi) { - __ push(rdx); - __ push(rdi); - __ push(rsi); - __ push(r8); - __ push(r9); - __ push(r10); - __ push(r11); - __ push(r12); - __ push(r13); - __ push(r14); - __ push(r15); - } - __ save_vector_registers(); - __ movptr(rdi, rax); - __ call_VM_leaf(CAST_FROM_FN_PTR(address, ShenandoahRuntime::write_barrier_JRT), rdi); - __ restore_vector_registers(); - if (!c_abi) { - __ pop(r15); - __ pop(r14); - __ pop(r13); - __ pop(r12); - __ pop(r11); - __ pop(r10); - __ pop(r9); - __ pop(r8); - __ pop(rsi); - __ pop(rdi); - __ pop(rdx); - - __ pop(rcx); - __ pop(r8); - __ pop(rdi); - } - __ ret(0); - - return start; - } -#endif - address generate_f2i_fixup() { StubCodeMark mark(this, "StubRoutines", "f2i_fixup"); Address inout(rsp, 5 * wordSize); // return address + 4 saves @@ -5154,13 +5056,6 @@ throw_NullPointerException_at_call)); // entry points that are platform specific -#if INCLUDE_SHENANDOAHGC - if (UseShenandoahGC && (ShenandoahWriteBarrier || ShenandoahStoreValEnqueueBarrier)) { - StubRoutines::x86::_shenandoah_wb = generate_shenandoah_wb(false, true); - StubRoutines::_shenandoah_wb_C = generate_shenandoah_wb(true, !ShenandoahWriteBarrierCsetTestInIR); - } -#endif - StubRoutines::x86::_f2i_fixup = generate_f2i_fixup(); StubRoutines::x86::_f2l_fixup = generate_f2l_fixup(); StubRoutines::x86::_d2i_fixup = generate_d2i_fixup(); diff --git a/src/hotspot/cpu/x86/stubRoutines_x86.hpp b/src/hotspot/cpu/x86/stubRoutines_x86.hpp --- a/src/hotspot/cpu/x86/stubRoutines_x86.hpp +++ b/src/hotspot/cpu/x86/stubRoutines_x86.hpp @@ -33,7 +33,7 @@ enum platform_dependent_constants { code_size1 = 20000 LP64_ONLY(+10000), // simply increase if too small (assembler will crash if too small) - code_size2 = 33800 LP64_ONLY(+10000) // simply increase if too small (assembler will crash if too small) + code_size2 = 33800 LP64_ONLY(+10000) // simply increase if too small (assembler will crash if too small) }; class x86 { @@ -44,7 +44,6 @@ private: static address _get_previous_fp_entry; static address _get_previous_sp_entry; - static address _shenandoah_wb; static address _f2i_fixup; static address _f2l_fixup; @@ -66,11 +65,6 @@ return _get_previous_sp_entry; } - static address shenandoah_wb() - { - return _shenandoah_wb; - } - static address f2i_fixup() { return _f2i_fixup; } diff --git a/src/hotspot/cpu/x86/stubRoutines_x86_64.cpp b/src/hotspot/cpu/x86/stubRoutines_x86_64.cpp --- a/src/hotspot/cpu/x86/stubRoutines_x86_64.cpp +++ b/src/hotspot/cpu/x86/stubRoutines_x86_64.cpp @@ -34,7 +34,6 @@ address StubRoutines::x86::_get_previous_fp_entry = NULL; address StubRoutines::x86::_get_previous_sp_entry = NULL; -address StubRoutines::x86::_shenandoah_wb = NULL; address StubRoutines::x86::_f2i_fixup = NULL; address StubRoutines::x86::_f2l_fixup = NULL; address StubRoutines::x86::_d2i_fixup = NULL; diff --git a/src/hotspot/share/gc/shenandoah/c2/shenandoahSupport.cpp b/src/hotspot/share/gc/shenandoah/c2/shenandoahSupport.cpp --- a/src/hotspot/share/gc/shenandoah/c2/shenandoahSupport.cpp +++ b/src/hotspot/share/gc/shenandoah/c2/shenandoahSupport.cpp @@ -33,6 +33,7 @@ #include "opto/phaseX.hpp" #include "opto/rootnode.hpp" #include "opto/runtime.hpp" +#include "gc/shenandoah/shenandoahBarrierSetAssembler.hpp" #include "gc/shenandoah/c2/shenandoahSupport.hpp" #include "gc/shenandoah/c2/shenandoahBarrierSetC2.hpp" #include "opto/subnode.hpp" @@ -2532,12 +2533,12 @@ } else { if (n->is_Proj()) { if (n->in(0)->Opcode() == Op_CallLeafNoFP) { - if (n->in(0)->as_Call()->entry_point() != StubRoutines::shenandoah_wb_C()) { + if (n->in(0)->as_Call()->entry_point() != ShenandoahBarrierSetAssembler::shenandoah_wb_C()) { const_oop = NULL; break; } } else if (n->in(0)->is_MachCallLeaf()) { - if (n->in(0)->as_MachCall()->entry_point() != StubRoutines::shenandoah_wb_C()) { + if (n->in(0)->as_MachCall()->entry_point() != ShenandoahBarrierSetAssembler::shenandoah_wb_C()) { const_oop = NULL; break; } @@ -3976,7 +3977,7 @@ mm->set_memory_at(Compile::AliasIdxRaw, raw_mem); phase->register_new_node(mm, c); - Node* call = new CallLeafNoFPNode(ShenandoahBarrierSetC2::shenandoah_write_barrier_Type(), StubRoutines::shenandoah_wb_C(), "shenandoah_write_barrier", TypeRawPtr::BOTTOM); + Node* call = new CallLeafNoFPNode(ShenandoahBarrierSetC2::shenandoah_write_barrier_Type(), ShenandoahBarrierSetAssembler::shenandoah_wb_C(), "shenandoah_write_barrier", TypeRawPtr::BOTTOM); call->init_req(TypeFunc::Control, c); call->init_req(TypeFunc::I_O, phase->C->top()); call->init_req(TypeFunc::Memory, mm); @@ -4390,7 +4391,7 @@ nodes.push(root); for (uint next = 0; next < nodes.size(); next++) { Node *n = nodes.at(next); - if (n->Opcode() == Op_CallLeafNoFP && n->as_Call()->_entry_point == StubRoutines::shenandoah_wb_C()) { + if (n->Opcode() == Op_CallLeafNoFP && n->as_Call()->_entry_point == ShenandoahBarrierSetAssembler::shenandoah_wb_C()) { controls.push(n); if (trace) { tty->print("XXXXXX verifying"); n->dump(); } for (uint next2 = 0; next2 < controls.size(); next2++) { diff --git a/src/hotspot/share/opto/lcm.cpp b/src/hotspot/share/opto/lcm.cpp --- a/src/hotspot/share/opto/lcm.cpp +++ b/src/hotspot/share/opto/lcm.cpp @@ -34,6 +34,9 @@ #include "opto/runtime.hpp" #include "opto/chaitin.hpp" #include "runtime/sharedRuntime.hpp" +#if INCLUDE_SHENANDOAHGC +#include "gc/shenandoah/shenandoahBarrierSetAssembler.hpp" +#endif // Optimization - Graph Style @@ -893,12 +896,13 @@ proj->_rout.OR(Matcher::method_handle_invoke_SP_save_mask()); } - if (UseShenandoahGC && mcall->entry_point() == StubRoutines::shenandoah_wb_C()) { +#if INCLUDE_SHENANDOAHGC + if (UseShenandoahGC && mcall->entry_point() == ShenandoahBarrierSetAssembler::shenandoah_wb_C()) { assert(op == Op_CallLeafNoFP, "shenandoah_wb_C should be called with Op_CallLeafNoFP"); add_call_kills(proj, regs, save_policy, exclude_soe, true); - } else { + } else +#endif add_call_kills(proj, regs, save_policy, exclude_soe, false); - } return node_cnt; } diff --git a/src/hotspot/share/runtime/stubRoutines.cpp b/src/hotspot/share/runtime/stubRoutines.cpp --- a/src/hotspot/share/runtime/stubRoutines.cpp +++ b/src/hotspot/share/runtime/stubRoutines.cpp @@ -174,8 +174,6 @@ address StubRoutines::_safefetchN_fault_pc = NULL; address StubRoutines::_safefetchN_continuation_pc = NULL; -address StubRoutines::_shenandoah_wb_C = NULL; - // Initialization // // Note: to break cycle with universe initialization, stubs are generated in two phases. diff --git a/src/hotspot/share/runtime/stubRoutines.hpp b/src/hotspot/share/runtime/stubRoutines.hpp --- a/src/hotspot/share/runtime/stubRoutines.hpp +++ b/src/hotspot/share/runtime/stubRoutines.hpp @@ -226,8 +226,6 @@ static address _safefetchN_fault_pc; static address _safefetchN_continuation_pc; - static address _shenandoah_wb_C; - public: // Initialization/Testing static void initialize1(); // must happen before universe::genesis @@ -453,11 +451,6 @@ static void arrayof_jlong_copy (HeapWord* src, HeapWord* dest, size_t count); static void arrayof_oop_copy (HeapWord* src, HeapWord* dest, size_t count); static void arrayof_oop_copy_uninit(HeapWord* src, HeapWord* dest, size_t count); - - static address shenandoah_wb_C() - { - return _shenandoah_wb_C; - } }; // Safefetch allows to load a value from a location that's not known # HG changeset patch # User rkennke # Date 1528987289 -7200 # Thu Jun 14 16:41:29 2018 +0200 # Node ID 42144a98c28221aecfff64eae55394a6ab0d17df # Parent 2fad78e5d000e48eb1ca1c349be22856e2ffff0c [mq]: stubgen-v2.patch diff --git a/src/hotspot/cpu/aarch64/gc/shenandoah/shenandoahBarrierSetAssembler_aarch64.cpp b/src/hotspot/cpu/aarch64/gc/shenandoah/shenandoahBarrierSetAssembler_aarch64.cpp --- a/src/hotspot/cpu/aarch64/gc/shenandoah/shenandoahBarrierSetAssembler_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/gc/shenandoah/shenandoahBarrierSetAssembler_aarch64.cpp @@ -25,6 +25,7 @@ #include "gc/shenandoah/brooksPointer.hpp" #include "gc/shenandoah/shenandoahBarrierSetAssembler.hpp" #include "gc/shenandoah/shenandoahConnectionMatrix.hpp" +#include "gc/shenandoah/shenandoahHeap.hpp" #include "gc/shenandoah/shenandoahHeapRegion.hpp" #include "gc/shenandoah/shenandoahRuntime.hpp" #include "gc/shenandoah/shenandoahThreadLocalData.hpp" @@ -579,10 +580,12 @@ #endif // COMPILER1 address ShenandoahBarrierSetAssembler::shenandoah_wb() { + assert(_shenandoah_wb != NULL || !(ShenandoahWriteBarrier || ShenandoahStoreValEnqueueBarrier), "need write barrier stub"); return _shenandoah_wb; } address ShenandoahBarrierSetAssembler::shenandoah_wb_C() { + assert(_shenandoah_wb_C != NULL || !(ShenandoahWriteBarrier || ShenandoahStoreValEnqueueBarrier), "need write barrier stub"); return _shenandoah_wb_C; } diff --git a/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp b/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp --- a/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp @@ -4096,7 +4096,6 @@ mov(r0, dst); } - assert(ShenandoahBarrierSetAssembler::shenandoah_wb() != NULL, "need write barrier stub"); far_call(RuntimeAddress(CAST_FROM_FN_PTR(address, ShenandoahBarrierSetAssembler::shenandoah_wb()))); if (dst != r0) { diff --git a/src/hotspot/cpu/x86/gc/shenandoah/shenandoahBarrierSetAssembler_x86.cpp b/src/hotspot/cpu/x86/gc/shenandoah/shenandoahBarrierSetAssembler_x86.cpp --- a/src/hotspot/cpu/x86/gc/shenandoah/shenandoahBarrierSetAssembler_x86.cpp +++ b/src/hotspot/cpu/x86/gc/shenandoah/shenandoahBarrierSetAssembler_x86.cpp @@ -25,6 +25,7 @@ #include "gc/shenandoah/brooksPointer.hpp" #include "gc/shenandoah/shenandoahBarrierSetAssembler.hpp" #include "gc/shenandoah/shenandoahConnectionMatrix.hpp" +#include "gc/shenandoah/shenandoahHeap.hpp" #include "gc/shenandoah/shenandoahHeapRegion.hpp" #include "gc/shenandoah/shenandoahRuntime.hpp" #include "gc/shenandoah/shenandoahThreadLocalData.hpp" @@ -842,10 +843,12 @@ #endif // COMPILER1 address ShenandoahBarrierSetAssembler::shenandoah_wb() { + assert(_shenandoah_wb != NULL, "need write barrier stub"); return _shenandoah_wb; } address ShenandoahBarrierSetAssembler::shenandoah_wb_C() { + assert(_shenandoah_wb_C != NULL, "need write barrier stub"); return _shenandoah_wb_C; } diff --git a/src/hotspot/cpu/x86/macroAssembler_x86.cpp b/src/hotspot/cpu/x86/macroAssembler_x86.cpp --- a/src/hotspot/cpu/x86/macroAssembler_x86.cpp +++ b/src/hotspot/cpu/x86/macroAssembler_x86.cpp @@ -5313,7 +5313,6 @@ xchgptr(dst, rax); // Move obj into rax and save rax into obj. } - assert(ShenandoahBarrierSetAssembler::shenandoah_wb() != NULL, "need write barrier stub"); call(RuntimeAddress(CAST_FROM_FN_PTR(address, ShenandoahBarrierSetAssembler::shenandoah_wb()))); if (dst != rax) { diff --git a/src/hotspot/share/gc/shenandoah/c2/shenandoahSupport.cpp b/src/hotspot/share/gc/shenandoah/c2/shenandoahSupport.cpp --- a/src/hotspot/share/gc/shenandoah/c2/shenandoahSupport.cpp +++ b/src/hotspot/share/gc/shenandoah/c2/shenandoahSupport.cpp @@ -2533,12 +2533,14 @@ } else { if (n->is_Proj()) { if (n->in(0)->Opcode() == Op_CallLeafNoFP) { - if (n->in(0)->as_Call()->entry_point() != ShenandoahBarrierSetAssembler::shenandoah_wb_C()) { + if (!(ShenandoahWriteBarrier || ShenandoahStoreValEnqueueBarrier) || + n->in(0)->as_Call()->entry_point() != ShenandoahBarrierSetAssembler::shenandoah_wb_C()) { const_oop = NULL; break; } } else if (n->in(0)->is_MachCallLeaf()) { - if (n->in(0)->as_MachCall()->entry_point() != ShenandoahBarrierSetAssembler::shenandoah_wb_C()) { + if (!(ShenandoahWriteBarrier || ShenandoahStoreValEnqueueBarrier) || + n->in(0)->as_MachCall()->entry_point() != ShenandoahBarrierSetAssembler::shenandoah_wb_C()) { const_oop = NULL; break; } @@ -4391,7 +4393,9 @@ nodes.push(root); for (uint next = 0; next < nodes.size(); next++) { Node *n = nodes.at(next); - if (n->Opcode() == Op_CallLeafNoFP && n->as_Call()->_entry_point == ShenandoahBarrierSetAssembler::shenandoah_wb_C()) { + if (n->Opcode() == Op_CallLeafNoFP && + (ShenandoahWriteBarrier || ShenandoahStoreValEnqueueBarrier) && + n->as_Call()->_entry_point == ShenandoahBarrierSetAssembler::shenandoah_wb_C()) { controls.push(n); if (trace) { tty->print("XXXXXX verifying"); n->dump(); } for (uint next2 = 0; next2 < controls.size(); next2++) { diff --git a/src/hotspot/share/opto/lcm.cpp b/src/hotspot/share/opto/lcm.cpp --- a/src/hotspot/share/opto/lcm.cpp +++ b/src/hotspot/share/opto/lcm.cpp @@ -34,6 +34,7 @@ #include "opto/runtime.hpp" #include "opto/chaitin.hpp" #include "runtime/sharedRuntime.hpp" +#include "utilities/macros.hpp" #if INCLUDE_SHENANDOAHGC #include "gc/shenandoah/shenandoahBarrierSetAssembler.hpp" #endif @@ -897,13 +898,14 @@ } #if INCLUDE_SHENANDOAHGC - if (UseShenandoahGC && mcall->entry_point() == ShenandoahBarrierSetAssembler::shenandoah_wb_C()) { + if (UseShenandoahGC && (ShenandoahWriteBarrier || ShenandoahStoreValEnqueueBarrier) && mcall->entry_point() == ShenandoahBarrierSetAssembler::shenandoah_wb_C()) { assert(op == Op_CallLeafNoFP, "shenandoah_wb_C should be called with Op_CallLeafNoFP"); add_call_kills(proj, regs, save_policy, exclude_soe, true); } else #endif + { add_call_kills(proj, regs, save_policy, exclude_soe, false); - + } return node_cnt; }