diff --git a/src/hotspot/share/gc/shared/cardTable.cpp b/src/hotspot/share/gc/shared/cardTable.cpp index fdf6dcf3ece..4109db0fe18 100644 --- a/src/hotspot/share/gc/shared/cardTable.cpp +++ b/src/hotspot/share/gc/shared/cardTable.cpp @@ -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 @@ -68,8 +68,7 @@ CardTable::CardTable(MemRegion whole_heap) : _page_size(os::vm_page_size()), _byte_map_size(0), _byte_map(nullptr), - _byte_map_base(nullptr), - _guard_region() + _byte_map_base(nullptr) { 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"); @@ -78,8 +77,7 @@ CardTable::CardTable(MemRegion whole_heap) : void CardTable::initialize(void* region0_start, void* region1_start) { size_t num_cards = cards_required(_whole_heap.word_size()); - // each card takes 1 byte; + 1 for the guard card - size_t num_bytes = num_cards + 1; + size_t num_bytes = num_cards * sizeof(CardValue); _byte_map_size = compute_byte_map_size(num_bytes); HeapWord* low_bound = _whole_heap.start(); @@ -107,10 +105,6 @@ void CardTable::initialize(void* region0_start, void* region1_start) { assert(byte_for(low_bound) == &_byte_map[0], "Checking start of map"); assert(byte_for(high_bound-1) <= &_byte_map[last_valid_index()], "Checking end of map"); - CardValue* guard_card = &_byte_map[num_cards]; - assert(is_aligned(guard_card, _page_size), "must be on its own OS page"); - _guard_region = MemRegion((HeapWord*)guard_card, _page_size); - initialize_covered_region(region0_start, region1_start); log_trace(gc, barrier)("CardTable::CardTable: "); diff --git a/src/hotspot/share/gc/shared/cardTable.hpp b/src/hotspot/share/gc/shared/cardTable.hpp index db6f9796ac1..13285be4fc5 100644 --- a/src/hotspot/share/gc/shared/cardTable.hpp +++ b/src/hotspot/share/gc/shared/cardTable.hpp @@ -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 @@ -59,9 +59,6 @@ protected: // The covered regions should be in address order. MemRegion _covered[max_covered_regions]; - // The last card is a guard card; never committed. - MemRegion _guard_region; - inline size_t compute_byte_map_size(size_t num_bytes); enum CardValues { diff --git a/src/hotspot/share/gc/shared/vmStructs_gc.hpp b/src/hotspot/share/gc/shared/vmStructs_gc.hpp index ae9843c31eb..d932b195695 100644 --- a/src/hotspot/share/gc/shared/vmStructs_gc.hpp +++ b/src/hotspot/share/gc/shared/vmStructs_gc.hpp @@ -89,7 +89,6 @@ 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, _guard_region, MemRegion) \ nonstatic_field(CardTable, _byte_map_base, CardTable::CardValue*) \ nonstatic_field(CardTableBarrierSet, _defer_initial_card_mark, bool) \ nonstatic_field(CardTableBarrierSet, _card_table, CardTable*) \