# HG changeset patch # Parent 1ca630d367179cae4c1231a7a0ad9ea61aac99dd diff -r 1ca630d36717 src/hotspot/cpu/x86/assembler_x86.cpp --- a/src/hotspot/cpu/x86/assembler_x86.cpp Fri Dec 14 15:33:42 2018 +0100 +++ b/src/hotspot/cpu/x86/assembler_x86.cpp Wed Jan 09 10:14:21 2019 +0100 @@ -8942,6 +8942,12 @@ movq(rax, Address(rsp, 15 * wordSize)); addq(rsp, 16 * wordSize); + + if (!UseCompressedOops && !UseCompressedClassPointers && UseShenandoahGC) { + Address gc_state(r15_thread, in_bytes(ShenandoahThreadLocalData::gc_state_offset())); + movb(r12, gc_state); + } + } void Assembler::popcntq(Register dst, Address src) { diff -r 1ca630d36717 src/hotspot/cpu/x86/gc/shenandoah/shenandoahBarrierSetAssembler_x86.cpp --- a/src/hotspot/cpu/x86/gc/shenandoah/shenandoahBarrierSetAssembler_x86.cpp Fri Dec 14 15:33:42 2018 +0100 +++ b/src/hotspot/cpu/x86/gc/shenandoah/shenandoahBarrierSetAssembler_x86.cpp Wed Jan 09 10:14:21 2019 +0100 @@ -203,8 +203,7 @@ Address index(thread, in_bytes(ShenandoahThreadLocalData::satb_mark_queue_index_offset())); Address buffer(thread, in_bytes(ShenandoahThreadLocalData::satb_mark_queue_buffer_offset())); - Address gc_state(thread, in_bytes(ShenandoahThreadLocalData::gc_state_offset())); - __ testb(gc_state, ShenandoahHeap::MARKING | ShenandoahHeap::TRAVERSAL); + __ testb(r12, ShenandoahHeap::MARKING | ShenandoahHeap::TRAVERSAL); __ jcc(Assembler::zero, done); // Do we need to load the previous value? @@ -334,14 +333,13 @@ #ifdef _LP64 Label done; - Address gc_state(r15_thread, in_bytes(ShenandoahThreadLocalData::gc_state_offset())); - __ testb(gc_state, ShenandoahHeap::HAS_FORWARDED | ShenandoahHeap::EVACUATION | ShenandoahHeap::TRAVERSAL); + __ testb(r12, ShenandoahHeap::HAS_FORWARDED | ShenandoahHeap::EVACUATION | ShenandoahHeap::TRAVERSAL); __ jccb(Assembler::zero, done); // Heap is unstable, need to perform the read-barrier even if WB is inactive read_barrier_not_null(masm, dst); - __ testb(gc_state, ShenandoahHeap::EVACUATION | ShenandoahHeap::TRAVERSAL); + __ testb(r12, ShenandoahHeap::EVACUATION | ShenandoahHeap::TRAVERSAL); __ jccb(Assembler::zero, done); if (dst != rax) { @@ -906,8 +904,7 @@ Label runtime; // Is SATB still active? - Address gc_state(thread, in_bytes(ShenandoahThreadLocalData::gc_state_offset())); - __ testb(gc_state, ShenandoahHeap::MARKING | ShenandoahHeap::TRAVERSAL); + __ testb(r12, ShenandoahHeap::MARKING | ShenandoahHeap::TRAVERSAL); __ jcc(Assembler::zero, done); // Can we store original value in the thread's buffer? diff -r 1ca630d36717 src/hotspot/cpu/x86/macroAssembler_x86.cpp --- a/src/hotspot/cpu/x86/macroAssembler_x86.cpp Fri Dec 14 15:33:42 2018 +0100 +++ b/src/hotspot/cpu/x86/macroAssembler_x86.cpp Wed Jan 09 10:14:21 2019 +0100 @@ -2338,6 +2338,12 @@ } else { get_thread(java_thread); } + + if (!UseCompressedOops && !UseCompressedClassPointers && UseShenandoahGC) { + Address gc_state(r15_thread, in_bytes(ShenandoahThreadLocalData::gc_state_offset())); + movb(r12, gc_state); + } + // reset last Java frame // Only interpreter should have to clear fp reset_last_Java_frame(java_thread, true); @@ -5431,7 +5437,11 @@ } else { movptr(r12_heapbase, ExternalAddress((address)Universe::narrow_ptrs_base_addr())); } - } + } else if (UseShenandoahGC) { + Address gc_state(r15_thread, in_bytes(ShenandoahThreadLocalData::gc_state_offset())); + movb(r12, gc_state); + } + } #endif // _LP64 diff -r 1ca630d36717 src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp --- a/src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp Fri Dec 14 15:33:42 2018 +0100 +++ b/src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp Wed Jan 09 10:14:21 2019 +0100 @@ -3476,6 +3476,7 @@ // Exception pending RegisterSaver::restore_live_registers(masm, save_vectors); + __ reinit_heapbase(); __ jump(RuntimeAddress(StubRoutines::forward_exception_entry())); @@ -3549,6 +3550,7 @@ __ bind(no_adjust); // Normal exit, restore registers and exit. RegisterSaver::restore_live_registers(masm, save_vectors); + __ reinit_heapbase(); __ ret(0); #ifdef ASSERT diff -r 1ca630d36717 src/hotspot/cpu/x86/x86_64.ad --- a/src/hotspot/cpu/x86/x86_64.ad Fri Dec 14 15:33:42 2018 +0100 +++ b/src/hotspot/cpu/x86/x86_64.ad Wed Jan 09 10:14:21 2019 +0100 @@ -527,6 +527,7 @@ %} source_hpp %{ +#include "gc/shenandoah/shenandoahThreadLocalData.hpp" #if INCLUDE_ZGC #include "gc/z/zBarrierSetAssembler.hpp" #endif @@ -2919,6 +2920,16 @@ //----------Simple Operands---------------------------------------------------- // Immediate Operands // Integer Immediate +operand immL_shenandoah_gcstate() +%{ + predicate(n->get_long() == ShenandoahThreadLocalData::gc_state_offset()); + match(ConL); + + op_cost(0); + format %{ %} + interface(CONST_INTER); +%} + operand immI() %{ match(ConI); @@ -11935,6 +11946,15 @@ ins_pipe(ialu_cr_reg_mem); %} +instruct testUB_mem_heapstable(rFlagsReg cr, r15_RegP tls, immL_shenandoah_gcstate off, immI8 imm, immI0 zero) +%{ + predicate(!UseCompressedOops && !UseCompressedClassPointers && UseShenandoahGC); + match(Set cr (CmpI (AndI (LoadUB (AddP tls off)) imm) zero)); + format %{ "testb R12, $imm" %} + ins_encode %{ __ testb(r12, $imm$$constant); %} + ins_pipe(ialu_cr_reg_imm); +%} + instruct testUB_mem_imm(rFlagsReg cr, memory mem, immU8 imm, immI0 zero) %{ match(Set cr (CmpI (AndI (LoadUB mem) imm) zero)); @@ -11945,8 +11965,18 @@ ins_pipe(ialu_cr_reg_mem); %} +instruct testB_mem_heapstable(rFlagsReg cr, r15_RegP tls, immL_shenandoah_gcstate off, immI8 imm, immI0 zero) +%{ + predicate(!UseCompressedOops && !UseCompressedClassPointers && UseShenandoahGC); + match(Set cr (CmpI (AndI (LoadB (AddP tls off)) imm) zero)); + format %{ "testb R12, $imm" %} + ins_encode %{ __ testb(r12, $imm$$constant); %} + ins_pipe(ialu_cr_reg_imm); +%} + instruct testB_mem_imm(rFlagsReg cr, memory mem, immI8 imm, immI0 zero) %{ + predicate(!UseShenandoahGC); match(Set cr (CmpI (AndI (LoadB mem) imm) zero)); ins_cost(125); diff -r 1ca630d36717 src/hotspot/share/utilities/sizes.hpp --- a/src/hotspot/share/utilities/sizes.hpp Fri Dec 14 15:33:42 2018 +0100 +++ b/src/hotspot/share/utilities/sizes.hpp Wed Jan 09 10:14:21 2019 +0100 @@ -62,7 +62,7 @@ class ByteSize { private: int _size; - +public: // Note: This constructor must be private to avoid implicit conversions! ByteSize(int size) { _size = size; }