8323685: PrintSystemDictionaryAtExit has mutex rank assert
Co-authored-by: Thomas Schatzl <tschatzl@openjdk.org> Reviewed-by: tschatzl, ayang
This commit is contained in:
parent
6997bfc68d
commit
2865afe759
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2021, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2021, 2024, 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
|
||||
@ -286,7 +286,10 @@ public:
|
||||
size_t initial_log_table_size = InitialLogTableSize) :
|
||||
_inserted_card(false),
|
||||
_mm(mm),
|
||||
_table(mm, initial_log_table_size, false),
|
||||
_table(Mutex::service-1,
|
||||
mm,
|
||||
initial_log_table_size,
|
||||
false /* enable_statistics */),
|
||||
_table_scanner(&_table, BucketClaimSize) {
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, 2024, 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
|
||||
@ -84,8 +84,10 @@ class G1CodeRootSetHashTable : public CHeapObj<mtGC> {
|
||||
|
||||
public:
|
||||
G1CodeRootSetHashTable() :
|
||||
_table(Log2DefaultNumBuckets,
|
||||
HashTable::DEFAULT_MAX_SIZE_LOG2),
|
||||
_table(Mutex::service-1,
|
||||
nullptr,
|
||||
Log2DefaultNumBuckets,
|
||||
false /* enable_statistics */),
|
||||
_table_scanner(&_table, BucketClaimSize), _num_entries(0) {
|
||||
clear();
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2018, 2024, 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
|
||||
@ -26,6 +26,7 @@
|
||||
#define SHARE_UTILITIES_CONCURRENTHASHTABLE_HPP
|
||||
|
||||
#include "memory/allocation.hpp"
|
||||
#include "runtime/mutex.hpp"
|
||||
#include "utilities/globalCounter.hpp"
|
||||
#include "utilities/globalDefinitions.hpp"
|
||||
#include "utilities/growableArray.hpp"
|
||||
@ -406,10 +407,11 @@ class ConcurrentHashTable : public CHeapObj<F> {
|
||||
size_t log2size_limit = DEFAULT_MAX_SIZE_LOG2,
|
||||
size_t grow_hint = DEFAULT_GROW_HINT,
|
||||
bool enable_statistics = DEFAULT_ENABLE_STATISTICS,
|
||||
Mutex::Rank rank = Mutex::nosafepoint-2,
|
||||
void* context = nullptr);
|
||||
|
||||
explicit ConcurrentHashTable(void* context, size_t log2size = DEFAULT_START_SIZE_LOG2, bool enable_statistics = DEFAULT_ENABLE_STATISTICS) :
|
||||
ConcurrentHashTable(log2size, DEFAULT_MAX_SIZE_LOG2, DEFAULT_GROW_HINT, enable_statistics, context) {}
|
||||
explicit ConcurrentHashTable(Mutex::Rank rank, void* context, size_t log2size = DEFAULT_START_SIZE_LOG2, bool enable_statistics = DEFAULT_ENABLE_STATISTICS) :
|
||||
ConcurrentHashTable(log2size, DEFAULT_MAX_SIZE_LOG2, DEFAULT_GROW_HINT, enable_statistics, rank, context) {}
|
||||
|
||||
~ConcurrentHashTable();
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2018, 2024, 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
|
||||
@ -1012,7 +1012,7 @@ inline size_t ConcurrentHashTable<CONFIG, F>::
|
||||
// Constructor
|
||||
template <typename CONFIG, MEMFLAGS F>
|
||||
inline ConcurrentHashTable<CONFIG, F>::
|
||||
ConcurrentHashTable(size_t log2size, size_t log2size_limit, size_t grow_hint, bool enable_statistics, void* context)
|
||||
ConcurrentHashTable(size_t log2size, size_t log2size_limit, size_t grow_hint, bool enable_statistics, Mutex::Rank rank, void* context)
|
||||
: _context(context), _new_table(nullptr), _log2_size_limit(log2size_limit),
|
||||
_log2_start_size(log2size), _grow_hint(grow_hint),
|
||||
_size_limit_reached(false), _resize_lock_owner(nullptr),
|
||||
@ -1023,8 +1023,7 @@ ConcurrentHashTable(size_t log2size, size_t log2size_limit, size_t grow_hint, bo
|
||||
} else {
|
||||
_stats_rate = nullptr;
|
||||
}
|
||||
_resize_lock =
|
||||
new Mutex(Mutex::service-1, "ConcurrentHashTableResize_lock");
|
||||
_resize_lock = new Mutex(rank, "ConcurrentHashTableResize_lock");
|
||||
_table = new InternalTable(log2size);
|
||||
assert(log2size_limit >= log2size, "bad ergo");
|
||||
_size_limit_reached = _table->_log2_size == _log2_size_limit;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2018, 2024, 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
|
||||
@ -322,7 +322,7 @@ static void cht_reset_shrink(Thread* thr) {
|
||||
|
||||
Allocator mem_allocator;
|
||||
const uint initial_log_table_size = 4;
|
||||
CustomTestTable* cht = new CustomTestTable(&mem_allocator);
|
||||
CustomTestTable* cht = new CustomTestTable(Mutex::nosafepoint-2, &mem_allocator);
|
||||
|
||||
cht_insert_and_find(thr, cht, val1);
|
||||
cht_insert_and_find(thr, cht, val2);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2018, 2024, 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
|
||||
@ -23,17 +23,25 @@
|
||||
|
||||
import jdk.test.lib.process.ProcessTools;
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
import jdk.test.lib.Platform;
|
||||
|
||||
/*
|
||||
* @test PrintStringTableStatsTest
|
||||
* @bug 8211821
|
||||
* @test
|
||||
* @summary Test various printing functions in classfile directory
|
||||
* @bug 8211821 8323685
|
||||
* @requires vm.flagless
|
||||
* @library /test/lib
|
||||
* @run driver PrintStringTableStatsTest
|
||||
* @run driver ClassfilePrintingTests
|
||||
*/
|
||||
|
||||
public class PrintStringTableStatsTest {
|
||||
public static void main(String... args) throws Exception {
|
||||
class SampleClass {
|
||||
public static void main(java.lang.String[] unused) {
|
||||
System.out.println("Hello from the sample class");
|
||||
}
|
||||
}
|
||||
|
||||
public class ClassfilePrintingTests {
|
||||
private static void printStringTableStatsTest() throws Exception {
|
||||
ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(
|
||||
"-XX:+PrintStringTableStatistics",
|
||||
"--version");
|
||||
@ -41,4 +49,21 @@ public class PrintStringTableStatsTest {
|
||||
output.shouldContain("Number of buckets");
|
||||
output.shouldHaveExitValue(0);
|
||||
}
|
||||
|
||||
private static void printSystemDictionaryAtExitTest() throws Exception {
|
||||
ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(
|
||||
"-XX:+PrintSystemDictionaryAtExit",
|
||||
"SampleClass");
|
||||
OutputAnalyzer output = new OutputAnalyzer(pb.start());
|
||||
output.shouldContain(SampleClass.class.getName());
|
||||
output.shouldContain("jdk/internal/loader/ClassLoaders$AppClassLoader");
|
||||
output.shouldHaveExitValue(0);
|
||||
}
|
||||
|
||||
public static void main(String... args) throws Exception {
|
||||
printStringTableStatsTest();
|
||||
if (Platform.isDebugBuild()) {
|
||||
printSystemDictionaryAtExitTest();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user