8014405: G1: PerRegionTable::fl_mem_size() calculates size of the free list using wrong element sizes
Instead of using a simple sizeof(), ask the PerRegionTable class about its size when iterating over the free list. Reviewed-by: jwilhelm, brutisso
This commit is contained in:
parent
67fdf410da
commit
b33547e347
@ -242,11 +242,13 @@ public:
|
|||||||
PerRegionTable* cur = _free_list;
|
PerRegionTable* cur = _free_list;
|
||||||
size_t res = 0;
|
size_t res = 0;
|
||||||
while (cur != NULL) {
|
while (cur != NULL) {
|
||||||
res += sizeof(PerRegionTable);
|
res += cur->mem_size();
|
||||||
cur = cur->next();
|
cur = cur->next();
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void test_fl_mem_size();
|
||||||
};
|
};
|
||||||
|
|
||||||
PerRegionTable* PerRegionTable::_free_list = NULL;
|
PerRegionTable* PerRegionTable::_free_list = NULL;
|
||||||
@ -1149,6 +1151,19 @@ HeapRegionRemSet::finish_cleanup_task(HRRSCleanupTask* hrrs_cleanup_task) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifndef PRODUCT
|
#ifndef PRODUCT
|
||||||
|
void PerRegionTable::test_fl_mem_size() {
|
||||||
|
PerRegionTable* dummy = alloc(NULL);
|
||||||
|
free(dummy);
|
||||||
|
guarantee(dummy->mem_size() == fl_mem_size(), "fl_mem_size() does not return the correct element size");
|
||||||
|
// try to reset the state
|
||||||
|
_free_list = NULL;
|
||||||
|
delete dummy;
|
||||||
|
}
|
||||||
|
|
||||||
|
void HeapRegionRemSet::test_prt() {
|
||||||
|
PerRegionTable::test_fl_mem_size();
|
||||||
|
}
|
||||||
|
|
||||||
void HeapRegionRemSet::test() {
|
void HeapRegionRemSet::test() {
|
||||||
os::sleep(Thread::current(), (jlong)5000, false);
|
os::sleep(Thread::current(), (jlong)5000, false);
|
||||||
G1CollectedHeap* g1h = G1CollectedHeap::heap();
|
G1CollectedHeap* g1h = G1CollectedHeap::heap();
|
||||||
|
@ -338,6 +338,7 @@ public:
|
|||||||
|
|
||||||
// Run unit tests.
|
// Run unit tests.
|
||||||
#ifndef PRODUCT
|
#ifndef PRODUCT
|
||||||
|
static void test_prt();
|
||||||
static void test();
|
static void test();
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
@ -5015,6 +5015,9 @@ _JNI_IMPORT_OR_EXPORT_ jint JNICALL JNI_GetDefaultJavaVMInitArgs(void *args_) {
|
|||||||
#ifndef PRODUCT
|
#ifndef PRODUCT
|
||||||
|
|
||||||
#include "gc_interface/collectedHeap.hpp"
|
#include "gc_interface/collectedHeap.hpp"
|
||||||
|
#if INCLUDE_ALL_GCS
|
||||||
|
#include "gc_implementation/g1/heapRegionRemSet.hpp"
|
||||||
|
#endif
|
||||||
#include "utilities/quickSort.hpp"
|
#include "utilities/quickSort.hpp"
|
||||||
#if INCLUDE_VM_STRUCTS
|
#if INCLUDE_VM_STRUCTS
|
||||||
#include "runtime/vmStructs.hpp"
|
#include "runtime/vmStructs.hpp"
|
||||||
@ -5034,6 +5037,9 @@ void execute_internal_vm_tests() {
|
|||||||
run_unit_test(AltHashing::test_alt_hash());
|
run_unit_test(AltHashing::test_alt_hash());
|
||||||
#if INCLUDE_VM_STRUCTS
|
#if INCLUDE_VM_STRUCTS
|
||||||
run_unit_test(VMStructs::test());
|
run_unit_test(VMStructs::test());
|
||||||
|
#endif
|
||||||
|
#if INCLUDE_ALL_GCS
|
||||||
|
run_unit_test(HeapRegionRemSet::test_prt());
|
||||||
#endif
|
#endif
|
||||||
tty->print_cr("All internal VM tests passed");
|
tty->print_cr("All internal VM tests passed");
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user