Skip to content

Commit

Permalink
8296231: Fix MEMFLAGS for CHeapBitMaps
Browse files Browse the repository at this point in the history
Reviewed-by: coleenp, dholmes
  • Loading branch information
stefank committed Nov 4, 2022
1 parent bd729e6 commit 8ee0f7d
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 14 deletions.
3 changes: 2 additions & 1 deletion src/hotspot/share/cds/archiveBuilder.cpp
Expand Up @@ -58,7 +58,7 @@ ArchiveBuilder::OtherROAllocMark::~OtherROAllocMark() {
ArchiveBuilder::alloc_stats()->record_other_type(int(newtop - _oldtop), true);
}

ArchiveBuilder::SourceObjList::SourceObjList() : _ptrmap(16 * K) {
ArchiveBuilder::SourceObjList::SourceObjList() : _ptrmap(16 * K, mtClassShared) {
_total_bytes = 0;
_objs = new (ResourceObj::C_HEAP, mtClassShared) GrowableArray<SourceObjInfo*>(128 * K, mtClassShared);
}
Expand Down Expand Up @@ -155,6 +155,7 @@ ArchiveBuilder::ArchiveBuilder() :
_buffer_to_requested_delta(0),
_rw_region("rw", MAX_SHARED_DELTA),
_ro_region("ro", MAX_SHARED_DELTA),
_ptrmap(mtClassShared),
_rw_src_objs(),
_ro_src_objs(),
_src_obj_table(INITIAL_TABLE_SIZE, MAX_TABLE_SIZE),
Expand Down
5 changes: 5 additions & 0 deletions src/hotspot/share/gc/g1/g1YoungGCEvacFailureInjector.cpp
Expand Up @@ -50,6 +50,11 @@ class SelectEvacFailureRegionClosure : public HeapRegionClosure {
}
};

G1YoungGCEvacFailureInjector::G1YoungGCEvacFailureInjector()
: _inject_evacuation_failure_for_current_gc(),
_last_collection_with_evacuation_failure(),
_evac_failure_regions(mtGC) {}

