author | ccheung |
Thu, 13 Jun 2013 22:02:40 -0700 | |
changeset 18073 | f02460441ddc |
parent 17373 | 7d8bb2a8787e |
child 20405 | 3321f6b16639 |
child 20282 | 7f9cbdf89af2 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
2 |
* Copyright (c) 2003, 2012, 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 |
||
28 |
#include "classfile/systemDictionary.hpp" |
|
29 |
#include "oops/instanceKlass.hpp" |
|
30 |
#include "oops/oop.hpp" |
|
31 |
#include "utilities/hashtable.hpp" |
|
32 |
||
1 | 33 |
class DictionaryEntry; |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
34 |
class PSPromotionManager; |
1 | 35 |
|
36 |
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
37 |
// The data structure for the system dictionary (and the shared system |
|
38 |
// dictionary). |
|
39 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
40 |
class Dictionary : public TwoOopHashtable<Klass*, mtClass> { |
1 | 41 |
friend class VMStructs; |
42 |
private: |
|
43 |
// current iteration index. |
|
44 |
static int _current_class_index; |
|
45 |
// pointer to the current hash table entry. |
|
46 |
static DictionaryEntry* _current_class_entry; |
|
47 |
||
48 |
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
|
49 |
Symbol* name, ClassLoaderData* loader_data); |
1 | 50 |
|
51 |
DictionaryEntry* bucket(int i) { |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
52 |
return (DictionaryEntry*)Hashtable<Klass*, mtClass>::bucket(i); |
1 | 53 |
} |
54 |
||
55 |
// The following method is not MT-safe and must be done under lock. |
|
56 |
DictionaryEntry** bucket_addr(int i) { |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
57 |
return (DictionaryEntry**)Hashtable<Klass*, mtClass>::bucket_addr(i); |
1 | 58 |
} |
59 |
||
60 |
void add_entry(int index, DictionaryEntry* new_entry) { |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
61 |
Hashtable<Klass*, mtClass>::add_entry(index, (HashtableEntry<Klass*, mtClass>*)new_entry); |
1 | 62 |
} |
63 |
||
64 |
public: |
|
65 |
Dictionary(int table_size); |
|
13195 | 66 |
Dictionary(int table_size, HashtableBucket<mtClass>* t, int number_of_entries); |
1 | 67 |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
68 |
DictionaryEntry* new_entry(unsigned int hash, Klass* klass, ClassLoaderData* loader_data); |
1 | 69 |
|
70 |
DictionaryEntry* new_entry(); |
|
71 |
||
72 |
void free_entry(DictionaryEntry* entry); |
|
73 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
74 |
void add_klass(Symbol* class_name, ClassLoaderData* loader_data,KlassHandle obj); |
1 | 75 |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
76 |
Klass* find_class(int index, unsigned int hash, |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
77 |
Symbol* name, ClassLoaderData* loader_data); |
1 | 78 |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
79 |
Klass* find_shared_class(int index, unsigned int hash, Symbol* name); |
1 | 80 |
|
81 |
// Compiler support |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
82 |
Klass* try_get_next_class(); |
1 | 83 |
|
84 |
// GC support |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
85 |
void oops_do(OopClosure* f); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
86 |
void always_strong_oops_do(OopClosure* blk); |
1 | 87 |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
88 |
void always_strong_classes_do(KlassClosure* closure); |
1 | 89 |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
90 |
void classes_do(void f(Klass*)); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
91 |
void classes_do(void f(Klass*, TRAPS), TRAPS); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
92 |
void classes_do(void f(Klass*, ClassLoaderData*)); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
93 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
94 |
void methods_do(void f(Method*)); |
1 | 95 |
|
96 |
||
97 |
// Classes loaded by the bootstrap loader are always strongly reachable. |
|
98 |
// 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
|
99 |
static bool is_strongly_reachable(ClassLoaderData* loader_data, Klass* klass) { |
1 | 100 |
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
|
101 |
return (loader_data->is_the_null_class_loader_data() || !ClassUnloading); |
1 | 102 |
} |
103 |
||
104 |
// Unload (that is, break root links to) all unmarked classes and |
|
105 |
// loaders. Returns "true" iff something was unloaded. |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
106 |
bool do_unloading(); |
1 | 107 |
|
108 |
// Protection domains |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
109 |
Klass* find(int index, unsigned int hash, Symbol* name, |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
110 |
ClassLoaderData* loader_data, Handle protection_domain, TRAPS); |
1 | 111 |
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
|
112 |
Symbol* name, ClassLoaderData* loader_data, |
1 | 113 |
Handle protection_domain); |
114 |
void add_protection_domain(int index, unsigned int hash, |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
115 |
instanceKlassHandle klass, ClassLoaderData* loader_data, |
1 | 116 |
Handle protection_domain, TRAPS); |
117 |
||
118 |
// Sharing support |
|
119 |
void reorder_dictionary(); |
|
120 |
||
121 |
||
122 |
#ifndef PRODUCT |
|
123 |
void print(); |
|
124 |
#endif |
|
125 |
void verify(); |
|
126 |
}; |
|
127 |
||
128 |
// The following classes can be in dictionary.cpp, but we need these |
|
129 |
// to be in header file so that SA's vmStructs can access. |
|
130 |
||
13195 | 131 |
class ProtectionDomainEntry :public CHeapObj<mtClass> { |
1 | 132 |
friend class VMStructs; |
133 |
public: |
|
134 |
ProtectionDomainEntry* _next; |
|
135 |
oop _protection_domain; |
|
136 |
||
137 |
ProtectionDomainEntry(oop protection_domain, ProtectionDomainEntry* next) { |
|
138 |
_protection_domain = protection_domain; |
|
139 |
_next = next; |
|
140 |
} |
|
141 |
||
142 |
ProtectionDomainEntry* next() { return _next; } |
|
143 |
oop protection_domain() { return _protection_domain; } |
|
144 |
}; |
|
145 |
||
146 |
// An entry in the system dictionary, this describes a class as |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
147 |
// { Klass*, loader, protection_domain }. |
1 | 148 |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
149 |
class DictionaryEntry : public HashtableEntry<Klass*, mtClass> { |
1 | 150 |
friend class VMStructs; |
151 |
private: |
|
152 |
// Contains the set of approved protection domains that can access |
|
153 |
// this system dictionary entry. |
|
154 |
ProtectionDomainEntry* _pd_set; |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
155 |
ClassLoaderData* _loader_data; |
1 | 156 |
|
157 |
public: |
|
158 |
// Tells whether a protection is in the approved set. |
|
159 |
bool contains_protection_domain(oop protection_domain) const; |
|
160 |
// Adds a protection domain to the approved set. |
|
161 |
void add_protection_domain(oop protection_domain); |
|
162 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
163 |
Klass* klass() const { return (Klass*)literal(); } |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
164 |
Klass** klass_addr() { return (Klass**)literal_addr(); } |
1 | 165 |
|
166 |
DictionaryEntry* next() const { |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
167 |
return (DictionaryEntry*)HashtableEntry<Klass*, mtClass>::next(); |
1 | 168 |
} |
169 |
||
170 |
DictionaryEntry** next_addr() { |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
171 |
return (DictionaryEntry**)HashtableEntry<Klass*, mtClass>::next_addr(); |
1 | 172 |
} |
173 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
174 |
ClassLoaderData* loader_data() const { return _loader_data; } |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
175 |
void set_loader_data(ClassLoaderData* loader_data) { _loader_data = loader_data; } |
1 | 176 |
|
177 |
ProtectionDomainEntry* pd_set() const { return _pd_set; } |
|
178 |
void set_pd_set(ProtectionDomainEntry* pd_set) { _pd_set = pd_set; } |
|
179 |
||
180 |
bool has_protection_domain() { return _pd_set != NULL; } |
|
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 |
||
193 |
void protection_domain_set_oops_do(OopClosure* f) { |
|
194 |
for (ProtectionDomainEntry* current = _pd_set; |
|
195 |
current != NULL; |
|
196 |
current = current->_next) { |
|
197 |
f->do_oop(&(current->_protection_domain)); |
|
198 |
} |
|
199 |
} |
|
200 |
||
201 |
void verify_protection_domain_set() { |
|
202 |
for (ProtectionDomainEntry* current = _pd_set; |
|
203 |
current != NULL; |
|
204 |
current = current->_next) { |
|
205 |
current->_protection_domain->verify(); |
|
206 |
} |
|
207 |
} |
|
208 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
209 |
bool equals(Symbol* class_name, ClassLoaderData* loader_data) const { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
210 |
Klass* klass = (Klass*)literal(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
211 |
return (InstanceKlass::cast(klass)->name() == class_name && |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
212 |
_loader_data == loader_data); |
1 | 213 |
} |
214 |
||
215 |
void print() { |
|
216 |
int count = 0; |
|
217 |
for (ProtectionDomainEntry* current = _pd_set; |
|
218 |
current != NULL; |
|
219 |
current = current->_next) { |
|
220 |
count++; |
|
221 |
} |
|
222 |
tty->print_cr("pd set = #%d", count); |
|
223 |
} |
|
224 |
}; |
|
2534 | 225 |
|
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
226 |
// Entry in a SymbolPropertyTable, mapping a single Symbol* |
2534 | 227 |
// to a managed and an unmanaged pointer. |
13195 | 228 |
class SymbolPropertyEntry : public HashtableEntry<Symbol*, mtSymbol> { |
2534 | 229 |
friend class VMStructs; |
230 |
private: |
|
5420
586d3988e72b
6939134: JSR 292 adjustments to method handle invocation
jrose
parents:
2534
diff
changeset
|
231 |
intptr_t _symbol_mode; // secondary key |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
232 |
Method* _method; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
233 |
oop _method_type; |
2534 | 234 |
|
235 |
public: |
|
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
236 |
Symbol* symbol() const { return literal(); } |
2534 | 237 |
|
5420
586d3988e72b
6939134: JSR 292 adjustments to method handle invocation
jrose
parents:
2534
diff
changeset
|
238 |
intptr_t symbol_mode() const { return _symbol_mode; } |
586d3988e72b
6939134: JSR 292 adjustments to method handle invocation
jrose
parents:
2534
diff
changeset
|
239 |
void set_symbol_mode(intptr_t m) { _symbol_mode = m; } |
586d3988e72b
6939134: JSR 292 adjustments to method handle invocation
jrose
parents:
2534
diff
changeset
|
240 |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
241 |
Method* method() const { return _method; } |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
242 |
void set_method(Method* p) { _method = p; } |
2534 | 243 |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
244 |
oop method_type() const { return _method_type; } |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
245 |
oop* method_type_addr() { return &_method_type; } |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
246 |
void set_method_type(oop p) { _method_type = p; } |
2534 | 247 |
|
248 |
SymbolPropertyEntry* next() const { |
|
13195 | 249 |
return (SymbolPropertyEntry*)HashtableEntry<Symbol*, mtSymbol>::next(); |
2534 | 250 |
} |
251 |
||
252 |
SymbolPropertyEntry** next_addr() { |
|
13195 | 253 |
return (SymbolPropertyEntry**)HashtableEntry<Symbol*, mtSymbol>::next_addr(); |
2534 | 254 |
} |
255 |
||
256 |
void print_on(outputStream* st) const { |
|
257 |
symbol()->print_value_on(st); |
|
5420
586d3988e72b
6939134: JSR 292 adjustments to method handle invocation
jrose
parents:
2534
diff
changeset
|
258 |
st->print("/mode="INTX_FORMAT, symbol_mode()); |
2534 | 259 |
st->print(" -> "); |
260 |
bool printed = false; |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
261 |
if (method() != NULL) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
262 |
method()->print_value_on(st); |
2534 | 263 |
printed = true; |
264 |
} |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
265 |
if (method_type() != NULL) { |
2534 | 266 |
if (printed) st->print(" and "); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
267 |
st->print(INTPTR_FORMAT, method_type()); |
2534 | 268 |
printed = true; |
269 |
} |
|
270 |
st->print_cr(printed ? "" : "(empty)"); |
|
271 |
} |
|
272 |
}; |
|
273 |
||
274 |
// A system-internal mapping of symbols to pointers, both managed |
|
275 |
// and unmanaged. Used to record the auto-generation of each method |
|
276 |
// MethodHandle.invoke(S)T, for all signatures (S)T. |
|
13195 | 277 |
class SymbolPropertyTable : public Hashtable<Symbol*, mtSymbol> { |
2534 | 278 |
friend class VMStructs; |
279 |
private: |
|
280 |
SymbolPropertyEntry* bucket(int i) { |
|
13195 | 281 |
return (SymbolPropertyEntry*) Hashtable<Symbol*, mtSymbol>::bucket(i); |
2534 | 282 |
} |
283 |
||
284 |
// The following method is not MT-safe and must be done under lock. |
|
285 |
SymbolPropertyEntry** bucket_addr(int i) { |
|
13195 | 286 |
return (SymbolPropertyEntry**) Hashtable<Symbol*, mtSymbol>::bucket_addr(i); |
2534 | 287 |
} |
288 |
||
289 |
void add_entry(int index, SymbolPropertyEntry* new_entry) { |
|
290 |
ShouldNotReachHere(); |
|
291 |
} |
|
292 |
void set_entry(int index, SymbolPropertyEntry* new_entry) { |
|
293 |
ShouldNotReachHere(); |
|
294 |
} |
|
295 |
||
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
296 |
SymbolPropertyEntry* new_entry(unsigned int hash, Symbol* symbol, intptr_t symbol_mode) { |
13195 | 297 |
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
|
298 |
// 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
|
299 |
symbol->increment_refcount(); |
5420
586d3988e72b
6939134: JSR 292 adjustments to method handle invocation
jrose
parents:
2534
diff
changeset
|
300 |
entry->set_symbol_mode(symbol_mode); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
301 |
entry->set_method(NULL); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
302 |
entry->set_method_type(NULL); |
2534 | 303 |
return entry; |
304 |
} |
|
305 |
||
306 |
public: |
|
307 |
SymbolPropertyTable(int table_size); |
|
13195 | 308 |
SymbolPropertyTable(int table_size, HashtableBucket<mtSymbol>* t, int number_of_entries); |
2534 | 309 |
|
310 |
void free_entry(SymbolPropertyEntry* entry) { |
|
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
311 |
// decrement Symbol refcount here because hashtable doesn't. |
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
312 |
entry->literal()->decrement_refcount(); |
13195 | 313 |
Hashtable<Symbol*, mtSymbol>::free_entry(entry); |
2534 | 314 |
} |
315 |
||
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
316 |
unsigned int compute_hash(Symbol* sym, intptr_t symbol_mode) { |
2534 | 317 |
// Use the regular identity_hash. |
13195 | 318 |
return Hashtable<Symbol*, mtSymbol>::compute_hash(sym) ^ symbol_mode; |
5420
586d3988e72b
6939134: JSR 292 adjustments to method handle invocation
jrose
parents:
2534
diff
changeset
|
319 |
} |
586d3988e72b
6939134: JSR 292 adjustments to method handle invocation
jrose
parents:
2534
diff
changeset
|
320 |
|
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
321 |
int index_for(Symbol* name, intptr_t symbol_mode) { |
5420
586d3988e72b
6939134: JSR 292 adjustments to method handle invocation
jrose
parents:
2534
diff
changeset
|
322 |
return hash_to_index(compute_hash(name, symbol_mode)); |
2534 | 323 |
} |
324 |
||
325 |
// need not be locked; no state change |
|
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
326 |
SymbolPropertyEntry* find_entry(int index, unsigned int hash, Symbol* name, intptr_t name_mode); |
2534 | 327 |
|
328 |
// must be done under SystemDictionary_lock |
|
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
329 |
SymbolPropertyEntry* add_entry(int index, unsigned int hash, Symbol* name, intptr_t name_mode); |
2534 | 330 |
|
331 |
// GC support |
|
332 |
void oops_do(OopClosure* f); |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
333 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
334 |
void methods_do(void f(Method*)); |
2534 | 335 |
|
336 |
// Sharing support |
|
337 |
void reorder_dictionary(); |
|
338 |
||
339 |
#ifndef PRODUCT |
|
340 |
void print(); |
|
341 |
#endif |
|
342 |
void verify(); |
|
343 |
}; |
|
7397 | 344 |
#endif // SHARE_VM_CLASSFILE_DICTIONARY_HPP |