8264008: Incorrect metaspace statistics after JEP 387 when UseCompressedClassPointers is off

Reviewed-by: stuefe
This commit is contained in:
Jie Fu 2021-03-24 09:30:54 +00:00
parent 45e1bab87c
commit 06d46d6c0b
2 changed files with 15 additions and 4 deletions

View File

@ -71,7 +71,7 @@ size_t MetaspaceUtils::used_words() {
}
size_t MetaspaceUtils::used_words(Metaspace::MetadataType mdtype) {
return Metaspace::is_class_space_allocation(mdtype) ? RunningCounters::used_words_class() : RunningCounters::used_words_nonclass();
return mdtype == Metaspace::ClassType ? RunningCounters::used_words_class() : RunningCounters::used_words_nonclass();
}
size_t MetaspaceUtils::reserved_words() {
@ -79,7 +79,7 @@ size_t MetaspaceUtils::reserved_words() {
}
size_t MetaspaceUtils::reserved_words(Metaspace::MetadataType mdtype) {
return Metaspace::is_class_space_allocation(mdtype) ? RunningCounters::reserved_words_class() : RunningCounters::reserved_words_nonclass();
return mdtype == Metaspace::ClassType ? RunningCounters::reserved_words_class() : RunningCounters::reserved_words_nonclass();
}
size_t MetaspaceUtils::committed_words() {
@ -87,7 +87,7 @@ size_t MetaspaceUtils::committed_words() {
}
size_t MetaspaceUtils::committed_words(Metaspace::MetadataType mdtype) {
return Metaspace::is_class_space_allocation(mdtype) ? RunningCounters::committed_words_class() : RunningCounters::committed_words_nonclass();
return mdtype == Metaspace::ClassType ? RunningCounters::committed_words_class() : RunningCounters::committed_words_nonclass();
}
void MetaspaceUtils::print_metaspace_change(const metaspace::MetaspaceSizesSnapshot& pre_meta_values) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2021, 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
@ -32,6 +32,17 @@ import jdk.test.lib.jfr.GCHelper;
* @library /test/lib /test/jdk
* @run main/othervm -XX:+UseSerialGC jdk.jfr.event.gc.heapsummary.TestHeapSummaryEventDefNewSerial
*/
/**
* @test
* @bug 8264008
* @key jfr
* @requires vm.hasJFR & vm.bits == 64
* @requires vm.gc == "Serial" | vm.gc == null
* @library /test/lib /test/jdk
* @run main/othervm -XX:+UseSerialGC -XX:-UseCompressedClassPointers
* jdk.jfr.event.gc.heapsummary.TestHeapSummaryEventDefNewSerial
*/
public class TestHeapSummaryEventDefNewSerial {
public static void main(String[] args) throws Exception {
HeapSummaryEventAllGcs.test(GCHelper.gcDefNew, GCHelper.gcSerialOld);