< prev index next >

src/hotspot/cpu/aarch64/gc/shenandoah/shenandoahBarrierSetAssembler_aarch64.cpp

Print this page




 509 
 510   assert(stub->pre_val()->is_register(), "Precondition.");
 511 
 512   Register pre_val_reg = stub->pre_val()->as_register();
 513 
 514   if (stub->do_load()) {
 515     ce->mem2reg(stub->addr(), stub->pre_val(), T_OBJECT, stub->patch_code(), stub->info(), false /*wide*/, false /*unaligned*/);
 516   }
 517   __ cbz(pre_val_reg, *stub->continuation());
 518   ce->store_parameter(stub->pre_val()->as_register(), 0);
 519   __ far_call(RuntimeAddress(bs->pre_barrier_c1_runtime_code_blob()->code_begin()));
 520   __ b(*stub->continuation());
 521 }
 522 
 523 void ShenandoahBarrierSetAssembler::gen_load_reference_barrier_stub(LIR_Assembler* ce, ShenandoahLoadReferenceBarrierStub* stub) {
 524   ShenandoahBarrierSetC1* bs = (ShenandoahBarrierSetC1*)BarrierSet::barrier_set()->barrier_set_c1();
 525   __ bind(*stub->entry());
 526 
 527   Register obj = stub->obj()->as_register();
 528   Register res = stub->result()->as_register();

 529   Register tmp1 = stub->tmp1()->as_register();
 530   Register tmp2 = stub->tmp2()->as_register();
 531 
 532   assert(res == r0, "result must arrive in r0");
 533 
 534   if (res != obj) {
 535     __ mov(res, obj);
 536   }
 537 
 538   // Check for null.
 539   __ cbz(res, *stub->continuation());
 540 
 541   // Check for object in cset.
 542   __ mov(tmp2, ShenandoahHeap::in_cset_fast_test_addr());
 543   __ lsr(tmp1, res, ShenandoahHeapRegion::region_size_bytes_shift_jint());
 544   __ ldrb(tmp2, Address(tmp2, tmp1));
 545   __ cbz(tmp2, *stub->continuation());
 546 
 547   // Check if object is already forwarded.
 548   Label slow_path;
 549   __ ldr(tmp1, Address(res, oopDesc::mark_offset_in_bytes()));
 550   __ eon(tmp1, tmp1, zr);
 551   __ ands(zr, tmp1, markWord::lock_mask_in_place);
 552   __ br(Assembler::NE, slow_path);
 553 
 554   // Decode forwarded object.
 555   __ orr(tmp1, tmp1, markWord::marked_value);
 556   __ eon(res, tmp1, zr);
 557   __ b(*stub->continuation());
 558 
 559   __ bind(slow_path);
 560   ce->store_parameter(res, 0);

 561   __ far_call(RuntimeAddress(bs->load_reference_barrier_rt_code_blob()->code_begin()));
 562 
 563   __ b(*stub->continuation());
 564 }
 565 
 566 #undef __
 567 
 568 #define __ sasm->
 569 
 570 void ShenandoahBarrierSetAssembler::generate_c1_pre_barrier_runtime_stub(StubAssembler* sasm) {
 571   __ prologue("shenandoah_pre_barrier", false);
 572 
 573   // arg0 : previous value of memory
 574 
 575   BarrierSet* bs = BarrierSet::barrier_set();
 576 
 577   const Register pre_val = r0;
 578   const Register thread = rthread;
 579   const Register tmp = rscratch1;
 580 


 602   __ load_parameter(0, rscratch2);
 603   __ str(rscratch2, Address(tmp, 0));
 604   __ b(done);
 605 
 606   __ bind(runtime);
 607   __ push_call_clobbered_registers();
 608   __ load_parameter(0, pre_val);
 609   __ call_VM_leaf(CAST_FROM_FN_PTR(address, ShenandoahRuntime::write_ref_field_pre_entry), pre_val, thread);
 610   __ pop_call_clobbered_registers();
 611   __ bind(done);
 612 
 613   __ epilogue();
 614 }
 615 
 616 void ShenandoahBarrierSetAssembler::generate_c1_load_reference_barrier_runtime_stub(StubAssembler* sasm) {
 617   __ prologue("shenandoah_load_reference_barrier", false);
 618   // arg0 : object to be resolved
 619 
 620   __ push_call_clobbered_registers();
 621   __ load_parameter(0, r0);
 622   __ mov(lr, CAST_FROM_FN_PTR(address, ShenandoahRuntime::load_reference_barrier));





 623   __ blr(lr);
 624   __ mov(rscratch1, r0);
 625   __ pop_call_clobbered_registers();
 626   __ mov(r0, rscratch1);
 627 
 628   __ epilogue();
 629 }
 630 
 631 #undef __
 632 
 633 #endif // COMPILER1
 634 
 635 address ShenandoahBarrierSetAssembler::shenandoah_lrb() {
 636   assert(_shenandoah_lrb != NULL, "need load reference barrier stub");
 637   return _shenandoah_lrb;
 638 }
 639 
 640 #define __ cgen->assembler()->
 641 
 642 // Shenandoah load reference barrier.




 509 
 510   assert(stub->pre_val()->is_register(), "Precondition.");
 511 
 512   Register pre_val_reg = stub->pre_val()->as_register();
 513 
 514   if (stub->do_load()) {
 515     ce->mem2reg(stub->addr(), stub->pre_val(), T_OBJECT, stub->patch_code(), stub->info(), false /*wide*/, false /*unaligned*/);
 516   }
 517   __ cbz(pre_val_reg, *stub->continuation());
 518   ce->store_parameter(stub->pre_val()->as_register(), 0);
 519   __ far_call(RuntimeAddress(bs->pre_barrier_c1_runtime_code_blob()->code_begin()));
 520   __ b(*stub->continuation());
 521 }
 522 
 523 void ShenandoahBarrierSetAssembler::gen_load_reference_barrier_stub(LIR_Assembler* ce, ShenandoahLoadReferenceBarrierStub* stub) {
 524   ShenandoahBarrierSetC1* bs = (ShenandoahBarrierSetC1*)BarrierSet::barrier_set()->barrier_set_c1();
 525   __ bind(*stub->entry());
 526 
 527   Register obj = stub->obj()->as_register();
 528   Register res = stub->result()->as_register();
 529   Register addr = stub->addr()->as_register_lo();
 530   Register tmp1 = stub->tmp1()->as_register();
 531   Register tmp2 = stub->tmp2()->as_register();
 532 
 533   assert(res == r0, "result must arrive in r0");
 534 
 535   if (res != obj) {
 536     __ mov(res, obj);
 537   }
 538 
 539   // Check for null.
 540   __ cbz(res, *stub->continuation());
 541 
 542   // Check for object in cset.
 543   __ mov(tmp2, ShenandoahHeap::in_cset_fast_test_addr());
 544   __ lsr(tmp1, res, ShenandoahHeapRegion::region_size_bytes_shift_jint());
 545   __ ldrb(tmp2, Address(tmp2, tmp1));
 546   __ cbz(tmp2, *stub->continuation());
 547 
 548   // Check if object is already forwarded.
 549   Label slow_path;
 550   __ ldr(tmp1, Address(res, oopDesc::mark_offset_in_bytes()));
 551   __ eon(tmp1, tmp1, zr);
 552   __ ands(zr, tmp1, markWord::lock_mask_in_place);
 553   __ br(Assembler::NE, slow_path);
 554 
 555   // Decode forwarded object.
 556   __ orr(tmp1, tmp1, markWord::marked_value);
 557   __ eon(res, tmp1, zr);
 558   __ b(*stub->continuation());
 559 
 560   __ bind(slow_path);
 561   ce->store_parameter(res, 0);
 562   ce->store_parameter(addr, 1);
 563   __ far_call(RuntimeAddress(bs->load_reference_barrier_rt_code_blob()->code_begin()));
 564 
 565   __ b(*stub->continuation());
 566 }
 567 
 568 #undef __
 569 
 570 #define __ sasm->
 571 
 572 void ShenandoahBarrierSetAssembler::generate_c1_pre_barrier_runtime_stub(StubAssembler* sasm) {
 573   __ prologue("shenandoah_pre_barrier", false);
 574 
 575   // arg0 : previous value of memory
 576 
 577   BarrierSet* bs = BarrierSet::barrier_set();
 578 
 579   const Register pre_val = r0;
 580   const Register thread = rthread;
 581   const Register tmp = rscratch1;
 582 


 604   __ load_parameter(0, rscratch2);
 605   __ str(rscratch2, Address(tmp, 0));
 606   __ b(done);
 607 
 608   __ bind(runtime);
 609   __ push_call_clobbered_registers();
 610   __ load_parameter(0, pre_val);
 611   __ call_VM_leaf(CAST_FROM_FN_PTR(address, ShenandoahRuntime::write_ref_field_pre_entry), pre_val, thread);
 612   __ pop_call_clobbered_registers();
 613   __ bind(done);
 614 
 615   __ epilogue();
 616 }
 617 
 618 void ShenandoahBarrierSetAssembler::generate_c1_load_reference_barrier_runtime_stub(StubAssembler* sasm) {
 619   __ prologue("shenandoah_load_reference_barrier", false);
 620   // arg0 : object to be resolved
 621 
 622   __ push_call_clobbered_registers();
 623   __ load_parameter(0, r0);
 624   __ load_parameter(1, r1);
 625   if (UseCompressedOops) {
 626     __ mov(lr, CAST_FROM_FN_PTR(address, ShenandoahRuntime::load_reference_barrier_fixup_narrow));
 627   } else {
 628     __ mov(lr, CAST_FROM_FN_PTR(address, ShenandoahRuntime::load_reference_barrier_fixup));
 629   }
 630   __ blr(lr);
 631   __ mov(rscratch1, r0);
 632   __ pop_call_clobbered_registers();
 633   __ mov(r0, rscratch1);
 634 
 635   __ epilogue();
 636 }
 637 
 638 #undef __
 639 
 640 #endif // COMPILER1
 641 
 642 address ShenandoahBarrierSetAssembler::shenandoah_lrb() {
 643   assert(_shenandoah_lrb != NULL, "need load reference barrier stub");
 644   return _shenandoah_lrb;
 645 }
 646 
 647 #define __ cgen->assembler()->
 648 
 649 // Shenandoah load reference barrier.


< prev index next >