< prev index next >

src/cpu/x86/vm/shenandoahBarrierSet_x86.cpp

Print this page
rev 10557 : [backport] Assembler write barriers should consistently check for forwarded objects


  44 }
  45 
  46 void ShenandoahBarrierSet::interpreter_read_barrier_not_null(MacroAssembler* masm, Register dst) {
  47   if (ShenandoahReadBarrier) {
  48     __ movptr(dst, Address(dst, BrooksPointer::byte_offset()));
  49   }
  50 }
  51 
  52 void ShenandoahBarrierSet::interpreter_write_barrier(MacroAssembler* masm, Register dst) {
  53 
  54   if (! ShenandoahWriteBarrier) {
  55     return interpreter_read_barrier(masm, dst);
  56   }
  57 
  58 #ifdef _LP64
  59   assert(dst != rscratch1, "different regs");
  60 
  61   Label done;
  62 
  63   Address gc_state(r15_thread, in_bytes(JavaThread::gc_state_offset()));
  64   __ testb(gc_state, ShenandoahHeap::EVACUATION);
  65 
  66   // Now check if evacuation is in progress.




  67   interpreter_read_barrier_not_null(masm, dst);
  68 

  69   __ jcc(Assembler::zero, done);
  70   __ push(rscratch1);
  71   __ push(rscratch2);
  72 
  73   __ movptr(rscratch1, dst);
  74   __ shrptr(rscratch1, ShenandoahHeapRegion::region_size_bytes_shift_jint());
  75   __ movptr(rscratch2, (intptr_t) ShenandoahHeap::in_cset_fast_test_addr());
  76   __ movbool(rscratch2, Address(rscratch2, rscratch1, Address::times_1));
  77   __ testb(rscratch2, 0x1);
  78 
  79   __ pop(rscratch2);
  80   __ pop(rscratch1);
  81 
  82   __ jcc(Assembler::zero, done);
  83 
  84   __ push(rscratch1);
  85 
  86   // Save possibly live regs.
  87   if (dst != rax) {
  88     __ push(rax);




  44 }
  45 
  46 void ShenandoahBarrierSet::interpreter_read_barrier_not_null(MacroAssembler* masm, Register dst) {
  47   if (ShenandoahReadBarrier) {
  48     __ movptr(dst, Address(dst, BrooksPointer::byte_offset()));
  49   }
  50 }
  51 
  52 void ShenandoahBarrierSet::interpreter_write_barrier(MacroAssembler* masm, Register dst) {
  53 
  54   if (! ShenandoahWriteBarrier) {
  55     return interpreter_read_barrier(masm, dst);
  56   }
  57 
  58 #ifdef _LP64
  59   assert(dst != rscratch1, "different regs");
  60 
  61   Label done;
  62 
  63   Address gc_state(r15_thread, in_bytes(JavaThread::gc_state_offset()));

  64 
  65   // Now check if evacuation is in progress.
  66   __ testb(gc_state, ShenandoahHeap::HAS_FORWARDED | ShenandoahHeap::EVACUATION);
  67   __ jcc(Assembler::zero, done);
  68 
  69   // Heap is unstable, need to perform the read-barrier even if WB is inactive
  70   interpreter_read_barrier_not_null(masm, dst);
  71 
  72   __ testb(gc_state, ShenandoahHeap::EVACUATION);
  73   __ jcc(Assembler::zero, done);
  74   __ push(rscratch1);
  75   __ push(rscratch2);
  76 
  77   __ movptr(rscratch1, dst);
  78   __ shrptr(rscratch1, ShenandoahHeapRegion::region_size_bytes_shift_jint());
  79   __ movptr(rscratch2, (intptr_t) ShenandoahHeap::in_cset_fast_test_addr());
  80   __ movbool(rscratch2, Address(rscratch2, rscratch1, Address::times_1));
  81   __ testb(rscratch2, 0x1);
  82 
  83   __ pop(rscratch2);
  84   __ pop(rscratch1);
  85 
  86   __ jcc(Assembler::zero, done);
  87 
  88   __ push(rscratch1);
  89 
  90   // Save possibly live regs.
  91   if (dst != rax) {
  92     __ push(rax);


< prev index next >