Skip to content

Commit 357947a

Browse files
committed
8270061: Change parameter order of ResourceHashtable
Reviewed-by: coleenp, stuefe
1 parent 034788a commit 357947a

18 files changed

+49
-73
lines changed

src/hotspot/share/cds/dumpTimeClassInfo.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,10 +171,10 @@ inline unsigned DumpTimeSharedClassTable_hash(InstanceKlass* const& k) {
171171
class DumpTimeSharedClassTable: public ResourceHashtable<
172172
InstanceKlass*,
173173
DumpTimeClassInfo,
174-
&DumpTimeSharedClassTable_hash,
175-
primitive_equals<InstanceKlass*>,
176174
15889, // prime number
177-
ResourceObj::C_HEAP>
175+
ResourceObj::C_HEAP,
176+
mtClassShared,
177+
&DumpTimeSharedClassTable_hash>
178178
{
179179
int _builtin_count;
180180
int _unregistered_count;

src/hotspot/share/cds/heapShared.hpp

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -148,37 +148,30 @@ class HeapShared: AllStatic {
148148
static DumpedInternedStrings *_dumped_interned_strings;
149149

150150
public:
151-
static bool oop_equals(oop const& p1, oop const& p2) {
152-
return p1 == p2;
153-
}
154151
static unsigned oop_hash(oop const& p);
155152
static unsigned string_oop_hash(oop const& string) {
156153
return java_lang_String::hash_code(string);
157154
}
158155

159156
private:
160157
typedef ResourceHashtable<oop, oop,
161-
HeapShared::oop_hash,
162-
HeapShared::oop_equals,
163158
15889, // prime number
164-
ResourceObj::C_HEAP> ArchivedObjectCache;
159+
ResourceObj::C_HEAP,
160+
mtClassShared,
161+
HeapShared::oop_hash> ArchivedObjectCache;
165162
static ArchivedObjectCache* _archived_object_cache;
166163

167-
static bool klass_equals(Klass* const& p1, Klass* const& p2) {
168-
return primitive_equals<Klass*>(p1, p2);
169-
}
170-
171164
static unsigned klass_hash(Klass* const& klass) {
172165
// Generate deterministic hashcode even if SharedBaseAddress is changed due to ASLR.
173166
return primitive_hash<address>(address(klass) - SharedBaseAddress);
174167
}
175168

176169
class DumpTimeKlassSubGraphInfoTable
177170
: public ResourceHashtable<Klass*, KlassSubGraphInfo,
178-
HeapShared::klass_hash,
179-
HeapShared::klass_equals,
180171
137, // prime number
181-
ResourceObj::C_HEAP> {
172+
ResourceObj::C_HEAP,
173+
mtClassShared,
174+
HeapShared::klass_hash> {
182175
public:
183176
int _count;
184177
};
@@ -230,10 +223,10 @@ class HeapShared: AllStatic {
230223
static int _narrow_oop_shift;
231224

232225
typedef ResourceHashtable<oop, bool,
233-
HeapShared::oop_hash,
234-
HeapShared::oop_equals,
235226
15889, // prime number
236-
ResourceObj::C_HEAP> SeenObjectsTable;
227+
ResourceObj::C_HEAP,
228+
mtClassShared,
229+
HeapShared::oop_hash> SeenObjectsTable;
237230

238231
static SeenObjectsTable *_seen_objects_table;
239232

@@ -400,10 +393,10 @@ class HeapShared: AllStatic {
400393
#if INCLUDE_CDS_JAVA_HEAP
401394
class DumpedInternedStrings :
402395
public ResourceHashtable<oop, bool,
403-
HeapShared::string_oop_hash,
404-
HeapShared::oop_equals,
405396
15889, // prime number
406-
ResourceObj::C_HEAP>
397+
ResourceObj::C_HEAP,
398+
mtClassShared,
399+
HeapShared::string_oop_hash>
407400
{};
408401
#endif
409402

src/hotspot/share/cds/lambdaProxyClassDictionary.hpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,10 +156,11 @@ class RunTimeLambdaProxyClassInfo {
156156
class DumpTimeLambdaProxyClassDictionary
157157
: public ResourceHashtable<LambdaProxyClassKey,
158158
DumpTimeLambdaProxyClassInfo,
159-
LambdaProxyClassKey::DUMPTIME_HASH,
160-
LambdaProxyClassKey::DUMPTIME_EQUALS,
161159
137, // prime number
162-
ResourceObj::C_HEAP> {
160+
ResourceObj::C_HEAP,
161+
mtClassShared,
162+
LambdaProxyClassKey::DUMPTIME_HASH,
163+
LambdaProxyClassKey::DUMPTIME_EQUALS> {
163164
public:
164165
DumpTimeLambdaProxyClassDictionary() : _count(0) {}
165166
int _count;

src/hotspot/share/classfile/bytecodeAssembler.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2012, 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
@@ -125,6 +125,7 @@ class BytecodeCPEntry {
125125
class BytecodeConstantPool : ResourceObj {
126126
private:
127127
typedef ResourceHashtable<BytecodeCPEntry, u2,
128+
256, ResourceObj::RESOURCE_AREA, mtInternal,
128129
&BytecodeCPEntry::hash, &BytecodeCPEntry::equals> IndexHash;
129130

130131
ConstantPool* _orig;

src/hotspot/share/classfile/classFileParser.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2117,6 +2117,7 @@ void ClassFileParser::copy_localvariable_table(const ConstMethod* cm,
21172117
ResourceMark rm(THREAD);
21182118

21192119
typedef ResourceHashtable<LocalVariableTableElement, LocalVariableTableElement*,
2120+
256, ResourceObj::RESOURCE_AREA, mtInternal,
21202121
&LVT_Hash::hash, &LVT_Hash::equals> LVT_HashTable;
21212122

21222123
LVT_HashTable* const table = new LVT_HashTable();

src/hotspot/share/classfile/classLoaderStats.hpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,6 @@ class ClassLoaderStats : public ResourceObj {
9797

9898
class ClassLoaderStatsClosure : public CLDClosure {
9999
protected:
100-
static bool oop_equals(oop const& s1, oop const& s2) {
101-
return s1 == s2;
102-
}
103-
104100
static unsigned oop_hash(oop const& s1) {
105101
// Robert Jenkins 1996 & Thomas Wang 1997
106102
// http://web.archive.org/web/20071223173210/http://www.concentric.net/~Ttwang/tech/inthash.htm
@@ -116,7 +112,8 @@ class ClassLoaderStatsClosure : public CLDClosure {
116112
}
117113

118114
typedef ResourceHashtable<oop, ClassLoaderStats,
119-
ClassLoaderStatsClosure::oop_hash, ClassLoaderStatsClosure::oop_equals> StatsTable;
115+
256, ResourceObj::RESOURCE_AREA, mtInternal,
116+
ClassLoaderStatsClosure::oop_hash> StatsTable;
120117

121118
outputStream* _out;
122119
StatsTable* _stats;

src/hotspot/share/classfile/moduleEntry.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,8 +372,6 @@ void ModuleEntry::set_loader_data(ClassLoaderData* cld) {
372372
typedef ResourceHashtable<
373373
const ModuleEntry*,
374374
ModuleEntry*,
375-
primitive_hash<const ModuleEntry*>,
376-
primitive_equals<const ModuleEntry*>,
377375
557, // prime number
378376
ResourceObj::C_HEAP> ArchivedModuleEntries;
379377
static ArchivedModuleEntries* _archive_modules_entries = NULL;

src/hotspot/share/classfile/packageEntry.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,6 @@ PackageEntryTable::~PackageEntryTable() {
197197
typedef ResourceHashtable<
198198
const PackageEntry*,
199199
PackageEntry*,
200-
primitive_hash<const PackageEntry*>,
201-
primitive_equals<const PackageEntry*>,
202200
557, // prime number
203201
ResourceObj::C_HEAP> ArchivedPackageEntries;
204202
static ArchivedPackageEntries* _archived_packages_entries = NULL;

src/hotspot/share/classfile/systemDictionaryShared.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -424,8 +424,6 @@ InstanceKlass* SystemDictionaryShared::find_or_load_shared_class(
424424

425425
class UnregisteredClassesTable : public ResourceHashtable<
426426
Symbol*, InstanceKlass*,
427-
primitive_hash<Symbol*>,
428-
primitive_equals<Symbol*>,
429427
15889, // prime number
430428
ResourceObj::C_HEAP> {};
431429

src/hotspot/share/classfile/verifier.hpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1998, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1998, 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
@@ -271,8 +271,7 @@ class sig_as_verification_types : public ResourceObj {
271271

272272
// This hashtable is indexed by the Utf8 constant pool indexes pointed to
273273
// by constant pool (Interface)Method_refs' NameAndType signature entries.
274-
typedef ResourceHashtable<int, sig_as_verification_types*,
275-
primitive_hash<int>, primitive_equals<int>, 1007>
274+
typedef ResourceHashtable<int, sig_as_verification_types*, 1007>
276275
method_signatures_table_type;
277276

278277
// A new instance of this class is created for each class being verified

0 commit comments

Comments
 (0)