8279573: compiler/codecache/CodeCacheFullCountTest.java fails with "RuntimeException: the value of full_count is wrong."

Reviewed-by: thartmann, eosterlund
This commit is contained in:
Coleen Phillimore 2022-03-01 15:28:21 +00:00
parent 31b61f982c
commit 76398c8400
3 changed files with 8 additions and 7 deletions

View File

@ -1238,9 +1238,9 @@ void CodeCache::report_codemem_full(int code_blob_type, bool print) {
CodeHeap* heap = get_code_heap(code_blob_type);
assert(heap != NULL, "heap is null");
heap->report_full();
int full_count = heap->report_full();
if ((heap->full_count() == 1) || print) {
if ((full_count == 1) || print) {
// Not yet reported for this heap, report
if (SegmentedCodeCache) {
ResourceMark rm;
@ -1277,7 +1277,7 @@ void CodeCache::report_codemem_full(int code_blob_type, bool print) {
tty->print("%s", s.as_string());
}
if (heap->full_count() == 1) {
if (full_count == 1) {
if (PrintCodeHeapAnalytics) {
CompileBroker::print_heapinfo(tty, "all", 4096); // details, may be a lot!
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2022, 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
@ -28,6 +28,7 @@
#include "code/codeBlob.hpp"
#include "memory/allocation.hpp"
#include "memory/virtualspace.hpp"
#include "runtime/atomic.hpp"
#include "utilities/macros.hpp"
// Blocks
@ -216,7 +217,7 @@ class CodeHeap : public CHeapObj<mtCode> {
int adapter_count() { return _adapter_count; }
void set_adapter_count(int count) { _adapter_count = count; }
int full_count() { return _full_count; }
void report_full() { _full_count++; }
int report_full() { return Atomic::add(&_full_count, 1); }
private:
size_t heap_unallocated_capacity() const;

View File

@ -55,7 +55,7 @@ public class CodeCacheFullCountTest {
public static void runTest() throws Throwable {
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
"-XX:ReservedCodeCacheSize=2496k", "-XX:-UseCodeCacheFlushing", "CodeCacheFullCountTest", "WasteCodeCache");
"-XX:ReservedCodeCacheSize=2496k", "-XX:-UseCodeCacheFlushing", "-XX:-MethodFlushing", "CodeCacheFullCountTest", "WasteCodeCache");
OutputAnalyzer oa = ProcessTools.executeProcess(pb);
oa.shouldHaveExitValue(0);
String stdout = oa.getStdout();
@ -64,7 +64,7 @@ public class CodeCacheFullCountTest {
Matcher stdoutMatcher = pattern.matcher(stdout);
if (stdoutMatcher.find()) {
int fullCount = Integer.parseInt(stdoutMatcher.group(1));
if (fullCount != 1) {
if (fullCount == 0) {
throw new RuntimeException("the value of full_count is wrong.");
}
} else {