8220590: ZGC: Remove ZPages from ZPageTable when freed
Reviewed-by: stefank, eosterlund
This commit is contained in:
parent
b29bc9f1da
commit
e7cfe60a32
@ -221,7 +221,7 @@ void ZHeap::out_of_memory() {
|
||||
ZPage* ZHeap::alloc_page(uint8_t type, size_t size, ZAllocationFlags flags) {
|
||||
ZPage* const page = _page_allocator.alloc_page(type, size, flags);
|
||||
if (page != NULL) {
|
||||
// Update page table
|
||||
// Insert page table entry
|
||||
_page_table.insert(page);
|
||||
}
|
||||
|
||||
@ -239,6 +239,10 @@ void ZHeap::undo_alloc_page(ZPage* page) {
|
||||
}
|
||||
|
||||
void ZHeap::free_page(ZPage* page, bool reclaimed) {
|
||||
// Remove page table entry
|
||||
_page_table.remove(page);
|
||||
|
||||
// Free page
|
||||
_page_allocator.free_page(page, reclaimed);
|
||||
}
|
||||
|
||||
@ -406,9 +410,6 @@ void ZHeap::destroy_detached_pages() {
|
||||
_page_allocator.flush_detached_pages(&list);
|
||||
|
||||
for (ZPage* page = list.remove_first(); page != NULL; page = list.remove_first()) {
|
||||
// Remove page table entry
|
||||
_page_table.remove(page);
|
||||
|
||||
// Delete the page
|
||||
_page_allocator.destroy_page(page);
|
||||
}
|
||||
|
@ -36,16 +36,12 @@ void ZPageTable::insert(ZPage* page) {
|
||||
const uintptr_t addr = ZAddress::good(page->start());
|
||||
const size_t size = page->size();
|
||||
|
||||
// Cached pages stays in the page table.
|
||||
// Don't re-insert if it's already present.
|
||||
if (get(addr) == NULL) {
|
||||
// Make sure a newly created page is
|
||||
// visible before updating the page table.
|
||||
OrderAccess::storestore();
|
||||
_map.put(addr, size, page);
|
||||
}
|
||||
// Make sure a newly created page is
|
||||
// visible before updating the page table.
|
||||
OrderAccess::storestore();
|
||||
|
||||
assert(get(addr) == page, "Invalid entry");
|
||||
assert(get(addr) == NULL, "Invalid entry");
|
||||
_map.put(addr, size, page);
|
||||
}
|
||||
|
||||
void ZPageTable::remove(ZPage* page) {
|
||||
|
Loading…
Reference in New Issue
Block a user