# HG changeset patch # User rkennke # Date 1520243190 -3600 # Mon Mar 05 10:46:30 2018 +0100 # Node ID 72cc45fb8c50664a4916de21c23726eb1c39eb11 # Parent 3c0dbf1ed0fd880977c665edce76977e4543668d [mq]: eliminate_wb_stub.patch 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 @@ -803,7 +803,7 @@ StubCodeMark mark(this, "StubRoutines", "shenandoah_wb"); address start = __ pc(); - Label not_done, done, slow_case, not_an_instance, is_array; + 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 @@ -849,103 +849,6 @@ __ push(rcx); } - if (UseTLAB && ShenandoahAsmWB) { - - Register new_obj = r8; - __ movptr(new_obj, Address(r15_thread, JavaThread::gclab_top_offset())); - __ testptr(new_obj, new_obj); - __ jcc(Assembler::zero, slow_case); // No TLAB. - - __ load_klass(rcx, rax); - - // Figure out object size. - __ movl(rcx, Address(rcx, Klass::layout_helper_offset())); - __ testl(rcx, Klass::_lh_instance_slow_path_bit); - // test to see if it has a finalizer or is malformed in some way - __ jcc(Assembler::notZero, slow_case); - __ cmpl(rcx, Klass::_lh_neutral_value); // Make sure it's an instance (LH > 0) - __ jcc(Assembler::lessEqual, not_an_instance); // Thrashes rcx, returns size in rcx. Uses rax. - __ bind(is_array); - - // Size in rdi, new_obj in r8, src obj in rax - - Register new_obj_end = rdi; - int oop_extra_words = Universe::heap()->oop_extra_words(); - __ addq(rcx, oop_extra_words * HeapWordSize); - __ lea(new_obj_end, Address(new_obj, rcx, Address::times_1)); - __ cmpptr(new_obj_end, Address(r15_thread, JavaThread::gclab_end_offset())); - __ jcc(Assembler::above, slow_case); - __ subq(rcx, oop_extra_words * HeapWordSize); - - // Store Brooks pointer and adjust start of newobj. - Universe::heap()->compile_prepare_oop(_masm, new_obj); - - // Size in rcx, new_obj in r8, src obj in rax - - // Copy object. - Label loop; - if (!c_abi) { - __ push(rdi); // Save new_obj_end - __ push(rsi); - } else { - __ mov(r9, rdi); // Save new_obj_end - } - __ shrl(rcx, 3); // Make it num-64-bit-words - __ mov(rdi, r8); // Mov dst into rdi - __ mov(rsi, rax); // Src into rsi. - __ rep_mov(); - if (!c_abi) { - __ pop(rsi); // Restore rsi. - __ pop(rdi); // Restore new_obj_end - } else { - __ mov(rdi, r9); // Restore new_obj_end - } - - // Src obj still in rax. - if (os::is_MP()) { - __ lock(); - } - __ cmpxchgptr(new_obj, Address(rax, BrooksPointer::byte_offset(), Address::times_1)); - __ jccb(Assembler::notEqual, done); // Failed. Updated object in rax. - // Otherwise, we succeeded. - __ mov(rax, new_obj); - __ movptr(Address(r15_thread, JavaThread::gclab_top_offset()), new_obj_end); - __ bind(done); - - if (!c_abi) { - __ pop(rcx); - __ pop(r8); - __ pop(rdi); - } - - __ ret(0); - - __ bind(not_an_instance); - if (!c_abi) { - __ push(rdx); - } - // Layout_helper bits are in rcx - __ movl(rdx, rcx); // Move layout_helper bits to rdx - __ movl(rdi, Address(rax, arrayOopDesc::length_offset_in_bytes())); - __ shrl(rcx, Klass::_lh_log2_element_size_shift); - __ andl(rcx, Klass::_lh_log2_element_size_mask); - __ shll(rdi); // Shifts left by number of bits in rcx (CL) - __ shrl(rdx, Klass::_lh_header_size_shift); - __ andl(rdx, Klass::_lh_header_size_mask); - __ addl(rdi, rdx); - // Round up. - __ addl(rdi, HeapWordSize-1); - __ andl(rdi, -HeapWordSize); - if (!c_abi) { - __ pop(rdx); - } - // Move size (rdi) into rcx - __ movl(rcx, rdi); - __ jmp(is_array); - - __ bind(slow_case); - } - if (!c_abi) { __ push(rdx); __ push(rdi); @@ -5329,7 +5232,6 @@ // entry points that are platform specific if (UseShenandoahGC && (ShenandoahWriteBarrier || ShenandoahStoreValWriteBarrier || ShenandoahStoreValEnqueueBarrier)) { StubRoutines::x86::_shenandoah_wb = generate_shenandoah_wb(false, true); - StubRoutines::_shenandoah_wb_C = generate_shenandoah_wb(true, !ShenandoahWriteBarrierCsetTestInIR); } StubRoutines::x86::_f2i_fixup = generate_f2i_fixup(); StubRoutines::x86::_f2l_fixup = generate_f2l_fixup(); 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 @@ -890,12 +890,7 @@ proj->_rout.OR(Matcher::method_handle_invoke_SP_save_mask()); } - if (UseShenandoahGC && mcall->entry_point() == StubRoutines::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 { - add_call_kills(proj, regs, save_policy, exclude_soe, false); - } + add_call_kills(proj, regs, save_policy, exclude_soe, false); return node_cnt; } diff --git a/src/hotspot/share/opto/shenandoahSupport.cpp b/src/hotspot/share/opto/shenandoahSupport.cpp --- a/src/hotspot/share/opto/shenandoahSupport.cpp +++ b/src/hotspot/share/opto/shenandoahSupport.cpp @@ -3757,7 +3757,7 @@ mm->set_memory_at(Compile::AliasIdxRaw, raw_mem); phase->register_new_node(mm, c); - Node* call = new CallLeafNoFPNode(OptoRuntime::shenandoah_write_barrier_Type(), StubRoutines::shenandoah_wb_C(), "shenandoah_write_barrier", TypeRawPtr::BOTTOM); + Node* call = new CallLeafNode(OptoRuntime::shenandoah_write_barrier_Type(), CAST_FROM_FN_PTR(address, ShenandoahBarrierSet::write_barrier_JRT), "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); @@ -4239,7 +4239,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 == CAST_FROM_FN_PTR(address, ShenandoahBarrierSet::write_barrier_JRT)) { 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/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