mirror of
https://github.com/openjdk/jdk.git
synced 2026-01-28 12:09:14 +00:00
8296954: G1: Enable parallel scanning for heap region remset
Reviewed-by: tschatzl, ayang
This commit is contained in:
parent
6f06f440bc
commit
33dfc7d2ef
@ -35,6 +35,7 @@
|
||||
#include "runtime/java.hpp"
|
||||
#include "utilities/bitMap.inline.hpp"
|
||||
#include "utilities/concurrentHashTable.inline.hpp"
|
||||
#include "utilities/concurrentHashTableTasks.inline.hpp"
|
||||
#include "utilities/globalDefinitions.hpp"
|
||||
|
||||
G1CardSet::ContainerPtr G1CardSet::FullCardSet = (G1CardSet::ContainerPtr)-1;
|
||||
@ -240,12 +241,15 @@ void G1CardSetCoarsenStats::print_on(outputStream* out) {
|
||||
|
||||
class G1CardSetHashTable : public CHeapObj<mtGCCardSet> {
|
||||
using ContainerPtr = G1CardSet::ContainerPtr;
|
||||
using CHTScanTask = CardSetHash::ScanTask;
|
||||
|
||||
const static uint BucketClaimSize = 16;
|
||||
// Did we insert at least one card in the table?
|
||||
bool volatile _inserted_card;
|
||||
|
||||
G1CardSetMemoryManager* _mm;
|
||||
CardSetHash _table;
|
||||
CHTScanTask _table_scanner;
|
||||
|
||||
class G1CardSetHashTableLookUp : public StackObj {
|
||||
uint _region_idx;
|
||||
@ -291,7 +295,8 @@ public:
|
||||
size_t initial_log_table_size = InitialLogTableSize) :
|
||||
_inserted_card(false),
|
||||
_mm(mm),
|
||||
_table(mm, initial_log_table_size, false) {
|
||||
_table(mm, initial_log_table_size, false),
|
||||
_table_scanner(&_table, BucketClaimSize) {
|
||||
}
|
||||
|
||||
~G1CardSetHashTable() {
|
||||
@ -332,7 +337,7 @@ public:
|
||||
|
||||
void iterate_safepoint(G1CardSet::ContainerPtrClosure* cl2) {
|
||||
G1CardSetHashTableScan cl(cl2);
|
||||
_table.do_safepoint_scan(cl);
|
||||
_table_scanner.do_safepoint_scan(cl);
|
||||
}
|
||||
|
||||
void iterate(G1CardSet::ContainerPtrClosure* cl2) {
|
||||
@ -347,6 +352,10 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
void reset_table_scanner() {
|
||||
_table_scanner.set(&_table, BucketClaimSize);
|
||||
}
|
||||
|
||||
void grow() {
|
||||
size_t new_limit = _table.get_size_log2(Thread::current()) + 1;
|
||||
_table.grow(Thread::current(), new_limit);
|
||||
@ -1029,3 +1038,7 @@ void G1CardSet::clear() {
|
||||
_num_occupied = 0;
|
||||
_mm->flush();
|
||||
}
|
||||
|
||||
void G1CardSet::reset_table_scanner() {
|
||||
_table->reset_table_scanner();
|
||||
}
|
||||
|
||||
@ -378,6 +378,8 @@ public:
|
||||
// Clear the entire contents of this remembered set.
|
||||
void clear();
|
||||
|
||||
void reset_table_scanner();
|
||||
|
||||
// Iterate over the container, calling a method on every card or card range contained
|
||||
// in the card container.
|
||||
// For every container, first calls
|
||||
|
||||
@ -916,6 +916,8 @@ void G1RemSet::assert_scan_top_is_null(uint hrm_index) {
|
||||
void G1RemSet::prepare_region_for_scan(HeapRegion* r) {
|
||||
uint hrm_index = r->hrm_index();
|
||||
|
||||
r->prepare_remset_for_scan();
|
||||
|
||||
// Only update non-collection set old regions, others must have already been set
|
||||
// to NULL (don't scan) in the initialization.
|
||||
if (r->in_collection_set()) {
|
||||
@ -1358,7 +1360,7 @@ public:
|
||||
G1ClearBitmapClosure clear(g1h);
|
||||
G1CombinedClosure combined(&merge, &clear);
|
||||
|
||||
g1h->collection_set_iterate_increment_from(&combined, &_hr_claimer, worker_id);
|
||||
g1h->collection_set_iterate_increment_from(&combined, nullptr, worker_id);
|
||||
stats = merge.stats();
|
||||
}
|
||||
|
||||
|
||||
@ -220,6 +220,10 @@ void HeapRegion::clear_humongous() {
|
||||
_humongous_start_region = NULL;
|
||||
}
|
||||
|
||||
void HeapRegion::prepare_remset_for_scan() {
|
||||
return _rem_set->reset_table_scanner();
|
||||
}
|
||||
|
||||
HeapRegion::HeapRegion(uint hrm_index,
|
||||
G1BlockOffsetTable* bot,
|
||||
MemRegion mr,
|
||||
|
||||
@ -457,6 +457,8 @@ public:
|
||||
|
||||
inline bool in_collection_set() const;
|
||||
|
||||
void prepare_remset_for_scan();
|
||||
|
||||
// Methods used by the HeapRegionSetBase class and subclasses.
|
||||
|
||||
// Getter and setter for the next and prev fields used to link regions into
|
||||
|
||||
@ -83,6 +83,10 @@ void HeapRegionRemSet::clear_locked(bool only_cardset) {
|
||||
assert(occupied() == 0, "Should be clear.");
|
||||
}
|
||||
|
||||
void HeapRegionRemSet::reset_table_scanner() {
|
||||
_card_set.reset_table_scanner();
|
||||
}
|
||||
|
||||
G1MonotonicArenaMemoryStats HeapRegionRemSet::card_set_memory_stats() const {
|
||||
return _card_set_mm.memory_stats();
|
||||
}
|
||||
|
||||
@ -122,6 +122,8 @@ public:
|
||||
void clear(bool only_cardset = false);
|
||||
void clear_locked(bool only_cardset = false);
|
||||
|
||||
void reset_table_scanner();
|
||||
|
||||
G1MonotonicArenaMemoryStats card_set_memory_stats() const;
|
||||
|
||||
// The actual # of bytes this hr_remset takes up. Also includes the code
|
||||
|
||||
@ -56,6 +56,7 @@ public:
|
||||
|
||||
void set(size_t claim_size, InternalTable* table) {
|
||||
assert(table != nullptr, "precondition");
|
||||
_next = 0;
|
||||
_limit = table->_size;
|
||||
_size = MIN2(claim_size, _limit);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user