# HG changeset patch # Parent 88e728841ec71ebc49a7187162a18ec5f5593271 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 @@ -41,7 +41,6 @@ #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) { @@ -616,11 +615,6 @@ return _shenandoah_wb; } -address ShenandoahBarrierSetAssembler::shenandoah_wb_C() { - assert(_shenandoah_wb_C != NULL, "need write barrier stub"); - return _shenandoah_wb_C; -} - #define __ cgen->assembler()-> // Shenandoah write barrier. @@ -632,41 +626,31 @@ // 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) { +address ShenandoahBarrierSetAssembler::generate_shenandoah_wb(StubCodeGenerator* cgen) { __ 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); - } + 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(); - } + __ push_call_clobbered_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(); - } + __ mov(rscratch1, obj); + __ pop_call_clobbered_registers(); + __ mov(obj, rscratch1); __ leave(); // required for proper stackwalking of RuntimeStub frame __ ret(lr); @@ -683,7 +667,6 @@ 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, false); + _shenandoah_wb = generate_shenandoah_wb(&cgen); } } 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 @@ -38,7 +38,6 @@ private: static address _shenandoah_wb; - static address _shenandoah_wb_C; void satb_write_barrier_pre(MacroAssembler* masm, Register obj, @@ -63,13 +62,10 @@ void write_barrier_impl(MacroAssembler* masm, Register dst); void asm_acmp_barrier(MacroAssembler* masm, Register op1, Register op2); - address generate_shenandoah_wb(StubCodeGenerator* cgen, bool c_abi, bool do_cset_test); + address generate_shenandoah_wb(StubCodeGenerator* cgen); public: static address shenandoah_wb(); - static address shenandoah_wb_C(); - - static bool is_shenandoah_wb_C_call(address call); void storeval_barrier(MacroAssembler* masm, Register dst, Register tmp); 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 @@ -42,7 +42,6 @@ #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) { @@ -923,14 +922,9 @@ return _shenandoah_wb; } -address ShenandoahBarrierSetAssembler::shenandoah_wb_C() { - assert(_shenandoah_wb_C != NULL, "need write barrier stub"); - return _shenandoah_wb_C; -} - #define __ cgen->assembler()-> -address ShenandoahBarrierSetAssembler::generate_shenandoah_wb(StubCodeGenerator* cgen, bool c_abi, bool do_cset_test) { +address ShenandoahBarrierSetAssembler::generate_shenandoah_wb(StubCodeGenerator* cgen) { __ align(CodeEntryAlignment); StubCodeMark mark(cgen, "StubRoutines", "shenandoah_wb"); address start = __ pc(); @@ -942,80 +936,61 @@ // 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); - } + __ 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); + __ mov(rdi, rax); + __ 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); + + __ pop(r8); + __ pop(rdi); + __ ret(0); - if (!c_abi) { - __ pop(r8); - __ pop(rdi); - } - __ ret(0); - - __ bind(not_done); - } - - if (!c_abi) { - __ push(rcx); - } + __ bind(not_done); - 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); - } + __ push(rcx); + __ 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(cgen->assembler()); __ movptr(rdi, rax); __ call_VM_leaf(CAST_FROM_FN_PTR(address, ShenandoahRuntime::write_barrier_JRT), rdi); restore_vector_registers(cgen->assembler()); - 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(r15); + __ pop(r14); + __ pop(r13); + __ pop(r12); + __ pop(r11); + __ pop(r10); + __ pop(r9); + __ pop(r8); + __ pop(rsi); + __ pop(rdi); + __ pop(rdx); + __ pop(rcx); - __ pop(rcx); - __ pop(r8); - __ pop(rdi); - } + __ pop(r8); + __ pop(rdi); __ ret(0); #else ShouldNotReachHere(); @@ -1032,7 +1007,6 @@ 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, false); + _shenandoah_wb = generate_shenandoah_wb(&cgen); } } 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 @@ -38,7 +38,6 @@ private: static address _shenandoah_wb; - static address _shenandoah_wb_C; void satb_write_barrier_pre(MacroAssembler* masm, Register obj, @@ -67,16 +66,13 @@ void storeval_barrier_impl(MacroAssembler* masm, Register dst, Register tmp); - address generate_shenandoah_wb(StubCodeGenerator* cgen, bool c_abi, bool do_cset_test); + address generate_shenandoah_wb(StubCodeGenerator* cgen); void save_vector_registers(MacroAssembler* masm); void restore_vector_registers(MacroAssembler* masm); public: static address shenandoah_wb(); - static address shenandoah_wb_C(); - - static bool is_shenandoah_wb_C_call(address call); void storeval_barrier(MacroAssembler* masm, Register dst, Register tmp); #ifdef COMPILER1 diff --git a/src/hotspot/share/gc/shenandoah/c2/shenandoahBarrierSetC2.cpp b/src/hotspot/share/gc/shenandoah/c2/shenandoahBarrierSetC2.cpp --- a/src/hotspot/share/gc/shenandoah/c2/shenandoahBarrierSetC2.cpp +++ b/src/hotspot/share/gc/shenandoah/c2/shenandoahBarrierSetC2.cpp @@ -354,6 +354,11 @@ call->as_CallLeaf()->entry_point() == CAST_FROM_FN_PTR(address, ShenandoahRuntime::write_ref_field_pre_entry); } +bool ShenandoahBarrierSetC2::is_shenandoah_wb_call(Node* call) { + return call->is_CallLeaf() && + call->as_CallLeaf()->entry_point() == CAST_FROM_FN_PTR(address, ShenandoahRuntime::write_barrier_JRT); +} + bool ShenandoahBarrierSetC2::is_shenandoah_marking_if(PhaseTransform *phase, Node* n) { if (n->Opcode() != Op_If) { return false; diff --git a/src/hotspot/share/gc/shenandoah/c2/shenandoahBarrierSetC2.hpp b/src/hotspot/share/gc/shenandoah/c2/shenandoahBarrierSetC2.hpp --- a/src/hotspot/share/gc/shenandoah/c2/shenandoahBarrierSetC2.hpp +++ b/src/hotspot/share/gc/shenandoah/c2/shenandoahBarrierSetC2.hpp @@ -89,6 +89,7 @@ static ShenandoahBarrierSetC2* bsc2(); static bool is_shenandoah_wb_pre_call(Node* call); + static bool is_shenandoah_wb_call(Node* call); static bool is_shenandoah_marking_if(PhaseTransform *phase, Node* n); static bool is_shenandoah_state_load(Node* n); static bool has_only_shenandoah_wb_pre_uses(Node* n); 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 @@ -3144,8 +3144,7 @@ nodes.push(root); for (uint next = 0; next < nodes.size(); next++) { Node *n = nodes.at(next); - if (n->Opcode() == Op_CallLeafNoFP && - ShenandoahBarrierSetAssembler::is_shenandoah_wb_C_call(n->as_Call()->entry_point())) { + if (ShenandoahBarrierSetC2::is_shenandoah_wb_call(n)) { 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/gc/shenandoah/shenandoahBarrierSetAssembler.cpp b/src/hotspot/share/gc/shenandoah/shenandoahBarrierSetAssembler.cpp deleted file mode 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahBarrierSetAssembler.cpp +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2018, Red Hat, Inc. and/or its affiliates. - * - * 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/shenandoah/shenandoahBarrierSetAssembler.hpp" - -bool ShenandoahBarrierSetAssembler::is_shenandoah_wb_C_call(address call) { - if (ShenandoahWriteBarrier || ShenandoahStoreValEnqueueBarrier) { - return call == _shenandoah_wb_C; - } else { - return false; - } -} 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,10 +34,6 @@ #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 // Optimization - Graph Style @@ -896,16 +892,8 @@ proj->_rout.OR(Matcher::method_handle_invoke_SP_save_mask()); } -#if INCLUDE_SHENANDOAHGC - if (UseShenandoahGC && - ShenandoahBarrierSetAssembler::is_shenandoah_wb_C_call(mcall->entry_point())) { - 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); - } + add_call_kills(proj, regs, save_policy, exclude_soe, false); + return node_cnt; }