src/cpu/aarch64/vm/macroAssembler_aarch64.cpp

Print this page




2544 SkipIfEqual::SkipIfEqual(
2545     MacroAssembler* masm, const bool* flag_addr, bool value) {
2546   _masm = masm;
2547   unsigned long offset;
2548   _masm->adrp(rscratch1, ExternalAddress((address)flag_addr), offset);
2549   _masm->ldrb(rscratch1, Address(rscratch1, offset));
2550   _masm->cbzw(rscratch1, _label);
2551 }
2552 
2553 SkipIfEqual::~SkipIfEqual() {
2554   _masm->bind(_label);
2555 }
2556 
2557 void MacroAssembler::cmpptr(Register src1, Address src2) {
2558   unsigned long offset;
2559   adrp(rscratch1, src2, offset);
2560   ldr(rscratch1, Address(rscratch1, offset));
2561   cmp(src1, rscratch1);
2562 }
2563 
2564 void MacroAssembler::store_check(Register obj) {
2565   // Does a store check for the oop in register obj. The content of
2566   // register obj is destroyed afterwards.
2567   store_check_part_1(obj);
2568   store_check_part_2(obj);
2569 }
2570 
2571 void MacroAssembler::store_check(Register obj, Address dst) {
2572   store_check(obj);
2573 }
2574 



2575 
2576 // split the store check operation so that other instructions can be scheduled inbetween
2577 void MacroAssembler::store_check_part_1(Register obj) {
2578   BarrierSet* bs = Universe::heap()->barrier_set();
2579   assert(bs->kind() == BarrierSet::CardTableModRef, "Wrong barrier set kind");
2580   lsr(obj, obj, CardTableModRefBS::card_shift);
2581 }
2582 
2583 void MacroAssembler::store_check_part_2(Register obj) {
2584   BarrierSet* bs = Universe::heap()->barrier_set();
2585   assert(bs->kind() == BarrierSet::CardTableModRef, "Wrong barrier set kind");
2586   CardTableModRefBS* ct = (CardTableModRefBS*)bs;
2587   assert(sizeof(*ct->byte_map_base) == sizeof(jbyte), "adjust this code");
2588 
2589   // The calculation for byte_map_base is as follows:
2590   // byte_map_base = _byte_map - (uintptr_t(low_bound) >> card_shift);
2591   // So this essentially converts an address to a displacement and
2592   // it will never need to be relocated.
2593 
2594   // FIXME: It's not likely that disp will fit into an offset so we
2595   // don't bother to check, but it could save an instruction.
2596   intptr_t disp = (intptr_t) ct->byte_map_base;
2597   mov(rscratch1, disp);









2598   strb(zr, Address(obj, rscratch1));

2599 }
2600 
2601 void MacroAssembler::load_klass(Register dst, Register src) {
2602   if (UseCompressedClassPointers) {
2603     ldrw(dst, Address(src, oopDesc::klass_offset_in_bytes()));
2604     decode_klass_not_null(dst);
2605   } else {
2606     ldr(dst, Address(src, oopDesc::klass_offset_in_bytes()));
2607   }
2608 }
2609 
2610 void MacroAssembler::cmp_klass(Register oop, Register trial_klass, Register tmp) {
2611   if (UseCompressedClassPointers) {
2612     ldrw(tmp, Address(oop, oopDesc::klass_offset_in_bytes()));
2613     if (Universe::narrow_klass_base() == NULL) {
2614       cmp(trial_klass, tmp, LSL, Universe::narrow_klass_shift());
2615       return;
2616     } else if (((uint64_t)Universe::narrow_klass_base() & 0xffffffff) == 0
2617                && Universe::narrow_klass_shift() == 0) {
2618       // Only the bottom 32 bits matter




2544 SkipIfEqual::SkipIfEqual(
2545     MacroAssembler* masm, const bool* flag_addr, bool value) {
2546   _masm = masm;
2547   unsigned long offset;
2548   _masm->adrp(rscratch1, ExternalAddress((address)flag_addr), offset);
2549   _masm->ldrb(rscratch1, Address(rscratch1, offset));
2550   _masm->cbzw(rscratch1, _label);
2551 }
2552 
2553 SkipIfEqual::~SkipIfEqual() {
2554   _masm->bind(_label);
2555 }
2556 
2557 void MacroAssembler::cmpptr(Register src1, Address src2) {
2558   unsigned long offset;
2559   adrp(rscratch1, src2, offset);
2560   ldr(rscratch1, Address(rscratch1, offset));
2561   cmp(src1, rscratch1);
2562 }
2563 







2564 void MacroAssembler::store_check(Register obj, Address dst) {
2565   store_check(obj);
2566 }
2567 
2568 void MacroAssembler::store_check(Register obj) {
2569   // Does a store check for the oop in register obj. The content of
2570   // register obj is destroyed afterwards.
2571 


2572   BarrierSet* bs = Universe::heap()->barrier_set();
2573   assert(bs->kind() == BarrierSet::CardTableModRef, "Wrong barrier set kind");


2574 
2575   CardTableModRefBS* ct = barrier_set_cast<CardTableModRefBS>(bs);



2576   assert(sizeof(*ct->byte_map_base) == sizeof(jbyte), "adjust this code");
2577 
2578   lsr(obj, obj, CardTableModRefBS::card_shift);
2579 
2580   assert(CardTableModRefBS::dirty_card_val() == 0, "must be");
2581 
2582   {
2583     ExternalAddress cardtable((address) ct->byte_map_base);
2584     unsigned long offset;
2585     adrp(rscratch1, cardtable, offset);
2586     assert(offset == 0, "byte_map_base is misaligned");
2587   }
2588 
2589   if (UseCondCardMark) {
2590     Label L_already_dirty;
2591     ldrb(rscratch2,  Address(obj, rscratch1));
2592     cbz(rscratch2, L_already_dirty);
2593     strb(zr, Address(obj, rscratch1));
2594     bind(L_already_dirty);
2595   } else {
2596     strb(zr, Address(obj, rscratch1));
2597   }
2598 }
2599 
2600 void MacroAssembler::load_klass(Register dst, Register src) {
2601   if (UseCompressedClassPointers) {
2602     ldrw(dst, Address(src, oopDesc::klass_offset_in_bytes()));
2603     decode_klass_not_null(dst);
2604   } else {
2605     ldr(dst, Address(src, oopDesc::klass_offset_in_bytes()));
2606   }
2607 }
2608 
2609 void MacroAssembler::cmp_klass(Register oop, Register trial_klass, Register tmp) {
2610   if (UseCompressedClassPointers) {
2611     ldrw(tmp, Address(oop, oopDesc::klass_offset_in_bytes()));
2612     if (Universe::narrow_klass_base() == NULL) {
2613       cmp(trial_klass, tmp, LSL, Universe::narrow_klass_shift());
2614       return;
2615     } else if (((uint64_t)Universe::narrow_klass_base() & 0xffffffff) == 0
2616                && Universe::narrow_klass_shift() == 0) {
2617       // Only the bottom 32 bits matter