Skip to content

Commit 06d46d6

Browse files
committed
8264008: Incorrect metaspace statistics after JEP 387 when UseCompressedClassPointers is off
Reviewed-by: stuefe
1 parent 45e1bab commit 06d46d6

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

src/hotspot/share/memory/metaspace.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,23 +71,23 @@ size_t MetaspaceUtils::used_words() {
7171
}
7272

7373
size_t MetaspaceUtils::used_words(Metaspace::MetadataType mdtype) {
74-
return Metaspace::is_class_space_allocation(mdtype) ? RunningCounters::used_words_class() : RunningCounters::used_words_nonclass();
74+
return mdtype == Metaspace::ClassType ? RunningCounters::used_words_class() : RunningCounters::used_words_nonclass();
7575
}
7676

7777
size_t MetaspaceUtils::reserved_words() {
7878
return RunningCounters::reserved_words();
7979
}
8080

8181
size_t MetaspaceUtils::reserved_words(Metaspace::MetadataType mdtype) {
82-
return Metaspace::is_class_space_allocation(mdtype) ? RunningCounters::reserved_words_class() : RunningCounters::reserved_words_nonclass();
82+
return mdtype == Metaspace::ClassType ? RunningCounters::reserved_words_class() : RunningCounters::reserved_words_nonclass();
8383
}
8484

8585
size_t MetaspaceUtils::committed_words() {
8686
return RunningCounters::committed_words();
8787
}
8888

8989
size_t MetaspaceUtils::committed_words(Metaspace::MetadataType mdtype) {
90-
return Metaspace::is_class_space_allocation(mdtype) ? RunningCounters::committed_words_class() : RunningCounters::committed_words_nonclass();
90+
return mdtype == Metaspace::ClassType ? RunningCounters::committed_words_class() : RunningCounters::committed_words_nonclass();
9191
}
9292

9393
void MetaspaceUtils::print_metaspace_change(const metaspace::MetaspaceSizesSnapshot& pre_meta_values) {

test/jdk/jdk/jfr/event/gc/heapsummary/TestHeapSummaryEventDefNewSerial.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2013, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -32,6 +32,17 @@
3232
* @library /test/lib /test/jdk
3333
* @run main/othervm -XX:+UseSerialGC jdk.jfr.event.gc.heapsummary.TestHeapSummaryEventDefNewSerial
3434
*/
35+
36+
/**
37+
* @test
38+
* @bug 8264008
39+
* @key jfr
40+
* @requires vm.hasJFR & vm.bits == 64
41+
* @requires vm.gc == "Serial" | vm.gc == null
42+
* @library /test/lib /test/jdk
43+
* @run main/othervm -XX:+UseSerialGC -XX:-UseCompressedClassPointers
44+
* jdk.jfr.event.gc.heapsummary.TestHeapSummaryEventDefNewSerial
45+
*/
3546
public class TestHeapSummaryEventDefNewSerial {
3647
public static void main(String[] args) throws Exception {
3748
HeapSummaryEventAllGcs.test(GCHelper.gcDefNew, GCHelper.gcSerialOld);

0 commit comments

Comments
 (0)