< prev index next >
src/cpu/x86/vm/macroAssembler_x86.cpp
Print this page
rev 10501 : [backport] Check heap stability in C1 WBs
rev 10524 : [backport] Some trivial-ish cleanups
rev 10557 : [backport] Assembler write barriers should consistently check for forwarded objects
@@ -3748,11 +3748,10 @@
void MacroAssembler::null_check(Register reg, int offset) {
if (needs_explicit_null_check(offset)) {
// provoke OS NULL exception if reg = NULL by
// accessing M[reg] w/o changing any (non-CC) registers
// NOTE: cmpl is plenty here to provoke a segv
-
cmpptr(rax, Address(reg, 0));
// Note: should probably use testl(rax, Address(reg, 0));
// may be shorter code (however, this version of
// testl needs to be implemented first)
} else {
@@ -4447,19 +4446,23 @@
void MacroAssembler::shenandoah_write_barrier(Register dst) {
assert(UseShenandoahGC && ShenandoahWriteBarrier, "Should be enabled");
Label done;
- // Check for evacuation-in-progress
Address gc_state(r15_thread, in_bytes(JavaThread::gc_state_offset()));
- testb(gc_state, ShenandoahHeap::EVACUATION);
- // The read-barrier.
+ // Check for heap stability
+ testb(gc_state, ShenandoahHeap::HAS_FORWARDED | ShenandoahHeap::EVACUATION);
+ jccb(Assembler::zero, done);
+
+ // Heap is unstable, need to perform the read-barrier even if WB is inactive
if (ShenandoahWriteBarrierRB) {
movptr(dst, Address(dst, BrooksPointer::byte_offset()));
}
+ // Check for evacuation-in-progress and jump to WB slow-path if needed
+ testb(gc_state, ShenandoahHeap::EVACUATION);
jccb(Assembler::zero, done);
if (dst != rax) {
xchgptr(dst, rax); // Move obj into rax and save rax into obj.
}
< prev index next >