8270061: Change parameter order of ResourceHashtable
Reviewed-by: coleenp, stuefe
This commit is contained in:
parent
034788a02c
commit
357947acd8
@ -171,10 +171,10 @@ inline unsigned DumpTimeSharedClassTable_hash(InstanceKlass* const& k) {
|
||||
class DumpTimeSharedClassTable: public ResourceHashtable<
|
||||
InstanceKlass*,
|
||||
DumpTimeClassInfo,
|
||||
&DumpTimeSharedClassTable_hash,
|
||||
primitive_equals<InstanceKlass*>,
|
||||
15889, // prime number
|
||||
ResourceObj::C_HEAP>
|
||||
ResourceObj::C_HEAP,
|
||||
mtClassShared,
|
||||
&DumpTimeSharedClassTable_hash>
|
||||
{
|
||||
int _builtin_count;
|
||||
int _unregistered_count;
|
||||
|
@ -148,9 +148,6 @@ class HeapShared: AllStatic {
|
||||
static DumpedInternedStrings *_dumped_interned_strings;
|
||||
|
||||
public:
|
||||
static bool oop_equals(oop const& p1, oop const& p2) {
|
||||
return p1 == p2;
|
||||
}
|
||||
static unsigned oop_hash(oop const& p);
|
||||
static unsigned string_oop_hash(oop const& string) {
|
||||
return java_lang_String::hash_code(string);
|
||||
@ -158,16 +155,12 @@ public:
|
||||
|
||||
private:
|
||||
typedef ResourceHashtable<oop, oop,
|
||||
HeapShared::oop_hash,
|
||||
HeapShared::oop_equals,
|
||||
15889, // prime number
|
||||
ResourceObj::C_HEAP> ArchivedObjectCache;
|
||||
ResourceObj::C_HEAP,
|
||||
mtClassShared,
|
||||
HeapShared::oop_hash> ArchivedObjectCache;
|
||||
static ArchivedObjectCache* _archived_object_cache;
|
||||
|
||||
static bool klass_equals(Klass* const& p1, Klass* const& p2) {
|
||||
return primitive_equals<Klass*>(p1, p2);
|
||||
}
|
||||
|
||||
static unsigned klass_hash(Klass* const& klass) {
|
||||
// Generate deterministic hashcode even if SharedBaseAddress is changed due to ASLR.
|
||||
return primitive_hash<address>(address(klass) - SharedBaseAddress);
|
||||
@ -175,10 +168,10 @@ private:
|
||||
|
||||
class DumpTimeKlassSubGraphInfoTable
|
||||
: public ResourceHashtable<Klass*, KlassSubGraphInfo,
|
||||
HeapShared::klass_hash,
|
||||
HeapShared::klass_equals,
|
||||
137, // prime number
|
||||
ResourceObj::C_HEAP> {
|
||||
ResourceObj::C_HEAP,
|
||||
mtClassShared,
|
||||
HeapShared::klass_hash> {
|
||||
public:
|
||||
int _count;
|
||||
};
|
||||
@ -230,10 +223,10 @@ private:
|
||||
static int _narrow_oop_shift;
|
||||
|
||||
typedef ResourceHashtable<oop, bool,
|
||||
HeapShared::oop_hash,
|
||||
HeapShared::oop_equals,
|
||||
15889, // prime number
|
||||
ResourceObj::C_HEAP> SeenObjectsTable;
|
||||
ResourceObj::C_HEAP,
|
||||
mtClassShared,
|
||||
HeapShared::oop_hash> SeenObjectsTable;
|
||||
|
||||
static SeenObjectsTable *_seen_objects_table;
|
||||
|
||||
@ -400,10 +393,10 @@ private:
|
||||
#if INCLUDE_CDS_JAVA_HEAP
|
||||
class DumpedInternedStrings :
|
||||
public ResourceHashtable<oop, bool,
|
||||
HeapShared::string_oop_hash,
|
||||
HeapShared::oop_equals,
|
||||
15889, // prime number
|
||||
ResourceObj::C_HEAP>
|
||||
ResourceObj::C_HEAP,
|
||||
mtClassShared,
|
||||
HeapShared::string_oop_hash>
|
||||
{};
|
||||
#endif
|
||||
|
||||
|
@ -156,10 +156,11 @@ public:
|
||||
class DumpTimeLambdaProxyClassDictionary
|
||||
: public ResourceHashtable<LambdaProxyClassKey,
|
||||
DumpTimeLambdaProxyClassInfo,
|
||||
LambdaProxyClassKey::DUMPTIME_HASH,
|
||||
LambdaProxyClassKey::DUMPTIME_EQUALS,
|
||||
137, // prime number
|
||||
ResourceObj::C_HEAP> {
|
||||
ResourceObj::C_HEAP,
|
||||
mtClassShared,
|
||||
LambdaProxyClassKey::DUMPTIME_HASH,
|
||||
LambdaProxyClassKey::DUMPTIME_EQUALS> {
|
||||
public:
|
||||
DumpTimeLambdaProxyClassDictionary() : _count(0) {}
|
||||
int _count;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 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
|
||||
@ -125,6 +125,7 @@ class BytecodeCPEntry {
|
||||
class BytecodeConstantPool : ResourceObj {
|
||||
private:
|
||||
typedef ResourceHashtable<BytecodeCPEntry, u2,
|
||||
256, ResourceObj::RESOURCE_AREA, mtInternal,
|
||||
&BytecodeCPEntry::hash, &BytecodeCPEntry::equals> IndexHash;
|
||||
|
||||
ConstantPool* _orig;
|
||||
|
@ -2117,6 +2117,7 @@ void ClassFileParser::copy_localvariable_table(const ConstMethod* cm,
|
||||
ResourceMark rm(THREAD);
|
||||
|
||||
typedef ResourceHashtable<LocalVariableTableElement, LocalVariableTableElement*,
|
||||
256, ResourceObj::RESOURCE_AREA, mtInternal,
|
||||
&LVT_Hash::hash, &LVT_Hash::equals> LVT_HashTable;
|
||||
|
||||
LVT_HashTable* const table = new LVT_HashTable();
|
||||
|
@ -97,10 +97,6 @@ public:
|
||||
|
||||
class ClassLoaderStatsClosure : public CLDClosure {
|
||||
protected:
|
||||
static bool oop_equals(oop const& s1, oop const& s2) {
|
||||
return s1 == s2;
|
||||
}
|
||||
|
||||
static unsigned oop_hash(oop const& s1) {
|
||||
// Robert Jenkins 1996 & Thomas Wang 1997
|
||||
// http://web.archive.org/web/20071223173210/http://www.concentric.net/~Ttwang/tech/inthash.htm
|
||||
@ -116,7 +112,8 @@ protected:
|
||||
}
|
||||
|
||||
typedef ResourceHashtable<oop, ClassLoaderStats,
|
||||
ClassLoaderStatsClosure::oop_hash, ClassLoaderStatsClosure::oop_equals> StatsTable;
|
||||
256, ResourceObj::RESOURCE_AREA, mtInternal,
|
||||
ClassLoaderStatsClosure::oop_hash> StatsTable;
|
||||
|
||||
outputStream* _out;
|
||||
StatsTable* _stats;
|
||||
|
@ -372,8 +372,6 @@ void ModuleEntry::set_loader_data(ClassLoaderData* cld) {
|
||||
typedef ResourceHashtable<
|
||||
const ModuleEntry*,
|
||||
ModuleEntry*,
|
||||
primitive_hash<const ModuleEntry*>,
|
||||
primitive_equals<const ModuleEntry*>,
|
||||
557, // prime number
|
||||
ResourceObj::C_HEAP> ArchivedModuleEntries;
|
||||
static ArchivedModuleEntries* _archive_modules_entries = NULL;
|
||||
|
@ -197,8 +197,6 @@ PackageEntryTable::~PackageEntryTable() {
|
||||
typedef ResourceHashtable<
|
||||
const PackageEntry*,
|
||||
PackageEntry*,
|
||||
primitive_hash<const PackageEntry*>,
|
||||
primitive_equals<const PackageEntry*>,
|
||||
557, // prime number
|
||||
ResourceObj::C_HEAP> ArchivedPackageEntries;
|
||||
static ArchivedPackageEntries* _archived_packages_entries = NULL;
|
||||
|
@ -424,8 +424,6 @@ InstanceKlass* SystemDictionaryShared::find_or_load_shared_class(
|
||||
|
||||
class UnregisteredClassesTable : public ResourceHashtable<
|
||||
Symbol*, InstanceKlass*,
|
||||
primitive_hash<Symbol*>,
|
||||
primitive_equals<Symbol*>,
|
||||
15889, // prime number
|
||||
ResourceObj::C_HEAP> {};
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 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
|
||||
@ -271,8 +271,7 @@ class sig_as_verification_types : public ResourceObj {
|
||||
|
||||
// This hashtable is indexed by the Utf8 constant pool indexes pointed to
|
||||
// by constant pool (Interface)Method_refs' NameAndType signature entries.
|
||||
typedef ResourceHashtable<int, sig_as_verification_types*,
|
||||
primitive_hash<int>, primitive_equals<int>, 1007>
|
||||
typedef ResourceHashtable<int, sig_as_verification_types*, 1007>
|
||||
method_signatures_table_type;
|
||||
|
||||
// A new instance of this class is created for each class being verified
|
||||
|
@ -2227,8 +2227,10 @@ void nmethod::check_all_dependencies(DepChange& changes) {
|
||||
// Turn off dependency tracing while actually testing dependencies.
|
||||
NOT_PRODUCT( FlagSetting fs(TraceDependencies, false) );
|
||||
|
||||
typedef ResourceHashtable<DependencySignature, int, &DependencySignature::hash,
|
||||
&DependencySignature::equals, 11027> DepTable;
|
||||
typedef ResourceHashtable<DependencySignature, int, 11027,
|
||||
ResourceObj::RESOURCE_AREA, mtInternal,
|
||||
&DependencySignature::hash,
|
||||
&DependencySignature::equals> DepTable;
|
||||
|
||||
DepTable* table = new DepTable();
|
||||
|
||||
|
@ -166,12 +166,6 @@ class decode_env {
|
||||
};
|
||||
Link *head, *tail;
|
||||
|
||||
static unsigned hash(const address& a) {
|
||||
return primitive_hash<address>(a);
|
||||
}
|
||||
static bool equals(const address& a0, const address& a1) {
|
||||
return primitive_equals<address>(a0, a1);
|
||||
}
|
||||
void append(const char* file, int line) {
|
||||
if (tail != NULL && tail->file == file && tail->line == line) {
|
||||
// Don't print duplicated lines at the same address. This could happen with C
|
||||
@ -193,8 +187,6 @@ class decode_env {
|
||||
|
||||
typedef ResourceHashtable<
|
||||
address, SourceFileInfo,
|
||||
SourceFileInfo::hash,
|
||||
SourceFileInfo::equals,
|
||||
15889, // prime number
|
||||
ResourceObj::C_HEAP> SourceFileInfoTable;
|
||||
|
||||
|
@ -286,7 +286,9 @@ JVMCIObjectArray CompilerToVM::initialize_intrinsics(JVMCI_TRAPS) {
|
||||
jobjectArray readConfiguration0(JNIEnv *env, JVMCI_TRAPS) {
|
||||
JavaThread* THREAD = JavaThread::current(); // For exception macros.
|
||||
ResourceHashtable<jlong, JVMCIObject> longs;
|
||||
ResourceHashtable<const char*, JVMCIObject, &CompilerToVM::cstring_hash, &CompilerToVM::cstring_equals> strings;
|
||||
ResourceHashtable<const char*, JVMCIObject,
|
||||
256, ResourceObj::RESOURCE_AREA, mtInternal,
|
||||
&CompilerToVM::cstring_hash, &CompilerToVM::cstring_equals> strings;
|
||||
|
||||
jvalue prim;
|
||||
prim.z = true; JVMCIObject boxedTrue = JVMCIENV->create_box(T_BOOLEAN, &prim, JVMCI_CHECK_NULL);
|
||||
|
@ -110,8 +110,6 @@ public:
|
||||
typedef LinkedListDeque<AsyncLogMessage, mtLogging> AsyncLogBuffer;
|
||||
typedef ResourceHashtable<LogFileOutput*,
|
||||
uint32_t,
|
||||
primitive_hash<LogFileOutput*>,
|
||||
primitive_equals<LogFileOutput*>,
|
||||
17, /*table_size*/
|
||||
ResourceObj::C_HEAP,
|
||||
mtLogging> AsyncLogMap;
|
||||
|
@ -183,10 +183,6 @@ inline ThreadsList* ThreadsSMRSupport::xchg_java_thread_list(ThreadsList* new_li
|
||||
//
|
||||
class ThreadScanHashtable : public CHeapObj<mtThread> {
|
||||
private:
|
||||
static bool ptr_equals(void * const& s1, void * const& s2) {
|
||||
return s1 == s2;
|
||||
}
|
||||
|
||||
static unsigned int ptr_hash(void * const& s1) {
|
||||
// 2654435761 = 2^32 * Phi (golden ratio)
|
||||
return (unsigned int)(((uint32_t)(uintptr_t)s1) * 2654435761u);
|
||||
@ -194,9 +190,9 @@ class ThreadScanHashtable : public CHeapObj<mtThread> {
|
||||
|
||||
// ResourceHashtable SIZE is specified at compile time so we
|
||||
// use 1031 which is the first prime after 1024.
|
||||
typedef ResourceHashtable<void *, int, &ThreadScanHashtable::ptr_hash,
|
||||
&ThreadScanHashtable::ptr_equals, 1031,
|
||||
ResourceObj::C_HEAP, mtThread> PtrTable;
|
||||
typedef ResourceHashtable<void *, int, 1031,
|
||||
ResourceObj::C_HEAP, mtThread,
|
||||
&ThreadScanHashtable::ptr_hash> PtrTable;
|
||||
PtrTable * _ptrs;
|
||||
|
||||
public:
|
||||
|
@ -78,11 +78,11 @@ template<
|
||||
>
|
||||
class ResizeableResourceHashtable : public ResourceHashtableBase<
|
||||
ResizeableResourceHashtableStorage<K, V, ALLOC_TYPE, MEM_TYPE>,
|
||||
K, V, HASH, EQUALS, ALLOC_TYPE, MEM_TYPE> {
|
||||
K, V, ALLOC_TYPE, MEM_TYPE, HASH, EQUALS> {
|
||||
unsigned _max_size;
|
||||
|
||||
using BASE = ResourceHashtableBase<ResizeableResourceHashtableStorage<K, V, ALLOC_TYPE, MEM_TYPE>,
|
||||
K, V, HASH, EQUALS, ALLOC_TYPE, MEM_TYPE>;
|
||||
K, V, ALLOC_TYPE, MEM_TYPE, HASH, EQUALS>;
|
||||
using Node = ResourceHashtableNode<K, V>;
|
||||
NONCOPYABLE(ResizeableResourceHashtable);
|
||||
public:
|
||||
|
@ -46,10 +46,10 @@ public:
|
||||
template<
|
||||
class STORAGE,
|
||||
typename K, typename V,
|
||||
unsigned (*HASH) (K const&),
|
||||
bool (*EQUALS)(K const&, K const&),
|
||||
ResourceObj::allocation_type ALLOC_TYPE,
|
||||
MEMFLAGS MEM_TYPE
|
||||
MEMFLAGS MEM_TYPE,
|
||||
unsigned (*HASH) (K const&),
|
||||
bool (*EQUALS)(K const&, K const&)
|
||||
>
|
||||
class ResourceHashtableBase : public STORAGE {
|
||||
using Node = ResourceHashtableNode<K, V>;
|
||||
@ -232,19 +232,19 @@ protected:
|
||||
|
||||
template<
|
||||
typename K, typename V,
|
||||
unsigned (*HASH) (K const&) = primitive_hash<K>,
|
||||
bool (*EQUALS)(K const&, K const&) = primitive_equals<K>,
|
||||
unsigned SIZE = 256,
|
||||
ResourceObj::allocation_type ALLOC_TYPE = ResourceObj::RESOURCE_AREA,
|
||||
MEMFLAGS MEM_TYPE = mtInternal
|
||||
MEMFLAGS MEM_TYPE = mtInternal,
|
||||
unsigned (*HASH) (K const&) = primitive_hash<K>,
|
||||
bool (*EQUALS)(K const&, K const&) = primitive_equals<K>
|
||||
>
|
||||
class ResourceHashtable : public ResourceHashtableBase<
|
||||
FixedResourceHashtableStorage<SIZE, K, V>,
|
||||
K, V, HASH, EQUALS, ALLOC_TYPE, MEM_TYPE> {
|
||||
K, V, ALLOC_TYPE, MEM_TYPE, HASH, EQUALS> {
|
||||
NONCOPYABLE(ResourceHashtable);
|
||||
public:
|
||||
ResourceHashtable() : ResourceHashtableBase<FixedResourceHashtableStorage<SIZE, K, V>,
|
||||
K, V, HASH, EQUALS, ALLOC_TYPE, MEM_TYPE>() {}
|
||||
K, V, ALLOC_TYPE, MEM_TYPE, HASH, EQUALS>() {}
|
||||
};
|
||||
|
||||
#endif // SHARE_UTILITIES_RESOURCEHASH_HPP
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 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
|
||||
@ -76,7 +76,7 @@ class SmallResourceHashtableTest : public CommonResourceHashtableTest {
|
||||
|
||||
static void test(V step) {
|
||||
EqualityTestIter et;
|
||||
ResourceHashtable<K, V, HASH, EQUALS, SIZE, ALLOC_TYPE, MEM_TYPE> rh;
|
||||
ResourceHashtable<K, V, SIZE, ALLOC_TYPE, MEM_TYPE, HASH, EQUALS> rh;
|
||||
|
||||
ASSERT_FALSE(rh.contains(as_K(step)));
|
||||
|
||||
@ -208,7 +208,7 @@ class GenericResourceHashtableTest : public CommonResourceHashtableTest {
|
||||
|
||||
static void test(unsigned num_elements = SIZE) {
|
||||
EqualityTestIter et;
|
||||
ResourceHashtable<K, V, HASH, EQUALS, SIZE, ALLOC_TYPE, MEM_TYPE> rh;
|
||||
ResourceHashtable<K, V, SIZE, ALLOC_TYPE, MEM_TYPE, HASH, EQUALS> rh;
|
||||
|
||||
for (uintptr_t i = 0; i < num_elements; ++i) {
|
||||
ASSERT_TRUE(rh.put(as_K(i), i));
|
||||
|
Loading…
x
Reference in New Issue
Block a user