Skip to content
Permalink
Browse files
8277372: Add getters for BOT and card table members
Reviewed-by: tschatzl, sjohanss, ayang
  • Loading branch information
vish-chan authored and Thomas Schatzl committed Dec 6, 2021
1 parent 7c6f57f commit adf39522c178b82dc73e341751b2d9aba984469d
Showing 40 changed files with 205 additions and 176 deletions.
@@ -222,7 +222,7 @@ void G1BarrierSetAssembler::g1_write_barrier_post(MacroAssembler* masm,

const Register card_addr = tmp;

__ lsr(card_addr, store_addr, CardTable::card_shift);
__ lsr(card_addr, store_addr, CardTable::card_shift());

// get the address of the card
__ load_byte_map_base(tmp2);
@@ -444,7 +444,7 @@ void G1BarrierSetAssembler::generate_c1_post_barrier_runtime_stub(StubAssembler*
assert_different_registers(card_offset, byte_map_base, rscratch1);

__ load_parameter(0, card_offset);
__ lsr(card_offset, card_offset, CardTable::card_shift);
__ lsr(card_offset, card_offset, CardTable::card_shift());
__ load_byte_map_base(byte_map_base);
__ ldrb(rscratch1, Address(byte_map_base, card_offset));
__ cmpw(rscratch1, (int)G1CardTable::g1_young_card_val());
@@ -38,7 +38,7 @@ void CardTableBarrierSetAssembler::store_check(MacroAssembler* masm, Register ob
BarrierSet* bs = BarrierSet::barrier_set();
assert(bs->kind() == BarrierSet::CardTableBarrierSet, "Wrong barrier set kind");

__ lsr(obj, obj, CardTable::card_shift);
__ lsr(obj, obj, CardTable::card_shift());

assert(CardTable::dirty_card_val() == 0, "must be");

@@ -64,8 +64,8 @@ void CardTableBarrierSetAssembler::gen_write_ref_array_post_barrier(MacroAssembl

__ lea(end, Address(start, count, Address::lsl(LogBytesPerHeapOop))); // end = start + count << LogBytesPerHeapOop
__ sub(end, end, BytesPerHeapOop); // last element address to make inclusive
__ lsr(start, start, CardTable::card_shift);
__ lsr(end, end, CardTable::card_shift);
__ lsr(start, start, CardTable::card_shift());
__ lsr(end, end, CardTable::card_shift());
__ sub(count, end, start); // number of bytes to copy

__ load_byte_map_base(scratch);
@@ -377,7 +377,7 @@ void LIRGenerator::CardTableBarrierSet_post_barrier_helper(LIR_Opr addr, LIR_Con

// Use unsigned type T_BOOLEAN here rather than (signed) T_BYTE since signed load
// byte instruction does not support the addressing mode we need.
LIR_Address* card_addr = new LIR_Address(tmp, addr, (LIR_Address::Scale) -CardTable::card_shift, 0, T_BOOLEAN);
LIR_Address* card_addr = new LIR_Address(tmp, addr, (LIR_Address::Scale) -CardTable::card_shift(), 0, T_BOOLEAN);
if (UseCondCardMark) {
LIR_Opr cur_value = new_register(T_INT);
__ move(card_addr, cur_value);
@@ -218,7 +218,7 @@ void G1BarrierSetAssembler::g1_write_barrier_post(MacroAssembler* masm,
const Register card_addr = tmp1;

__ mov_address(tmp2, (address)ct->byte_map_base());
__ add(card_addr, tmp2, AsmOperand(store_addr, lsr, CardTable::card_shift));
__ add(card_addr, tmp2, AsmOperand(store_addr, lsr, CardTable::card_shift()));

__ ldrb(tmp2, Address(card_addr));
__ cmp(tmp2, (int)G1CardTable::g1_young_card_val());
@@ -452,7 +452,7 @@ void G1BarrierSetAssembler::generate_c1_post_barrier_runtime_stub(StubAssembler*
// explicitly specify that 'cardtable' has a relocInfo::none
// type.
__ lea(r_card_base_1, cardtable);
__ add(r_card_addr_0, r_card_base_1, AsmOperand(r_obj_0, lsr, CardTable::card_shift));
__ add(r_card_addr_0, r_card_base_1, AsmOperand(r_obj_0, lsr, CardTable::card_shift()));

// first quick check without barrier
__ ldrb(r_tmp2, Address(r_card_addr_0));
@@ -55,8 +55,8 @@ void CardTableBarrierSetAssembler::gen_write_ref_array_post_barrier(MacroAssembl
__ add_ptr_scaled_int32(count, addr, count, LogBytesPerHeapOop);
__ sub(count, count, BytesPerHeapOop); // last addr

__ logical_shift_right(addr, addr, CardTable::card_shift);
__ logical_shift_right(count, count, CardTable::card_shift);
__ logical_shift_right(addr, addr, CardTable::card_shift());
__ logical_shift_right(count, count, CardTable::card_shift());
__ sub(count, count, addr); // nb of cards

// warning: Rthread has not been preserved
@@ -129,7 +129,7 @@ void CardTableBarrierSetAssembler::store_check_part2(MacroAssembler* masm, Regis
"Wrong barrier set kind");

assert(CardTable::dirty_card_val() == 0, "Dirty card value must be 0 due to optimizations.");
Address card_table_addr(card_table_base, obj, lsr, CardTable::card_shift);
Address card_table_addr(card_table_base, obj, lsr, CardTable::card_shift());

if (UseCondCardMark) {
Label already_dirty;
@@ -245,7 +245,7 @@ void G1BarrierSetAssembler::g1_write_barrier_post(MacroAssembler* masm, Decorato
Register Rbase = tmp2;
__ load_const_optimized(Rbase, (address)(ct->card_table()->byte_map_base()), /*temp*/ tmp3);

__ srdi(Rcard_addr, store_addr, CardTable::card_shift);
__ srdi(Rcard_addr, store_addr, CardTable::card_shift());

// Get the address of the card.
__ lbzx(/*card value*/ tmp3, Rbase, Rcard_addr);
@@ -516,7 +516,7 @@ void G1BarrierSetAssembler::generate_c1_post_barrier_runtime_stub(StubAssembler*
__ std(addr, -8, R1_SP);
__ std(tmp2, -16, R1_SP);

__ srdi(addr, R0, CardTable::card_shift); // Addr is passed in R0.
__ srdi(addr, R0, CardTable::card_shift()); // Addr is passed in R0.
__ load_const_optimized(/*cardtable*/ tmp2, byte_map_base, tmp);
__ add(addr, tmp2, addr);
__ lbz(tmp, 0, addr); // tmp := [addr + cardtable]
@@ -54,8 +54,8 @@ void CardTableBarrierSetAssembler::gen_write_ref_array_post_barrier(MacroAssembl
__ addi(count, count, -BytesPerHeapOop);
__ add(count, addr, count);
// Use two shifts to clear out those low order two bits! (Cannot opt. into 1.)
__ srdi(addr, addr, CardTable::card_shift);
__ srdi(count, count, CardTable::card_shift);
__ srdi(addr, addr, CardTable::card_shift());
__ srdi(count, count, CardTable::card_shift());
__ subf(count, addr, count);
__ add_const_optimized(addr, addr, (address)ct->byte_map_base(), R0);
__ addi(count, count, 1);
@@ -74,7 +74,7 @@ void CardTableBarrierSetAssembler::card_table_write(MacroAssembler* masm,
Register tmp, Register obj) {
assert_different_registers(obj, tmp, R0);
__ load_const_optimized(tmp, (address)byte_map_base, R0);
__ srdi(obj, obj, CardTable::card_shift);
__ srdi(obj, obj, CardTable::card_shift());
__ li(R0, CardTable::dirty_card_val());
__ stbx(R0, tmp, obj);
}
@@ -305,7 +305,7 @@ void G1BarrierSetAssembler::g1_write_barrier_post(MacroAssembler* masm, Decorato

// calculate address of card
__ load_const_optimized(Rbase, (address)ct->card_table()->byte_map_base()); // Card table base.
__ z_srlg(Rcard_addr, Rstore_addr, CardTable::card_shift); // Index into card table.
__ z_srlg(Rcard_addr, Rstore_addr, CardTable::card_shift()); // Index into card table.
__ z_algr(Rcard_addr, Rbase); // Explicit calculation needed for cli.
Rbase = noreg; // end of lifetime

@@ -548,7 +548,7 @@ void G1BarrierSetAssembler::generate_c1_post_barrier_runtime_stub(StubAssembler*

// Calculate address of card corresponding to the updated oop slot.
AddressLiteral rs(byte_map_base);
__ z_srlg(addr_card, addr_oop, CardTable::card_shift);
__ z_srlg(addr_card, addr_oop, CardTable::card_shift());
addr_oop = noreg; // dead now
__ load_const_optimized(cardtable, rs); // cardtable := <card table base>
__ z_agr(addr_card, cardtable); // addr_card := addr_oop>>card_shift + cardtable
@@ -70,8 +70,8 @@ void CardTableBarrierSetAssembler::gen_write_ref_array_post_barrier(MacroAssembl
__ load_const_optimized(Z_R1, (address)ct->byte_map_base());

// count = (count>>shift) - (addr>>shift)
__ z_srlg(addr, addr, CardTable::card_shift);
__ z_srlg(count, count, CardTable::card_shift);
__ z_srlg(addr, addr, CardTable::card_shift());
__ z_srlg(count, count, CardTable::card_shift());

// Prefetch first elements of card table for update.
if (VM_Version::has_Prefetch()) {
@@ -146,7 +146,7 @@ void CardTableBarrierSetAssembler::store_check(MacroAssembler* masm, Register st

assert_different_registers(store_addr, tmp);

__ z_srlg(store_addr, store_addr, CardTable::card_shift);
__ z_srlg(store_addr, store_addr, CardTable::card_shift());
__ load_absolute_address(tmp, (address)ct->byte_map_base());
__ z_agr(store_addr, tmp);
__ z_mvi(0, store_addr, CardTable::dirty_card_val());
@@ -298,7 +298,7 @@ void G1BarrierSetAssembler::g1_write_barrier_post(MacroAssembler* masm,
const Register cardtable = tmp2;

__ movptr(card_addr, store_addr);
__ shrptr(card_addr, CardTable::card_shift);
__ shrptr(card_addr, CardTable::card_shift());
// Do not use ExternalAddress to load 'byte_map_base', since 'byte_map_base' is NOT
// a valid address and therefore is not properly handled by the relocation code.
__ movptr(cardtable, (intptr_t)ct->card_table()->byte_map_base());
@@ -540,7 +540,7 @@ void G1BarrierSetAssembler::generate_c1_post_barrier_runtime_stub(StubAssembler*
const Register card_addr = rcx;

__ load_parameter(0, card_addr);
__ shrptr(card_addr, CardTable::card_shift);
__ shrptr(card_addr, CardTable::card_shift());
// Do not use ExternalAddress to load 'byte_map_base', since 'byte_map_base' is NOT
// a valid address and therefore is not properly handled by the relocation code.
__ movptr(cardtable, (intptr_t)ct->card_table()->byte_map_base());
@@ -60,8 +60,8 @@ void CardTableBarrierSetAssembler::gen_write_ref_array_post_barrier(MacroAssembl
#ifdef _LP64
__ leaq(end, Address(addr, count, TIMES_OOP, 0)); // end == addr+count*oop_size
__ subptr(end, BytesPerHeapOop); // end - 1 to make inclusive
__ shrptr(addr, CardTable::card_shift);
__ shrptr(end, CardTable::card_shift);
__ shrptr(addr, CardTable::card_shift());
__ shrptr(end, CardTable::card_shift());
__ subptr(end, addr); // end --> cards count

__ mov64(tmp, disp);
@@ -72,8 +72,8 @@ __ BIND(L_loop);
__ jcc(Assembler::greaterEqual, L_loop);
#else
__ lea(end, Address(addr, count, Address::times_ptr, -wordSize));
__ shrptr(addr, CardTable::card_shift);
__ shrptr(end, CardTable::card_shift);
__ shrptr(addr, CardTable::card_shift());
__ shrptr(end, CardTable::card_shift());
__ subptr(end, addr); // end --> count
__ BIND(L_loop);
Address cardtable(addr, count, Address::times_1, disp);
@@ -93,7 +93,7 @@ void CardTableBarrierSetAssembler::store_check(MacroAssembler* masm, Register ob
CardTableBarrierSet* ctbs = barrier_set_cast<CardTableBarrierSet>(bs);
CardTable* ct = ctbs->card_table();

__ shrptr(obj, CardTable::card_shift);
__ shrptr(obj, CardTable::card_shift());

Address card_addr;

@@ -442,7 +442,7 @@ void G1BarrierSetC2::post_barrier(GraphKit* kit,
Node* cast = __ CastPX(__ ctrl(), adr);

// Divide pointer by card size
Node* card_offset = __ URShiftX( cast, __ ConI(CardTable::card_shift) );
Node* card_offset = __ URShiftX( cast, __ ConI(CardTable::card_shift()) );

// Combine card table base and card offset
Node* card_adr = __ AddP(no_base, byte_map_base_node(kit), card_offset );
@@ -371,7 +371,7 @@ HeapRegion* OldGCAllocRegion::release() {
// Determine how far we are from the next card boundary. If it is smaller than
// the minimum object size we can allocate into, expand into the next card.
HeapWord* top = cur->top();
HeapWord* aligned_top = align_up(top, BOTConstants::N_bytes);
HeapWord* aligned_top = align_up(top, BOTConstants::card_size());

size_t to_allocate_words = pointer_delta(aligned_top, top, HeapWordSize);

@@ -135,7 +135,7 @@ void G1Arguments::initialize_card_set_configuration() {
uint region_size_log_mb = (uint)MAX2(HeapRegion::LogOfHRGrainBytes - LOG_M, 0);

if (FLAG_IS_DEFAULT(G1RemSetArrayOfCardsEntries)) {
uint max_cards_in_inline_ptr = G1CardSetConfiguration::max_cards_in_inline_ptr(HeapRegion::LogOfHRGrainBytes - CardTable::card_shift);
uint max_cards_in_inline_ptr = G1CardSetConfiguration::max_cards_in_inline_ptr(HeapRegion::LogOfHRGrainBytes - CardTable::card_shift());
FLAG_SET_ERGO(G1RemSetArrayOfCardsEntries, MAX2(max_cards_in_inline_ptr * 2,
G1RemSetArrayOfCardsEntriesBase * (1u << (region_size_log_mb + 1))));
}

1 comment on commit adf3952

@openjdk-notifier
Copy link

@openjdk-notifier openjdk-notifier bot commented on adf3952 Dec 6, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.