8328364: Remove redundant fields in 'BOTConstants'
Reviewed-by: ayang, tschatzl
This commit is contained in:
parent
c01095c0c9
commit
db4842c9d9
src/hotspot/share/gc
g1
parallel
serial
shared
test/hotspot/gtest/gc/g1
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -49,9 +49,9 @@ G1BlockOffsetTable::G1BlockOffsetTable(MemRegion heap, G1RegionToSpaceMapper* st
|
||||
|
||||
#ifdef ASSERT
|
||||
void G1BlockOffsetTable::check_index(size_t index, const char* msg) const {
|
||||
assert((index) < (_reserved.word_size() >> BOTConstants::log_card_size_in_words()),
|
||||
assert((index) < (_reserved.word_size() >> CardTable::card_shift_in_words()),
|
||||
"%s - index: " SIZE_FORMAT ", _vs.committed_size: " SIZE_FORMAT,
|
||||
msg, (index), (_reserved.word_size() >> BOTConstants::log_card_size_in_words()));
|
||||
msg, (index), (_reserved.word_size() >> CardTable::card_shift_in_words()));
|
||||
assert(G1CollectedHeap::heap()->is_in(address_for_index_raw(index)),
|
||||
"Index " SIZE_FORMAT " corresponding to " PTR_FORMAT
|
||||
" (%u) is not in committed area.",
|
||||
@ -107,7 +107,7 @@ G1BlockOffsetTablePart::G1BlockOffsetTablePart(G1BlockOffsetTable* array, HeapRe
|
||||
void G1BlockOffsetTablePart::set_remainder_to_point_to_start_incl(size_t start_card, size_t end_card) {
|
||||
assert(start_card <= end_card, "precondition");
|
||||
assert(start_card > _bot->index_for(_hr->bottom()), "Cannot be first card");
|
||||
assert(_bot->offset_array(start_card-1) < BOTConstants::card_size_in_words(),
|
||||
assert(_bot->offset_array(start_card-1) < CardTable::card_size_in_words(),
|
||||
"Offset card has an unexpected value");
|
||||
size_t start_card_for_region = start_card;
|
||||
u_char offset = max_jubyte;
|
||||
@ -116,7 +116,7 @@ void G1BlockOffsetTablePart::set_remainder_to_point_to_start_incl(size_t start_c
|
||||
// so that the reach ends in this region and not at the start
|
||||
// of the next.
|
||||
size_t reach = start_card - 1 + (BOTConstants::power_to_cards_back(i+1) - 1);
|
||||
offset = BOTConstants::card_size_in_words() + i;
|
||||
offset = CardTable::card_size_in_words() + i;
|
||||
if (reach >= end_card) {
|
||||
_bot->set_offset_array(start_card_for_region, end_card, offset);
|
||||
start_card_for_region = reach + 1;
|
||||
@ -138,16 +138,16 @@ void G1BlockOffsetTablePart::check_all_cards(size_t start_card, size_t end_card)
|
||||
if (end_card < start_card) {
|
||||
return;
|
||||
}
|
||||
guarantee(_bot->offset_array(start_card) == BOTConstants::card_size_in_words(), "Wrong value in second card");
|
||||
guarantee(_bot->offset_array(start_card) == CardTable::card_size_in_words(), "Wrong value in second card");
|
||||
for (size_t c = start_card + 1; c <= end_card; c++ /* yeah! */) {
|
||||
u_char entry = _bot->offset_array(c);
|
||||
if (c - start_card > BOTConstants::power_to_cards_back(1)) {
|
||||
guarantee(entry > BOTConstants::card_size_in_words(),
|
||||
guarantee(entry > CardTable::card_size_in_words(),
|
||||
"Should be in logarithmic region - "
|
||||
"entry: %u, "
|
||||
"_array->offset_array(c): %u, "
|
||||
"N_words: %u",
|
||||
(uint)entry, (uint)_bot->offset_array(c), BOTConstants::card_size_in_words());
|
||||
(uint)entry, (uint)_bot->offset_array(c), CardTable::card_size_in_words());
|
||||
}
|
||||
size_t backskip = BOTConstants::entry_to_cards_back(entry);
|
||||
size_t landing_card = c - backskip;
|
||||
@ -160,10 +160,10 @@ void G1BlockOffsetTablePart::check_all_cards(size_t start_card, size_t end_card)
|
||||
} else {
|
||||
guarantee(landing_card == start_card - 1, "Tautology");
|
||||
// Note that N_words is the maximum offset value
|
||||
guarantee(_bot->offset_array(landing_card) < BOTConstants::card_size_in_words(),
|
||||
guarantee(_bot->offset_array(landing_card) < CardTable::card_size_in_words(),
|
||||
"landing card offset: %u, "
|
||||
"N_words: %u",
|
||||
(uint)_bot->offset_array(landing_card), (uint)BOTConstants::card_size_in_words());
|
||||
(uint)_bot->offset_array(landing_card), (uint)CardTable::card_size_in_words());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -188,13 +188,13 @@ void G1BlockOffsetTablePart::update_for_block_work(HeapWord* blk_start,
|
||||
"phantom block");
|
||||
assert(blk_end > cur_card_boundary, "should be past cur_card_boundary");
|
||||
assert(blk_start <= cur_card_boundary, "blk_start should be at or before cur_card_boundary");
|
||||
assert(pointer_delta(cur_card_boundary, blk_start) < BOTConstants::card_size_in_words(),
|
||||
"offset should be < BOTConstants::card_size_in_words()");
|
||||
assert(pointer_delta(cur_card_boundary, blk_start) < CardTable::card_size_in_words(),
|
||||
"offset should be < CardTable::card_size_in_words()");
|
||||
assert(G1CollectedHeap::heap()->is_in_reserved(blk_start),
|
||||
"reference must be into the heap");
|
||||
assert(G1CollectedHeap::heap()->is_in_reserved(blk_end - 1),
|
||||
"limit must be within the heap");
|
||||
assert(cur_card_boundary == _bot->_reserved.start() + index*BOTConstants::card_size_in_words(),
|
||||
assert(cur_card_boundary == _bot->_reserved.start() + index * CardTable::card_size_in_words(),
|
||||
"index must agree with cur_card_boundary");
|
||||
|
||||
// Mark the card that holds the offset into the block.
|
||||
@ -213,7 +213,7 @@ void G1BlockOffsetTablePart::update_for_block_work(HeapWord* blk_start,
|
||||
#ifdef ASSERT
|
||||
// Calculate new_card_boundary this way because end_index
|
||||
// may be the last valid index in the covered region.
|
||||
HeapWord* new_card_boundary = _bot->address_for_index(end_index) + BOTConstants::card_size_in_words();
|
||||
HeapWord* new_card_boundary = _bot->address_for_index(end_index) + CardTable::card_size_in_words();
|
||||
assert(new_card_boundary >= blk_end, "postcondition");
|
||||
|
||||
// The offset can be 0 if the block starts on a boundary. That
|
||||
@ -221,7 +221,7 @@ void G1BlockOffsetTablePart::update_for_block_work(HeapWord* blk_start,
|
||||
size_t start_index = _bot->index_for(blk_start);
|
||||
HeapWord* boundary = _bot->address_for_index(start_index);
|
||||
assert((_bot->offset_array(index) == 0 && blk_start == boundary) ||
|
||||
(_bot->offset_array(index) > 0 && _bot->offset_array(index) < BOTConstants::card_size_in_words()),
|
||||
(_bot->offset_array(index) > 0 && _bot->offset_array(index) < CardTable::card_size_in_words()),
|
||||
"offset array should have been set - "
|
||||
"index offset: %u, "
|
||||
"blk_start: " PTR_FORMAT ", "
|
||||
@ -231,12 +231,12 @@ void G1BlockOffsetTablePart::update_for_block_work(HeapWord* blk_start,
|
||||
for (size_t j = index + 1; j <= end_index; j++) {
|
||||
assert(_bot->offset_array(j) > 0 &&
|
||||
_bot->offset_array(j) <=
|
||||
(u_char) (BOTConstants::card_size_in_words()+BOTConstants::N_powers-1),
|
||||
(u_char) (CardTable::card_size_in_words() + BOTConstants::N_powers - 1),
|
||||
"offset array should have been set - "
|
||||
"%u not > 0 OR %u not <= %u",
|
||||
(uint) _bot->offset_array(j),
|
||||
(uint) _bot->offset_array(j),
|
||||
(uint) (BOTConstants::card_size_in_words() + BOTConstants::N_powers - 1));
|
||||
(uint) (CardTable::card_size_in_words() + BOTConstants::N_powers - 1));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@ -248,7 +248,7 @@ void G1BlockOffsetTablePart::verify() const {
|
||||
|
||||
for (size_t current_card = start_card; current_card < end_card; current_card++) {
|
||||
u_char entry = _bot->offset_array(current_card);
|
||||
if (entry < BOTConstants::card_size_in_words()) {
|
||||
if (entry < CardTable::card_size_in_words()) {
|
||||
// The entry should point to an object before the current card. Verify that
|
||||
// it is possible to walk from that object in to the current card by just
|
||||
// iterating over the objects following it.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -27,6 +27,7 @@
|
||||
|
||||
#include "gc/g1/g1RegionToSpaceMapper.hpp"
|
||||
#include "gc/shared/blockOffsetTable.hpp"
|
||||
#include "gc/shared/cardTable.hpp"
|
||||
#include "memory/memRegion.hpp"
|
||||
#include "memory/virtualspace.hpp"
|
||||
#include "utilities/globalDefinitions.hpp"
|
||||
@ -55,9 +56,9 @@ private:
|
||||
volatile u_char* _offset_array; // byte array keeping backwards offsets
|
||||
|
||||
void check_offset(size_t offset, const char* msg) const {
|
||||
assert(offset < BOTConstants::card_size_in_words(),
|
||||
assert(offset < CardTable::card_size_in_words(),
|
||||
"%s - offset: " SIZE_FORMAT ", N_words: %u",
|
||||
msg, offset, BOTConstants::card_size_in_words());
|
||||
msg, offset, CardTable::card_size_in_words());
|
||||
}
|
||||
|
||||
// Bounds checking accessors:
|
||||
@ -78,13 +79,13 @@ public:
|
||||
// Return the number of slots needed for an offset array
|
||||
// that covers mem_region_words words.
|
||||
static size_t compute_size(size_t mem_region_words) {
|
||||
size_t number_of_slots = (mem_region_words / BOTConstants::card_size_in_words());
|
||||
size_t number_of_slots = (mem_region_words / CardTable::card_size_in_words());
|
||||
return ReservedSpace::allocation_align_size_up(number_of_slots);
|
||||
}
|
||||
|
||||
// Returns how many bytes of the heap a single byte of the BOT corresponds to.
|
||||
static size_t heap_map_factor() {
|
||||
return BOTConstants::card_size();
|
||||
return CardTable::card_size();
|
||||
}
|
||||
|
||||
// Initialize the Block Offset Table to cover the memory region passed
|
||||
@ -100,7 +101,7 @@ public:
|
||||
inline HeapWord* address_for_index(size_t index) const;
|
||||
// Variant of address_for_index that does not check the index for validity.
|
||||
inline HeapWord* address_for_index_raw(size_t index) const {
|
||||
return _reserved.start() + (index << BOTConstants::log_card_size_in_words());
|
||||
return _reserved.start() + (index << CardTable::card_shift_in_words());
|
||||
}
|
||||
};
|
||||
|
||||
@ -124,7 +125,7 @@ private:
|
||||
void check_all_cards(size_t left_card, size_t right_card) const NOT_DEBUG_RETURN;
|
||||
|
||||
static HeapWord* align_up_by_card_size(HeapWord* const addr) {
|
||||
return align_up(addr, BOTConstants::card_size());
|
||||
return align_up(addr, CardTable::card_size());
|
||||
}
|
||||
|
||||
void update_for_block(HeapWord* blk_start, size_t size) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -26,8 +26,8 @@
|
||||
#define SHARE_GC_G1_G1BLOCKOFFSETTABLE_INLINE_HPP
|
||||
|
||||
#include "gc/g1/g1BlockOffsetTable.hpp"
|
||||
|
||||
#include "gc/g1/g1HeapRegion.hpp"
|
||||
#include "gc/shared/cardTable.hpp"
|
||||
#include "gc/shared/memset_with_concurrent_readers.hpp"
|
||||
#include "runtime/atomic.hpp"
|
||||
#include "oops/oop.inline.hpp"
|
||||
@ -47,14 +47,14 @@ inline HeapWord* G1BlockOffsetTablePart::block_start_reaching_into_card(const vo
|
||||
size_t index = _bot->index_for(addr);
|
||||
|
||||
u_char offset = _bot->offset_array(index);
|
||||
while (offset >= BOTConstants::card_size_in_words()) {
|
||||
while (offset >= CardTable::card_size_in_words()) {
|
||||
// The excess of the offset from N_words indicates a power of Base
|
||||
// to go back by.
|
||||
size_t n_cards_back = BOTConstants::entry_to_cards_back(offset);
|
||||
index -= n_cards_back;
|
||||
offset = _bot->offset_array(index);
|
||||
}
|
||||
assert(offset < BOTConstants::card_size_in_words(), "offset too large");
|
||||
assert(offset < CardTable::card_size_in_words(), "offset too large");
|
||||
|
||||
HeapWord* q = _bot->address_for_index(index);
|
||||
return q - offset;
|
||||
@ -92,7 +92,7 @@ void G1BlockOffsetTable::set_offset_array(size_t left, size_t right, u_char offs
|
||||
|
||||
// Variant of index_for that does not check the index for validity.
|
||||
inline size_t G1BlockOffsetTable::index_for_raw(const void* p) const {
|
||||
return pointer_delta((char*)p, _reserved.start(), sizeof(char)) >> BOTConstants::log_card_size();
|
||||
return pointer_delta((char*)p, _reserved.start(), sizeof(char)) >> CardTable::card_shift();
|
||||
}
|
||||
|
||||
inline size_t G1BlockOffsetTable::index_for(const void* p) const {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -531,7 +531,7 @@ class G1ScanHRForRegionClosure : public HeapRegionClosure {
|
||||
return;
|
||||
}
|
||||
|
||||
HeapWord* scan_end = MIN2(card_start + (num_cards << BOTConstants::log_card_size_in_words()), top);
|
||||
HeapWord* scan_end = MIN2(card_start + (num_cards << CardTable::card_shift_in_words()), top);
|
||||
if (_scanned_to >= scan_end) {
|
||||
return;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -34,7 +34,7 @@ static size_t num_bytes_required(MemRegion mr) {
|
||||
assert(CardTable::is_card_aligned(mr.start()), "precondition");
|
||||
assert(CardTable::is_card_aligned(mr.end()), "precondition");
|
||||
|
||||
return mr.word_size() / BOTConstants::card_size_in_words();
|
||||
return mr.word_size() / CardTable::card_size_in_words();
|
||||
}
|
||||
|
||||
void ObjectStartArray::initialize(MemRegion reserved_region) {
|
||||
@ -58,7 +58,7 @@ void ObjectStartArray::initialize(MemRegion reserved_region) {
|
||||
|
||||
assert(_virtual_space.low_boundary() != nullptr, "set from the backing_store");
|
||||
|
||||
_offset_base = (uint8_t*)(_virtual_space.low_boundary() - (uintptr_t(reserved_region.start()) >> BOTConstants::log_card_size()));
|
||||
_offset_base = (uint8_t*)(_virtual_space.low_boundary() - (uintptr_t(reserved_region.start()) >> CardTable::card_shift()));
|
||||
}
|
||||
|
||||
void ObjectStartArray::set_covered_region(MemRegion mr) {
|
||||
@ -111,7 +111,7 @@ void ObjectStartArray::update_for_block_work(HeapWord* blk_start,
|
||||
// -1 so that the reach ends in this region and not at the start
|
||||
// of the next.
|
||||
uint8_t* reach = offset_entry + BOTConstants::power_to_cards_back(i + 1) - 1;
|
||||
uint8_t value = checked_cast<uint8_t>(BOTConstants::card_size_in_words() + i);
|
||||
uint8_t value = checked_cast<uint8_t>(CardTable::card_size_in_words() + i);
|
||||
|
||||
fill_range(start_entry_for_region, MIN2(reach, end_entry), value);
|
||||
start_entry_for_region = reach + 1;
|
||||
@ -132,7 +132,7 @@ void ObjectStartArray::verify_for_block(HeapWord* blk_start, HeapWord* blk_end)
|
||||
const uint8_t* const start_entry = entry_for_addr(align_up_by_card_size(blk_start));
|
||||
const uint8_t* const end_entry = entry_for_addr(blk_end - 1);
|
||||
// Check entries in [start_entry, end_entry]
|
||||
assert(*start_entry < BOTConstants::card_size_in_words(), "offset entry");
|
||||
assert(*start_entry < CardTable::card_size_in_words(), "offset entry");
|
||||
|
||||
for (const uint8_t* i = start_entry + 1; i <= end_entry; ++i) {
|
||||
const uint8_t prev = *(i-1);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -27,6 +27,7 @@
|
||||
|
||||
#include "gc/parallel/psVirtualspace.hpp"
|
||||
#include "gc/shared/blockOffsetTable.hpp"
|
||||
#include "gc/shared/cardTable.hpp"
|
||||
#include "memory/allocation.hpp"
|
||||
#include "memory/memRegion.hpp"
|
||||
#include "oops/oop.hpp"
|
||||
@ -50,21 +51,21 @@ class ObjectStartArray : public CHeapObj<mtGC> {
|
||||
uint8_t* entry_for_addr(const void* const p) const {
|
||||
assert(_covered_region.contains(p),
|
||||
"out of bounds access to object start array");
|
||||
uint8_t* result = &_offset_base[uintptr_t(p) >> BOTConstants::log_card_size()];
|
||||
uint8_t* result = &_offset_base[uintptr_t(p) >> CardTable::card_shift()];
|
||||
return result;
|
||||
}
|
||||
|
||||
// Mapping from object start array entry to address of first word
|
||||
HeapWord* addr_for_entry(const uint8_t* const p) const {
|
||||
size_t delta = pointer_delta(p, _offset_base, sizeof(uint8_t));
|
||||
HeapWord* result = (HeapWord*) (delta << BOTConstants::log_card_size());
|
||||
HeapWord* result = (HeapWord*) (delta << CardTable::card_shift());
|
||||
assert(_covered_region.contains(result),
|
||||
"out of bounds accessor from card marking array");
|
||||
return result;
|
||||
}
|
||||
|
||||
static HeapWord* align_up_by_card_size(HeapWord* const addr) {
|
||||
return align_up(addr, BOTConstants::card_size());
|
||||
return align_up(addr, CardTable::card_size());
|
||||
}
|
||||
|
||||
void update_for_block_work(HeapWord* blk_start, HeapWord* blk_end);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -50,7 +50,7 @@ HeapWord* ObjectStartArray::block_start_reaching_into_card(HeapWord* const addr)
|
||||
while (true) {
|
||||
offset = *entry;
|
||||
|
||||
if (offset < BOTConstants::card_size_in_words()) {
|
||||
if (offset < CardTable::card_size_in_words()) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -127,7 +127,7 @@ size_t PSOldGen::num_iterable_blocks() const {
|
||||
|
||||
void PSOldGen::object_iterate_block(ObjectClosure* cl, size_t block_index) {
|
||||
size_t block_word_size = IterateBlockSize / HeapWordSize;
|
||||
assert((block_word_size % BOTConstants::card_size_in_words()) == 0,
|
||||
assert((block_word_size % CardTable::card_size_in_words()) == 0,
|
||||
"To ensure fast object_start calls");
|
||||
|
||||
MutableSpace *space = object_space();
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -129,7 +129,7 @@ void SerialBlockOffsetTable::update_for_block_work(HeapWord* blk_start,
|
||||
// -1 so that the reach ends in this region and not at the start
|
||||
// of the next.
|
||||
size_t reach = offset_card + BOTConstants::power_to_cards_back(i + 1) - 1;
|
||||
uint8_t value = checked_cast<uint8_t>(BOTConstants::card_size_in_words() + i);
|
||||
uint8_t value = checked_cast<uint8_t>(CardTable::card_size_in_words() + i);
|
||||
|
||||
_array->set_offset_array(start_card_for_region, MIN2(reach, end_card), value);
|
||||
start_card_for_region = reach + 1;
|
||||
@ -151,7 +151,7 @@ HeapWord* SerialBlockOffsetTable::block_start_reaching_into_card(const void* add
|
||||
while (true) {
|
||||
offset = _array->offset_array(index);
|
||||
|
||||
if (offset < BOTConstants::card_size_in_words()) {
|
||||
if (offset < CardTable::card_size_in_words()) {
|
||||
break;
|
||||
}
|
||||
|
||||
@ -171,7 +171,7 @@ void SerialBlockOffsetTable::verify_for_block(HeapWord* blk_start, HeapWord* blk
|
||||
const size_t start_card = _array->index_for(align_up_by_card_size(blk_start));
|
||||
const size_t end_card = _array->index_for(blk_end - 1);
|
||||
// Check cards in [start_card, end_card]
|
||||
assert(_array->offset_array(start_card) < BOTConstants::card_size_in_words(), "offset card");
|
||||
assert(_array->offset_array(start_card) < CardTable::card_size_in_words(), "offset card");
|
||||
|
||||
for (size_t i = start_card + 1; i <= end_card; ++i) {
|
||||
const uint8_t prev = _array->offset_array(i-1);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -61,9 +61,9 @@ class SerialBlockOffsetSharedArray: public CHeapObj<mtGC> {
|
||||
// Return the number of slots needed for an offset array
|
||||
// that covers mem_region_words words.
|
||||
static size_t compute_size(size_t mem_region_words) {
|
||||
assert(mem_region_words % BOTConstants::card_size_in_words() == 0, "precondition");
|
||||
assert(mem_region_words % CardTable::card_size_in_words() == 0, "precondition");
|
||||
|
||||
size_t number_of_slots = mem_region_words / BOTConstants::card_size_in_words();
|
||||
size_t number_of_slots = mem_region_words / CardTable::card_size_in_words();
|
||||
return ReservedSpace::allocation_align_size_up(number_of_slots);
|
||||
}
|
||||
|
||||
@ -91,7 +91,7 @@ public:
|
||||
void set_offset_array(size_t index, HeapWord* high, HeapWord* low) {
|
||||
assert(index < _vs.committed_size(), "index out of range");
|
||||
assert(high >= low, "addresses out of order");
|
||||
assert(pointer_delta(high, low) < BOTConstants::card_size_in_words(), "offset too large");
|
||||
assert(pointer_delta(high, low) < CardTable::card_size_in_words(), "offset too large");
|
||||
_offset_array[index] = checked_cast<uint8_t>(pointer_delta(high, low));
|
||||
}
|
||||
|
||||
@ -117,7 +117,7 @@ class SerialBlockOffsetTable {
|
||||
void update_for_block_work(HeapWord* blk_start, HeapWord* blk_end);
|
||||
|
||||
static HeapWord* align_up_by_card_size(HeapWord* const addr) {
|
||||
return align_up(addr, BOTConstants::card_size());
|
||||
return align_up(addr, CardTable::card_size());
|
||||
}
|
||||
|
||||
void verify_for_block(HeapWord* blk_start, HeapWord* blk_end) const;
|
||||
@ -125,9 +125,7 @@ class SerialBlockOffsetTable {
|
||||
public:
|
||||
// Initialize the table to cover the given space.
|
||||
// The contents of the initial table are undefined.
|
||||
SerialBlockOffsetTable(SerialBlockOffsetSharedArray* array) : _array(array) {
|
||||
assert(BOTConstants::card_size() == CardTable::card_size(), "sanity");
|
||||
}
|
||||
SerialBlockOffsetTable(SerialBlockOffsetSharedArray* array) : _array(array) {}
|
||||
|
||||
static bool is_crossing_card_boundary(HeapWord* const obj_start,
|
||||
HeapWord* const obj_end) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -33,14 +33,14 @@ inline size_t SerialBlockOffsetSharedArray::index_for(const void* p) const {
|
||||
pc < (char*)_reserved.end(),
|
||||
"p not in range.");
|
||||
size_t delta = pointer_delta(pc, _reserved.start(), sizeof(char));
|
||||
size_t result = delta >> BOTConstants::log_card_size();
|
||||
size_t result = delta >> CardTable::card_shift();
|
||||
assert(result < _vs.committed_size(), "bad index from address");
|
||||
return result;
|
||||
}
|
||||
|
||||
inline HeapWord* SerialBlockOffsetSharedArray::address_for_index(size_t index) const {
|
||||
assert(index < _vs.committed_size(), "bad index");
|
||||
HeapWord* result = _reserved.start() + (index << BOTConstants::log_card_size_in_words());
|
||||
HeapWord* result = _reserved.start() + (index << CardTable::card_shift_in_words());
|
||||
assert(result >= _reserved.start() && result < _reserved.end(),
|
||||
"bad address from index");
|
||||
return result;
|
||||
|
@ -1,39 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled.hpp"
|
||||
#include "gc/shared/blockOffsetTable.hpp"
|
||||
#include "utilities/globalDefinitions.hpp"
|
||||
|
||||
uint BOTConstants::_log_card_size = 0;
|
||||
uint BOTConstants::_log_card_size_in_words = 0;
|
||||
uint BOTConstants::_card_size = 0;
|
||||
uint BOTConstants::_card_size_in_words = 0;
|
||||
|
||||
void BOTConstants::initialize_bot_size(uint card_shift) {
|
||||
_log_card_size = card_shift;
|
||||
_log_card_size_in_words = _log_card_size - LogHeapWordSize;
|
||||
_card_size = 1 << _log_card_size;
|
||||
_card_size_in_words = 1 << _log_card_size_in_words;
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -25,15 +25,11 @@
|
||||
#ifndef SHARE_GC_SHARED_BLOCKOFFSETTABLE_HPP
|
||||
#define SHARE_GC_SHARED_BLOCKOFFSETTABLE_HPP
|
||||
|
||||
#include "gc/shared/cardTable.hpp"
|
||||
#include "memory/allStatic.hpp"
|
||||
#include "utilities/globalDefinitions.hpp"
|
||||
|
||||
class BOTConstants : public AllStatic {
|
||||
static uint _log_card_size;
|
||||
static uint _log_card_size_in_words;
|
||||
static uint _card_size;
|
||||
static uint _card_size_in_words;
|
||||
|
||||
public:
|
||||
// entries "e" of at least N_words mean "go back by Base^(e-N_words)."
|
||||
// All entries are less than "N_words + N_powers".
|
||||
@ -41,28 +37,13 @@ public:
|
||||
static const uint Base = (1 << LogBase);
|
||||
static const uint N_powers = 14;
|
||||
|
||||
// Initialize bot size based on card size
|
||||
static void initialize_bot_size(uint card_shift);
|
||||
|
||||
static size_t power_to_cards_back(uint i) {
|
||||
return (size_t)1 << (LogBase * i);
|
||||
}
|
||||
|
||||
static size_t entry_to_cards_back(u_char entry) {
|
||||
assert(entry >= _card_size_in_words, "Precondition");
|
||||
return power_to_cards_back(entry - _card_size_in_words);
|
||||
}
|
||||
static uint log_card_size() {
|
||||
return _log_card_size;
|
||||
}
|
||||
static uint log_card_size_in_words() {
|
||||
return _log_card_size_in_words;
|
||||
}
|
||||
static uint card_size() {
|
||||
return _card_size;
|
||||
}
|
||||
static uint card_size_in_words() {
|
||||
return _card_size_in_words;
|
||||
assert(entry >= CardTable::card_size_in_words(), "Precondition");
|
||||
return power_to_cards_back(entry - CardTable::card_size_in_words());
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -40,6 +40,7 @@
|
||||
#endif
|
||||
|
||||
uint CardTable::_card_shift = 0;
|
||||
uint CardTable::_card_shift_in_words = 0;
|
||||
uint CardTable::_card_size = 0;
|
||||
uint CardTable::_card_size_in_words = 0;
|
||||
|
||||
@ -50,9 +51,7 @@ void CardTable::initialize_card_size() {
|
||||
_card_size = GCCardSizeInBytes;
|
||||
_card_shift = log2i_exact(_card_size);
|
||||
_card_size_in_words = _card_size / sizeof(HeapWord);
|
||||
|
||||
// Set blockOffsetTable size based on card table entry size
|
||||
BOTConstants::initialize_bot_size(_card_shift);
|
||||
_card_shift_in_words = _card_shift - LogHeapWordSize;
|
||||
|
||||
log_info_p(gc, init)("CardTable entry size: " UINT32_FORMAT, _card_size);
|
||||
}
|
||||
|
@ -73,6 +73,7 @@ protected:
|
||||
|
||||
// CardTable entry size
|
||||
static uint _card_shift;
|
||||
static uint _card_shift_in_words;
|
||||
static uint _card_size;
|
||||
static uint _card_size_in_words;
|
||||
|
||||
@ -182,6 +183,10 @@ public:
|
||||
return _card_shift;
|
||||
}
|
||||
|
||||
static uint card_shift_in_words() {
|
||||
return _card_shift_in_words;
|
||||
}
|
||||
|
||||
static uint card_size() {
|
||||
return _card_size;
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ TEST_VM(FreeRegionList, length) {
|
||||
bot_rs.size(),
|
||||
os::vm_page_size(),
|
||||
HeapRegion::GrainBytes,
|
||||
BOTConstants::card_size(),
|
||||
CardTable::card_size(),
|
||||
mtGC);
|
||||
G1BlockOffsetTable bot(heap, bot_storage);
|
||||
bot_storage->commit_regions(0, num_regions_in_test);
|
||||
|
Loading…
x
Reference in New Issue
Block a user