author | coleenp |
Thu, 13 Apr 2017 09:42:10 -0400 | |
changeset 46382 | 5520c435279b |
parent 46380 | 4a51438196cf |
child 46475 | 75902cea18af |
permissions | -rw-r--r-- |
1 | 1 |
/* |
46274
534d019edb92
8175104: Unhandled oop in ProtectionDomainCacheTable::compute_hash
coleenp
parents:
42073
diff
changeset
|
2 |
* Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved. |
1 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. |
|
8 |
* |
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
13 |
* accompanied this code). |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License version |
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 |
* |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
5420
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
5420
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
5420
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
7397 | 25 |
#ifndef SHARE_VM_CLASSFILE_DICTIONARY_HPP |
26 |
#define SHARE_VM_CLASSFILE_DICTIONARY_HPP |
|
27 |
||
46382
5520c435279b
8178336: Unnecessary SystemDictionary walk for Protection domain liveness
coleenp
parents:
46380
diff
changeset
|
28 |
#include "classfile/protectionDomainCache.hpp" |
7397 | 29 |
#include "classfile/systemDictionary.hpp" |
30 |
#include "oops/instanceKlass.hpp" |
|
29081
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
26181
diff
changeset
|
31 |
#include "oops/oop.hpp" |
7397 | 32 |
#include "utilities/hashtable.hpp" |
36381
b9ed6bef9364
8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
35498
diff
changeset
|
33 |
#include "utilities/ostream.hpp" |
7397 | 34 |
|
1 | 35 |
class DictionaryEntry; |
20405 | 36 |
class BoolObjectClosure; |
1 | 37 |
|
38 |
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
39 |
// The data structure for the system dictionary (and the shared system |
|
40 |
// dictionary). |
|
41 |
||
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46274
diff
changeset
|
42 |
class Dictionary : public TwoOopHashtable<InstanceKlass*, mtClass> { |
1 | 43 |
friend class VMStructs; |
44 |
private: |
|
45 |
// current iteration index. |
|
46 |
static int _current_class_index; |
|
47 |
// pointer to the current hash table entry. |
|
48 |
static DictionaryEntry* _current_class_entry; |
|
49 |
||
20405 | 50 |
ProtectionDomainCacheTable* _pd_cache_table; |
51 |
||
1 | 52 |
DictionaryEntry* get_entry(int index, unsigned int hash, |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
53 |
Symbol* name, ClassLoaderData* loader_data); |
1 | 54 |
|
34257
4be3504cc03b
8140802: Clean up and refactor of class loading code for CDS
iklam
parents:
33602
diff
changeset
|
55 |
protected: |
34666 | 56 |
DictionaryEntry* bucket(int i) const { |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46274
diff
changeset
|
57 |
return (DictionaryEntry*)Hashtable<InstanceKlass*, mtClass>::bucket(i); |
1 | 58 |
} |
59 |
||
60 |
// The following method is not MT-safe and must be done under lock. |
|
61 |
DictionaryEntry** bucket_addr(int i) { |
|
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46274
diff
changeset
|
62 |
return (DictionaryEntry**)Hashtable<InstanceKlass*, mtClass>::bucket_addr(i); |
1 | 63 |
} |
64 |
||
65 |
void add_entry(int index, DictionaryEntry* new_entry) { |
|
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46274
diff
changeset
|
66 |
Hashtable<InstanceKlass*, mtClass>::add_entry(index, (HashtableEntry<InstanceKlass*, mtClass>*)new_entry); |
1 | 67 |
} |
68 |
||
34257
4be3504cc03b
8140802: Clean up and refactor of class loading code for CDS
iklam
parents:
33602
diff
changeset
|
69 |
static size_t entry_size(); |
1 | 70 |
public: |
71 |
Dictionary(int table_size); |
|
13195 | 72 |
Dictionary(int table_size, HashtableBucket<mtClass>* t, int number_of_entries); |
1 | 73 |
|
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46274
diff
changeset
|
74 |
DictionaryEntry* new_entry(unsigned int hash, InstanceKlass* klass, ClassLoaderData* loader_data); |
1 | 75 |
|
76 |
void free_entry(DictionaryEntry* entry); |
|
77 |
||
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46274
diff
changeset
|
78 |
void add_klass(Symbol* class_name, ClassLoaderData* loader_data, InstanceKlass* obj); |
1 | 79 |
|
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46274
diff
changeset
|
80 |
InstanceKlass* find_class(int index, unsigned int hash, |
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46274
diff
changeset
|
81 |
Symbol* name, ClassLoaderData* loader_data); |
1 | 82 |
|
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46274
diff
changeset
|
83 |
InstanceKlass* find_shared_class(int index, unsigned int hash, Symbol* name); |
1 | 84 |
|
85 |
// Compiler support |
|
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46274
diff
changeset
|
86 |
InstanceKlass* try_get_next_class(); |
1 | 87 |
|
88 |
// GC support |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
89 |
void oops_do(OopClosure* f); |
25492
d27050bdfb04
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
25491
diff
changeset
|
90 |
void roots_oops_do(OopClosure* strong, OopClosure* weak); |
1 | 91 |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
92 |
void classes_do(void f(Klass*)); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
93 |
void classes_do(void f(Klass*, TRAPS), TRAPS); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
94 |
void classes_do(void f(Klass*, ClassLoaderData*)); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
95 |
|
20405 | 96 |
void unlink(BoolObjectClosure* is_alive); |
26135
82b516c550f7
8046070: Class Data Sharing clean up and refactoring
iklam
parents:
25492
diff
changeset
|
97 |
void remove_classes_in_error_state(); |
1 | 98 |
|
99 |
// Classes loaded by the bootstrap loader are always strongly reachable. |
|
100 |
// If we're not doing class unloading, all classes are strongly reachable. |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
101 |
static bool is_strongly_reachable(ClassLoaderData* loader_data, Klass* klass) { |
1 | 102 |
assert (klass != NULL, "should have non-null klass"); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
103 |
return (loader_data->is_the_null_class_loader_data() || !ClassUnloading); |
1 | 104 |
} |
105 |
||
26174
ca46a107cb78
8054402: "klass->is_loader_alive(_is_alive)) failed: must be alive" for anonymous classes
thartmann
parents:
25492
diff
changeset
|
106 |
// Unload (that is, break root links to) all unmarked classes and loaders. |
ca46a107cb78
8054402: "klass->is_loader_alive(_is_alive)) failed: must be alive" for anonymous classes
thartmann
parents:
25492
diff
changeset
|
107 |
void do_unloading(); |
1 | 108 |
|
109 |
// Protection domains |
|
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46274
diff
changeset
|
110 |
InstanceKlass* find(int index, unsigned int hash, Symbol* name, |
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46274
diff
changeset
|
111 |
ClassLoaderData* loader_data, Handle protection_domain, TRAPS); |
1 | 112 |
bool is_valid_protection_domain(int index, unsigned int hash, |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
113 |
Symbol* name, ClassLoaderData* loader_data, |
1 | 114 |
Handle protection_domain); |
115 |
void add_protection_domain(int index, unsigned int hash, |
|
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46274
diff
changeset
|
116 |
InstanceKlass* klass, ClassLoaderData* loader_data, |
1 | 117 |
Handle protection_domain, TRAPS); |
118 |
||
119 |
// Sharing support |
|
120 |
void reorder_dictionary(); |
|
121 |
||
46274
534d019edb92
8175104: Unhandled oop in ProtectionDomainCacheTable::compute_hash
coleenp
parents:
42073
diff
changeset
|
122 |
ProtectionDomainCacheEntry* cache_get(Handle protection_domain); |
1 | 123 |
|
26135
82b516c550f7
8046070: Class Data Sharing clean up and refactoring
iklam
parents:
25492
diff
changeset
|
124 |
void print(bool details = true); |
42073
89e056fd82cc
8166145: runtime/threads/ThreadInterruptTest3 fails with ExitCode 0
gziemski
parents:
36381
diff
changeset
|
125 |
#ifdef ASSERT |
89e056fd82cc
8166145: runtime/threads/ThreadInterruptTest3 fails with ExitCode 0
gziemski
parents:
36381
diff
changeset
|
126 |
void printPerformanceInfoDetails(); |
89e056fd82cc
8166145: runtime/threads/ThreadInterruptTest3 fails with ExitCode 0
gziemski
parents:
36381
diff
changeset
|
127 |
#endif // ASSERT |
1 | 128 |
void verify(); |
129 |
}; |
|
130 |
||
131 |
// An entry in the system dictionary, this describes a class as |
|
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46274
diff
changeset
|
132 |
// { InstanceKlass*, loader, protection_domain }. |
1 | 133 |
|
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46274
diff
changeset
|
134 |
class DictionaryEntry : public HashtableEntry<InstanceKlass*, mtClass> { |
1 | 135 |
friend class VMStructs; |
136 |
private: |
|
137 |
// Contains the set of approved protection domains that can access |
|
138 |
// this system dictionary entry. |
|
20405 | 139 |
// |
140 |
// This protection domain set is a set of tuples: |
|
141 |
// |
|
142 |
// (InstanceKlass C, initiating class loader ICL, Protection Domain PD) |
|
143 |
// |
|
144 |
// [Note that C.protection_domain(), which is stored in the java.lang.Class |
|
145 |
// mirror of C, is NOT the same as PD] |
|
146 |
// |
|
147 |
// If such an entry (C, ICL, PD) exists in the table, it means that |
|
148 |
// it is okay for a class Foo to reference C, where |
|
149 |
// |
|
150 |
// Foo.protection_domain() == PD, and |
|
151 |
// Foo's defining class loader == ICL |
|
152 |
// |
|
153 |
// The usage of the PD set can be seen in SystemDictionary::validate_protection_domain() |
|
154 |
// It is essentially a cache to avoid repeated Java up-calls to |
|
155 |
// ClassLoader.checkPackageAccess(). |
|
156 |
// |
|
1 | 157 |
ProtectionDomainEntry* _pd_set; |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
158 |
ClassLoaderData* _loader_data; |
1 | 159 |
|
160 |
public: |
|
161 |
// Tells whether a protection is in the approved set. |
|
162 |
bool contains_protection_domain(oop protection_domain) const; |
|
163 |
// Adds a protection domain to the approved set. |
|
46274
534d019edb92
8175104: Unhandled oop in ProtectionDomainCacheTable::compute_hash
coleenp
parents:
42073
diff
changeset
|
164 |
void add_protection_domain(Dictionary* dict, Handle protection_domain); |
1 | 165 |
|
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46274
diff
changeset
|
166 |
InstanceKlass* klass() const { return (InstanceKlass*)literal(); } |
1 | 167 |
|
168 |
DictionaryEntry* next() const { |
|
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46274
diff
changeset
|
169 |
return (DictionaryEntry*)HashtableEntry<InstanceKlass*, mtClass>::next(); |
1 | 170 |
} |
171 |
||
172 |
DictionaryEntry** next_addr() { |
|
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46274
diff
changeset
|
173 |
return (DictionaryEntry**)HashtableEntry<InstanceKlass*, mtClass>::next_addr(); |
1 | 174 |
} |
175 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
176 |
ClassLoaderData* loader_data() const { return _loader_data; } |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
177 |
void set_loader_data(ClassLoaderData* loader_data) { _loader_data = loader_data; } |
1 | 178 |
|
179 |
ProtectionDomainEntry* pd_set() const { return _pd_set; } |
|
180 |
void set_pd_set(ProtectionDomainEntry* pd_set) { _pd_set = pd_set; } |
|
181 |
||
182 |
// Tells whether the initiating class' protection can access the this _klass |
|
183 |
bool is_valid_protection_domain(Handle protection_domain) { |
|
184 |
if (!ProtectionDomainVerification) return true; |
|
185 |
if (!SystemDictionary::has_checkPackageAccess()) return true; |
|
186 |
||
187 |
return protection_domain() == NULL |
|
188 |
? true |
|
189 |
: contains_protection_domain(protection_domain()); |
|
190 |
} |
|
191 |
||
192 |
void verify_protection_domain_set() { |
|
193 |
for (ProtectionDomainEntry* current = _pd_set; |
|
194 |
current != NULL; |
|
195 |
current = current->_next) { |
|
20405 | 196 |
current->_pd_cache->protection_domain()->verify(); |
1 | 197 |
} |
198 |
} |
|
199 |
||
34666 | 200 |
bool equals(const Symbol* class_name, ClassLoaderData* loader_data) const { |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46274
diff
changeset
|
201 |
InstanceKlass* klass = (InstanceKlass*)literal(); |
33602 | 202 |
return (klass->name() == class_name && _loader_data == loader_data); |
1 | 203 |
} |
204 |
||
36381
b9ed6bef9364
8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
35498
diff
changeset
|
205 |
void print_count(outputStream *st) { |
1 | 206 |
int count = 0; |
207 |
for (ProtectionDomainEntry* current = _pd_set; |
|
208 |
current != NULL; |
|
209 |
current = current->_next) { |
|
210 |
count++; |
|
211 |
} |
|
36381
b9ed6bef9364
8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
35498
diff
changeset
|
212 |
st->print_cr("pd set count = #%d", count); |
1 | 213 |
} |
214 |
}; |
|
2534 | 215 |
|
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
216 |
// Entry in a SymbolPropertyTable, mapping a single Symbol* |
2534 | 217 |
// to a managed and an unmanaged pointer. |
13195 | 218 |
class SymbolPropertyEntry : public HashtableEntry<Symbol*, mtSymbol> { |
2534 | 219 |
friend class VMStructs; |
220 |
private: |
|
5420
586d3988e72b
6939134: JSR 292 adjustments to method handle invocation
jrose
parents:
2534
diff
changeset
|
221 |
intptr_t _symbol_mode; // secondary key |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
222 |
Method* _method; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
223 |
oop _method_type; |
2534 | 224 |
|
225 |
public: |
|
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
226 |
Symbol* symbol() const { return literal(); } |
2534 | 227 |
|
5420
586d3988e72b
6939134: JSR 292 adjustments to method handle invocation
jrose
parents:
2534
diff
changeset
|
228 |
intptr_t symbol_mode() const { return _symbol_mode; } |
586d3988e72b
6939134: JSR 292 adjustments to method handle invocation
jrose
parents:
2534
diff
changeset
|
229 |
void set_symbol_mode(intptr_t m) { _symbol_mode = m; } |
586d3988e72b
6939134: JSR 292 adjustments to method handle invocation
jrose
parents:
2534
diff
changeset
|
230 |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
231 |
Method* method() const { return _method; } |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
232 |
void set_method(Method* p) { _method = p; } |
2534 | 233 |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
234 |
oop method_type() const { return _method_type; } |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
235 |
oop* method_type_addr() { return &_method_type; } |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
236 |
void set_method_type(oop p) { _method_type = p; } |
2534 | 237 |
|
238 |
SymbolPropertyEntry* next() const { |
|
13195 | 239 |
return (SymbolPropertyEntry*)HashtableEntry<Symbol*, mtSymbol>::next(); |
2534 | 240 |
} |
241 |
||
242 |
SymbolPropertyEntry** next_addr() { |
|
13195 | 243 |
return (SymbolPropertyEntry**)HashtableEntry<Symbol*, mtSymbol>::next_addr(); |
2534 | 244 |
} |
245 |
||
246 |
void print_on(outputStream* st) const { |
|
247 |
symbol()->print_value_on(st); |
|
31592
43f48e165466
8081202: Hotspot compile warning: "Invalid suffix on literal; C++11 requires a space between literal and identifier"
bpittore
parents:
29081
diff
changeset
|
248 |
st->print("/mode=" INTX_FORMAT, symbol_mode()); |
2534 | 249 |
st->print(" -> "); |
250 |
bool printed = false; |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
251 |
if (method() != NULL) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
252 |
method()->print_value_on(st); |
2534 | 253 |
printed = true; |
254 |
} |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
255 |
if (method_type() != NULL) { |
2534 | 256 |
if (printed) st->print(" and "); |
24424
2658d7834c6e
8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents:
20408
diff
changeset
|
257 |
st->print(INTPTR_FORMAT, p2i((void *)method_type())); |
2534 | 258 |
printed = true; |
259 |
} |
|
260 |
st->print_cr(printed ? "" : "(empty)"); |
|
261 |
} |
|
262 |
}; |
|
263 |
||
264 |
// A system-internal mapping of symbols to pointers, both managed |
|
265 |
// and unmanaged. Used to record the auto-generation of each method |
|
266 |
// MethodHandle.invoke(S)T, for all signatures (S)T. |
|
13195 | 267 |
class SymbolPropertyTable : public Hashtable<Symbol*, mtSymbol> { |
2534 | 268 |
friend class VMStructs; |
269 |
private: |
|
270 |
SymbolPropertyEntry* bucket(int i) { |
|
13195 | 271 |
return (SymbolPropertyEntry*) Hashtable<Symbol*, mtSymbol>::bucket(i); |
2534 | 272 |
} |
273 |
||
274 |
// The following method is not MT-safe and must be done under lock. |
|
275 |
SymbolPropertyEntry** bucket_addr(int i) { |
|
13195 | 276 |
return (SymbolPropertyEntry**) Hashtable<Symbol*, mtSymbol>::bucket_addr(i); |
2534 | 277 |
} |
278 |
||
279 |
void add_entry(int index, SymbolPropertyEntry* new_entry) { |
|
280 |
ShouldNotReachHere(); |
|
281 |
} |
|
282 |
void set_entry(int index, SymbolPropertyEntry* new_entry) { |
|
283 |
ShouldNotReachHere(); |
|
284 |
} |
|
285 |
||
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
286 |
SymbolPropertyEntry* new_entry(unsigned int hash, Symbol* symbol, intptr_t symbol_mode) { |
13195 | 287 |
SymbolPropertyEntry* entry = (SymbolPropertyEntry*) Hashtable<Symbol*, mtSymbol>::new_entry(hash, symbol); |
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
288 |
// Hashtable with Symbol* literal must increment and decrement refcount. |
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
289 |
symbol->increment_refcount(); |
5420
586d3988e72b
6939134: JSR 292 adjustments to method handle invocation
jrose
parents:
2534
diff
changeset
|
290 |
entry->set_symbol_mode(symbol_mode); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
291 |
entry->set_method(NULL); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
292 |
entry->set_method_type(NULL); |
2534 | 293 |
return entry; |
294 |
} |
|
295 |
||
296 |
public: |
|
297 |
SymbolPropertyTable(int table_size); |
|
13195 | 298 |
SymbolPropertyTable(int table_size, HashtableBucket<mtSymbol>* t, int number_of_entries); |
2534 | 299 |
|
300 |
void free_entry(SymbolPropertyEntry* entry) { |
|
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
301 |
// decrement Symbol refcount here because hashtable doesn't. |
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
302 |
entry->literal()->decrement_refcount(); |
13195 | 303 |
Hashtable<Symbol*, mtSymbol>::free_entry(entry); |
2534 | 304 |
} |
305 |
||
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
306 |
unsigned int compute_hash(Symbol* sym, intptr_t symbol_mode) { |
2534 | 307 |
// Use the regular identity_hash. |
13195 | 308 |
return Hashtable<Symbol*, mtSymbol>::compute_hash(sym) ^ symbol_mode; |
5420
586d3988e72b
6939134: JSR 292 adjustments to method handle invocation
jrose
parents:
2534
diff
changeset
|
309 |
} |
586d3988e72b
6939134: JSR 292 adjustments to method handle invocation
jrose
parents:
2534
diff
changeset
|
310 |
|
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
311 |
int index_for(Symbol* name, intptr_t symbol_mode) { |
5420
586d3988e72b
6939134: JSR 292 adjustments to method handle invocation
jrose
parents:
2534
diff
changeset
|
312 |
return hash_to_index(compute_hash(name, symbol_mode)); |
2534 | 313 |
} |
314 |
||
315 |
// need not be locked; no state change |
|
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
316 |
SymbolPropertyEntry* find_entry(int index, unsigned int hash, Symbol* name, intptr_t name_mode); |
2534 | 317 |
|
318 |
// must be done under SystemDictionary_lock |
|
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
319 |
SymbolPropertyEntry* add_entry(int index, unsigned int hash, Symbol* name, intptr_t name_mode); |
2534 | 320 |
|
321 |
// GC support |
|
322 |
void oops_do(OopClosure* f); |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
323 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
324 |
void methods_do(void f(Method*)); |
2534 | 325 |
|
326 |
// Sharing support |
|
327 |
void reorder_dictionary(); |
|
328 |
||
329 |
#ifndef PRODUCT |
|
330 |
void print(); |
|
331 |
#endif |
|
332 |
void verify(); |
|
333 |
}; |
|
7397 | 334 |
#endif // SHARE_VM_CLASSFILE_DICTIONARY_HPP |