void G1YoungGCEvacFailureInjector::select_evac_failure_regions() {
G1CollectedHeap* g1h = G1CollectedHeap::heap();
_evac_failure_regions.reinitialize(g1h->max_reserved_regions());
Expand Down
2 changes: 2 additions & 0 deletions src/hotspot/share/gc/g1/g1YoungGCEvacFailureInjector.hpp
Expand Up @@ -69,6 +69,8 @@ class G1YoungGCEvacFailureInjector {
void select_evac_failure_regions() EVAC_FAILURE_INJECTOR_RETURN;
public:

G1YoungGCEvacFailureInjector() EVAC_FAILURE_INJECTOR_RETURN;

// Arm the evacuation failure injector if needed for the current
// GC (based upon the type of GC and which command line flags are set);
void arm_if_needed() EVAC_FAILURE_INJECTOR_RETURN;
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/memory/metaspace/commitMask.cpp
Expand Up @@ -34,7 +34,7 @@
namespace metaspace {

CommitMask::CommitMask(const MetaWord* start, size_t word_size) :
CHeapBitMap(mask_size(word_size, Settings::commit_granule_words())),
CHeapBitMap(mask_size(word_size, Settings::commit_granule_words()), mtMetaspace, true),
_base(start),
_word_size(word_size),
_words_per_bit(Settings::commit_granule_words())
Expand Down
13 changes: 9 additions & 4 deletions test/hotspot/gtest/utilities/test_bitMap.cpp
Expand Up @@ -113,24 +113,29 @@ class BitMapTest {
#endif
};

class TestCHeapBitMap : public CHeapBitMap {
public:
TestCHeapBitMap(size_t size = 0) : CHeapBitMap(size, mtTest) {}
};

TEST_VM(BitMap, resize_grow) {
BitMapTest::testResizeGrow<ResourceBitMap>();
EXPECT_FALSE(HasFailure()) << "Failed on type ResourceBitMap";
BitMapTest::testResizeGrow<CHeapBitMap>();
BitMapTest::testResizeGrow<TestCHeapBitMap>();
EXPECT_FALSE(HasFailure()) << "Failed on type CHeapBitMap";
}

TEST_VM(BitMap, resize_shrink) {
BitMapTest::testResizeShrink<ResourceBitMap>();
EXPECT_FALSE(HasFailure()) << "Failed on type ResourceBitMap";
BitMapTest::testResizeShrink<CHeapBitMap>();
BitMapTest::testResizeShrink<TestCHeapBitMap>();
EXPECT_FALSE(HasFailure()) << "Failed on type CHeapBitMap";
}

TEST_VM(BitMap, resize_same) {
BitMapTest::testResizeSame<ResourceBitMap>();
EXPECT_FALSE(HasFailure()) << "Failed on type ResourceBitMap";
BitMapTest::testResizeSame<CHeapBitMap>();
BitMapTest::testResizeSame<TestCHeapBitMap>();
EXPECT_FALSE(HasFailure()) << "Failed on type CHeapBitMap";
}

Expand All @@ -155,7 +160,7 @@ TEST_VM(BitMap, resize_grow_clear) {
TEST_VM(BitMap, initialize) {
BitMapTest::testInitialize<ResourceBitMap>();
EXPECT_FALSE(HasFailure()) << "Failed on type ResourceBitMap";
BitMapTest::testInitialize<CHeapBitMap>();
BitMapTest::testInitialize<TestCHeapBitMap>();
EXPECT_FALSE(HasFailure()) << "Failed on type CHeapBitMap";
}

Expand Down
6 changes: 3 additions & 3 deletions test/hotspot/gtest/utilities/test_bitMap_large.cpp
Expand Up @@ -46,7 +46,7 @@ static void verify_unset(CHeapBitMap& map, BitMap::idx_t l, BitMap::idx_t r) {
}

TEST(BitMap, clear_large_range) {
CHeapBitMap map(BITMAP_SIZE);
CHeapBitMap map(BITMAP_SIZE, mtTest);

map.set_range(0, BITMAP_SIZE);
verify_set(map, 0, BITMAP_SIZE);
Expand All @@ -70,7 +70,7 @@ TEST(BitMap, clear_large_range) {
}

TEST(BitMap, set_large_range) {
CHeapBitMap map(BITMAP_SIZE);
CHeapBitMap map(BITMAP_SIZE, mtTest);

map.clear();
verify_unset(map, 0, BITMAP_SIZE);
Expand All @@ -94,7 +94,7 @@ TEST(BitMap, set_large_range) {
}

TEST(BitMap, par_at_put_large_range) {
CHeapBitMap map(BITMAP_SIZE);
CHeapBitMap map(BITMAP_SIZE, mtTest);

map.clear();
verify_unset(map, 0, BITMAP_SIZE);
Expand Down
5 changes: 2 additions & 3 deletions test/hotspot/gtest/utilities/test_bitMap_popcnt.cpp
Expand Up @@ -102,7 +102,7 @@ static void set_or_clear_random_range(BitMap& bm, SimpleFakeBitmap& fbm, int beg
}

static void test_bitmap_popcnt(int bitsize) {
CHeapBitMap bm(bitsize);
CHeapBitMap bm(bitsize, mtTest);
SimpleFakeBitmap fbm(bitsize);

ASSERT_POPCNT_ALL(bm, 0);
Expand Down Expand Up @@ -148,7 +148,7 @@ TEST_VM(BitMap, popcnt_300) { test_bitmap_popcnt(300); }

TEST_VM(BitMap, popcnt_large) {

CHeapBitMap bm(64 * K);
CHeapBitMap bm(64 * K, mtTest);

ASSERT_POPCNT_ALL(bm, 0);
ASSERT_POPCNT_RANGE(bm, 0, 64 * K, 0);
Expand All @@ -169,4 +169,3 @@ TEST_VM(BitMap, popcnt_large) {
ASSERT_POPCNT_RANGE(bm, 199, 299, 100);

}

4 changes: 2 additions & 2 deletions test/hotspot/gtest/utilities/test_bitMap_search.cpp
Expand Up @@ -195,8 +195,8 @@ static void test_search_ranges(BitMap& test_ones,
}

TEST(BitMap, search) {
CHeapBitMap test_ones(BITMAP_SIZE);
CHeapBitMap test_zeros(BITMAP_SIZE);
CHeapBitMap test_ones(BITMAP_SIZE, mtTest);
CHeapBitMap test_zeros(BITMAP_SIZE, mtTest);

// test_ones is used to test searching for 1s in a region of 0s.
// test_zeros is used to test searching for 0s in a region of 1s.
Expand Down

1 comment on commit 8ee0f7d

@openjdk-notifier
Copy link

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.