From 96cdf93b425612ec2e7815fec4f6f6fcc0e70f47 Mon Sep 17 00:00:00 2001 From: Albert Mingkun Yang Date: Thu, 27 Apr 2023 11:40:50 +0000 Subject: [PATCH] 8306833: Change CardTable::_covered to static array Reviewed-by: tschatzl, kbarrett --- src/hotspot/share/gc/shared/cardTable.cpp | 5 ----- src/hotspot/share/gc/shared/cardTable.hpp | 6 ++++-- src/hotspot/share/gc/shared/cardTableBarrierSet.hpp | 4 ++-- src/hotspot/share/gc/shared/vmStructs_gc.hpp | 5 ++--- 4 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/hotspot/share/gc/shared/cardTable.cpp b/src/hotspot/share/gc/shared/cardTable.cpp index f83857810df..4f2e0abbe95 100644 --- a/src/hotspot/share/gc/shared/cardTable.cpp +++ b/src/hotspot/share/gc/shared/cardTable.cpp @@ -74,17 +74,12 @@ CardTable::CardTable(MemRegion whole_heap) : _byte_map_size(0), _byte_map(nullptr), _byte_map_base(nullptr), - _covered(MemRegion::create_array(max_covered_regions, mtGC)), _guard_region() { assert((uintptr_t(_whole_heap.start()) & (_card_size - 1)) == 0, "heap must start at card boundary"); assert((uintptr_t(_whole_heap.end()) & (_card_size - 1)) == 0, "heap must end at card boundary"); } -CardTable::~CardTable() { - MemRegion::destroy_array(_covered, max_covered_regions); -} - void CardTable::initialize(void* region0_start, void* region1_start) { size_t num_cards = cards_required(_whole_heap.word_size()); diff --git a/src/hotspot/share/gc/shared/cardTable.hpp b/src/hotspot/share/gc/shared/cardTable.hpp index c9b4ba164ee..f66c5b7c508 100644 --- a/src/hotspot/share/gc/shared/cardTable.hpp +++ b/src/hotspot/share/gc/shared/cardTable.hpp @@ -57,7 +57,7 @@ protected: static constexpr int max_covered_regions = 2; // The covered regions should be in address order. - MemRegion* _covered; + MemRegion _covered[max_covered_regions]; // The last card is a guard card; never committed. MemRegion _guard_region; @@ -82,13 +82,15 @@ protected: size_t last_valid_index() const { return cards_required(_whole_heap.word_size()) - 1; } + private: void initialize_covered_region(void* region0_start, void* region1_start); MemRegion committed_for(const MemRegion mr) const; public: CardTable(MemRegion whole_heap); - virtual ~CardTable(); + virtual ~CardTable() = default; + void initialize(void* region0_start, void* region1_start); // *** Barrier set functions. diff --git a/src/hotspot/share/gc/shared/cardTableBarrierSet.hpp b/src/hotspot/share/gc/shared/cardTableBarrierSet.hpp index c59eba1af70..436194bd031 100644 --- a/src/hotspot/share/gc/shared/cardTableBarrierSet.hpp +++ b/src/hotspot/share/gc/shared/cardTableBarrierSet.hpp @@ -60,9 +60,9 @@ protected: CardTable* card_table, const BarrierSet::FakeRtti& fake_rtti); - public: +public: CardTableBarrierSet(CardTable* card_table); - ~CardTableBarrierSet(); + virtual ~CardTableBarrierSet(); CardTable* card_table() const { return _card_table; } diff --git a/src/hotspot/share/gc/shared/vmStructs_gc.hpp b/src/hotspot/share/gc/shared/vmStructs_gc.hpp index 8a15735fe18..2db0f466d34 100644 --- a/src/hotspot/share/gc/shared/vmStructs_gc.hpp +++ b/src/hotspot/share/gc/shared/vmStructs_gc.hpp @@ -89,10 +89,9 @@ nonstatic_field(CardTable, _whole_heap, const MemRegion) \ nonstatic_field(CardTable, _page_size, const size_t) \ nonstatic_field(CardTable, _byte_map_size, const size_t) \ - nonstatic_field(CardTable, _byte_map, CardTable::CardValue*) \ - nonstatic_field(CardTable, _covered, MemRegion*) \ + nonstatic_field(CardTable, _byte_map, CardTable::CardValue*) \ nonstatic_field(CardTable, _guard_region, MemRegion) \ - nonstatic_field(CardTable, _byte_map_base, CardTable::CardValue*) \ + nonstatic_field(CardTable, _byte_map_base, CardTable::CardValue*) \ nonstatic_field(CardTableBarrierSet, _defer_initial_card_mark, bool) \ nonstatic_field(CardTableBarrierSet, _card_table, CardTable*) \ \