author | rfield |
Tue, 14 Nov 2017 19:33:37 -0800 (2017-11-15) | |
changeset 47840 | e0f08a49f3e3 |
parent 47634 | 6a0c42c40cd1 |
child 47761 | 1b0566927c7a |
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" |
47098
e704f55561c3
8164207: Checking missing load-acquire in relation to _pd_set in dictionary.cpp
coleenp
parents:
46746
diff
changeset
|
32 |
#include "runtime/orderAccess.hpp" |
7397 | 33 |
#include "utilities/hashtable.hpp" |
36381
b9ed6bef9364
8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
35498
diff
changeset
|
34 |
#include "utilities/ostream.hpp" |
7397 | 35 |
|
1 | 36 |
class DictionaryEntry; |
20405 | 37 |
class BoolObjectClosure; |
1 | 38 |
|
39 |
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
46729 | 40 |
// The data structure for the class loader data dictionaries (and the shared system |
1 | 41 |
// dictionary). |
42 |
||
46729 | 43 |
class Dictionary : public Hashtable<InstanceKlass*, mtClass> { |
1 | 44 |
friend class VMStructs; |
45 |
||
46729 | 46 |
ClassLoaderData* _loader_data; // backpointer to owning loader |
47 |
ClassLoaderData* loader_data() const { return _loader_data; } |
|
20405 | 48 |
|
46729 | 49 |
DictionaryEntry* get_entry(int index, unsigned int hash, Symbol* name); |
1 | 50 |
|
34257
4be3504cc03b
8140802: Clean up and refactor of class loading code for CDS
iklam
parents:
33602
diff
changeset
|
51 |
protected: |
46729 | 52 |
static size_t entry_size(); |
53 |
public: |
|
54 |
Dictionary(ClassLoaderData* loader_data, int table_size); |
|
55 |
Dictionary(ClassLoaderData* loader_data, int table_size, HashtableBucket<mtClass>* t, int number_of_entries); |
|
56 |
~Dictionary(); |
|
1 | 57 |
|
46729 | 58 |
DictionaryEntry* new_entry(unsigned int hash, InstanceKlass* klass); |
59 |
||
60 |
void add_klass(int index, unsigned int hash, Symbol* class_name, InstanceKlass* obj); |
|
61 |
||
62 |
InstanceKlass* find_class(int index, unsigned int hash, Symbol* name); |
|
1 | 63 |
|
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46274
diff
changeset
|
64 |
InstanceKlass* find_shared_class(int index, unsigned int hash, Symbol* name); |
1 | 65 |
|
66 |
// GC support |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
67 |
void oops_do(OopClosure* f); |
25492
d27050bdfb04
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
25491
diff
changeset
|
68 |
void roots_oops_do(OopClosure* strong, OopClosure* weak); |
1 | 69 |
|
46729 | 70 |
void classes_do(void f(InstanceKlass*)); |
71 |
void classes_do(void f(InstanceKlass*, TRAPS), TRAPS); |
|
72 |
void all_entries_do(void f(InstanceKlass*, ClassLoaderData*)); |
|
46746
ea379ebb9447
8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
46742
diff
changeset
|
73 |
void classes_do(MetaspaceClosure* it); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
74 |
|
20405 | 75 |
void unlink(BoolObjectClosure* is_alive); |
26135
82b516c550f7
8046070: Class Data Sharing clean up and refactoring
iklam
parents:
25492
diff
changeset
|
76 |
void remove_classes_in_error_state(); |
1 | 77 |
|
46729 | 78 |
// Unload classes whose defining loaders are unloaded |
26174
ca46a107cb78
8054402: "klass->is_loader_alive(_is_alive)) failed: must be alive" for anonymous classes
thartmann
parents:
25492
diff
changeset
|
79 |
void do_unloading(); |
1 | 80 |
|
81 |
// Protection domains |
|
46729 | 82 |
InstanceKlass* find(int index, unsigned int hash, Symbol* name, Handle protection_domain); |
1 | 83 |
bool is_valid_protection_domain(int index, unsigned int hash, |
46729 | 84 |
Symbol* name, |
1 | 85 |
Handle protection_domain); |
86 |
void add_protection_domain(int index, unsigned int hash, |
|
46729 | 87 |
InstanceKlass* klass, |
1 | 88 |
Handle protection_domain, TRAPS); |
89 |
||
90 |
// Sharing support |
|
46746
ea379ebb9447
8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
46742
diff
changeset
|
91 |
void reorder_dictionary_for_sharing(); |
1 | 92 |
|
46742 | 93 |
void print_on(outputStream* st) const; |
1 | 94 |
void verify(); |
47103
a993ec29ec75
8186842: Use Java class loaders for creating the CDS archive
ccheung
parents:
47098
diff
changeset
|
95 |
DictionaryEntry* bucket(int i) const { |
a993ec29ec75
8186842: Use Java class loaders for creating the CDS archive
ccheung
parents:
47098
diff
changeset
|
96 |
return (DictionaryEntry*)Hashtable<InstanceKlass*, mtClass>::bucket(i); |
a993ec29ec75
8186842: Use Java class loaders for creating the CDS archive
ccheung
parents:
47098
diff
changeset
|
97 |
} |
a993ec29ec75
8186842: Use Java class loaders for creating the CDS archive
ccheung
parents:
47098
diff
changeset
|
98 |
|
a993ec29ec75
8186842: Use Java class loaders for creating the CDS archive
ccheung
parents:
47098
diff
changeset
|
99 |
// The following method is not MT-safe and must be done under lock. |
a993ec29ec75
8186842: Use Java class loaders for creating the CDS archive
ccheung
parents:
47098
diff
changeset
|
100 |
DictionaryEntry** bucket_addr(int i) { |
a993ec29ec75
8186842: Use Java class loaders for creating the CDS archive
ccheung
parents:
47098
diff
changeset
|
101 |
return (DictionaryEntry**)Hashtable<InstanceKlass*, mtClass>::bucket_addr(i); |
a993ec29ec75
8186842: Use Java class loaders for creating the CDS archive
ccheung
parents:
47098
diff
changeset
|
102 |
} |
a993ec29ec75
8186842: Use Java class loaders for creating the CDS archive
ccheung
parents:
47098
diff
changeset
|
103 |
|
a993ec29ec75
8186842: Use Java class loaders for creating the CDS archive
ccheung
parents:
47098
diff
changeset
|
104 |
void add_entry(int index, DictionaryEntry* new_entry) { |
a993ec29ec75
8186842: Use Java class loaders for creating the CDS archive
ccheung
parents:
47098
diff
changeset
|
105 |
Hashtable<InstanceKlass*, mtClass>::add_entry(index, (HashtableEntry<InstanceKlass*, mtClass>*)new_entry); |
a993ec29ec75
8186842: Use Java class loaders for creating the CDS archive
ccheung
parents:
47098
diff
changeset
|
106 |
} |
a993ec29ec75
8186842: Use Java class loaders for creating the CDS archive
ccheung
parents:
47098
diff
changeset
|
107 |
|
a993ec29ec75
8186842: Use Java class loaders for creating the CDS archive
ccheung
parents:
47098
diff
changeset
|
108 |
void unlink_entry(DictionaryEntry* entry) { |
a993ec29ec75
8186842: Use Java class loaders for creating the CDS archive
ccheung
parents:
47098
diff
changeset
|
109 |
Hashtable<InstanceKlass*, mtClass>::unlink_entry((HashtableEntry<InstanceKlass*, mtClass>*)entry); |
a993ec29ec75
8186842: Use Java class loaders for creating the CDS archive
ccheung
parents:
47098
diff
changeset
|
110 |
} |
a993ec29ec75
8186842: Use Java class loaders for creating the CDS archive
ccheung
parents:
47098
diff
changeset
|
111 |
|
a993ec29ec75
8186842: Use Java class loaders for creating the CDS archive
ccheung
parents:
47098
diff
changeset
|
112 |
void free_entry(DictionaryEntry* entry); |
1 | 113 |
}; |
114 |
||
46729 | 115 |
// An entry in the class loader data dictionaries, this describes a class as |
116 |
// { InstanceKlass*, protection_domain }. |
|
1 | 117 |
|
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46274
diff
changeset
|
118 |
class DictionaryEntry : public HashtableEntry<InstanceKlass*, mtClass> { |
1 | 119 |
friend class VMStructs; |
120 |
private: |
|
121 |
// Contains the set of approved protection domains that can access |
|
46729 | 122 |
// this dictionary entry. |
20405 | 123 |
// |
124 |
// This protection domain set is a set of tuples: |
|
125 |
// |
|
126 |
// (InstanceKlass C, initiating class loader ICL, Protection Domain PD) |
|
127 |
// |
|
128 |
// [Note that C.protection_domain(), which is stored in the java.lang.Class |
|
129 |
// mirror of C, is NOT the same as PD] |
|
130 |
// |
|
131 |
// If such an entry (C, ICL, PD) exists in the table, it means that |
|
132 |
// it is okay for a class Foo to reference C, where |
|
133 |
// |
|
134 |
// Foo.protection_domain() == PD, and |
|
135 |
// Foo's defining class loader == ICL |
|
136 |
// |
|
137 |
// The usage of the PD set can be seen in SystemDictionary::validate_protection_domain() |
|
138 |
// It is essentially a cache to avoid repeated Java up-calls to |
|
139 |
// ClassLoader.checkPackageAccess(). |
|
140 |
// |
|
47098
e704f55561c3
8164207: Checking missing load-acquire in relation to _pd_set in dictionary.cpp
coleenp
parents:
46746
diff
changeset
|
141 |
ProtectionDomainEntry* volatile _pd_set; |
1 | 142 |
|
143 |
public: |
|
144 |
// Tells whether a protection is in the approved set. |
|
145 |
bool contains_protection_domain(oop protection_domain) const; |
|
146 |
// Adds a protection domain to the approved set. |
|
46274
534d019edb92
8175104: Unhandled oop in ProtectionDomainCacheTable::compute_hash
coleenp
parents:
42073
diff
changeset
|
147 |
void add_protection_domain(Dictionary* dict, Handle protection_domain); |
1 | 148 |
|
46729 | 149 |
InstanceKlass* instance_klass() const { return literal(); } |
46746
ea379ebb9447
8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
46742
diff
changeset
|
150 |
InstanceKlass** klass_addr() { return (InstanceKlass**)literal_addr(); } |
1 | 151 |
|
152 |
DictionaryEntry* next() const { |
|
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46274
diff
changeset
|
153 |
return (DictionaryEntry*)HashtableEntry<InstanceKlass*, mtClass>::next(); |
1 | 154 |
} |
155 |
||
156 |
DictionaryEntry** next_addr() { |
|
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46274
diff
changeset
|
157 |
return (DictionaryEntry**)HashtableEntry<InstanceKlass*, mtClass>::next_addr(); |
1 | 158 |
} |
159 |
||
47098
e704f55561c3
8164207: Checking missing load-acquire in relation to _pd_set in dictionary.cpp
coleenp
parents:
46746
diff
changeset
|
160 |
ProtectionDomainEntry* pd_set() const { return _pd_set; } |
e704f55561c3
8164207: Checking missing load-acquire in relation to _pd_set in dictionary.cpp
coleenp
parents:
46746
diff
changeset
|
161 |
void set_pd_set(ProtectionDomainEntry* new_head) { _pd_set = new_head; } |
e704f55561c3
8164207: Checking missing load-acquire in relation to _pd_set in dictionary.cpp
coleenp
parents:
46746
diff
changeset
|
162 |
|
e704f55561c3
8164207: Checking missing load-acquire in relation to _pd_set in dictionary.cpp
coleenp
parents:
46746
diff
changeset
|
163 |
ProtectionDomainEntry* pd_set_acquire() const { |
47634
6a0c42c40cd1
8188220: Remove Atomic::*_ptr() uses and overloads from hotspot
coleenp
parents:
47216
diff
changeset
|
164 |
return OrderAccess::load_acquire(&_pd_set); |
47098
e704f55561c3
8164207: Checking missing load-acquire in relation to _pd_set in dictionary.cpp
coleenp
parents:
46746
diff
changeset
|
165 |
} |
e704f55561c3
8164207: Checking missing load-acquire in relation to _pd_set in dictionary.cpp
coleenp
parents:
46746
diff
changeset
|
166 |
void release_set_pd_set(ProtectionDomainEntry* new_head) { |
47634
6a0c42c40cd1
8188220: Remove Atomic::*_ptr() uses and overloads from hotspot
coleenp
parents:
47216
diff
changeset
|
167 |
OrderAccess::release_store(&_pd_set, new_head); |
47098
e704f55561c3
8164207: Checking missing load-acquire in relation to _pd_set in dictionary.cpp
coleenp
parents:
46746
diff
changeset
|
168 |
} |
1 | 169 |
|
46729 | 170 |
// Tells whether the initiating class' protection domain can access the klass in this entry |
1 | 171 |
bool is_valid_protection_domain(Handle protection_domain) { |
172 |
if (!ProtectionDomainVerification) return true; |
|
173 |
if (!SystemDictionary::has_checkPackageAccess()) return true; |
|
174 |
||
175 |
return protection_domain() == NULL |
|
176 |
? true |
|
177 |
: contains_protection_domain(protection_domain()); |
|
178 |
} |
|
179 |
||
180 |
void verify_protection_domain_set() { |
|
47098
e704f55561c3
8164207: Checking missing load-acquire in relation to _pd_set in dictionary.cpp
coleenp
parents:
46746
diff
changeset
|
181 |
for (ProtectionDomainEntry* current = pd_set(); // accessed at a safepoint |
1 | 182 |
current != NULL; |
183 |
current = current->_next) { |
|
20405 | 184 |
current->_pd_cache->protection_domain()->verify(); |
1 | 185 |
} |
186 |
} |
|
187 |
||
46729 | 188 |
bool equals(const Symbol* class_name) const { |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46274
diff
changeset
|
189 |
InstanceKlass* klass = (InstanceKlass*)literal(); |
46729 | 190 |
return (klass->name() == class_name); |
1 | 191 |
} |
192 |
||
36381
b9ed6bef9364
8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
35498
diff
changeset
|
193 |
void print_count(outputStream *st) { |
1 | 194 |
int count = 0; |
47098
e704f55561c3
8164207: Checking missing load-acquire in relation to _pd_set in dictionary.cpp
coleenp
parents:
46746
diff
changeset
|
195 |
for (ProtectionDomainEntry* current = pd_set(); // accessed inside SD lock |
1 | 196 |
current != NULL; |
197 |
current = current->_next) { |
|
198 |
count++; |
|
199 |
} |
|
36381
b9ed6bef9364
8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
35498
diff
changeset
|
200 |
st->print_cr("pd set count = #%d", count); |
1 | 201 |
} |
46475
75902cea18af
8166848: Performance bug: SystemDictionary - optimization
coleenp
parents:
46382
diff
changeset
|
202 |
|
75902cea18af
8166848: Performance bug: SystemDictionary - optimization
coleenp
parents:
46382
diff
changeset
|
203 |
void verify(); |
1 | 204 |
}; |
2534 | 205 |
|
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
206 |
// Entry in a SymbolPropertyTable, mapping a single Symbol* |
2534 | 207 |
// to a managed and an unmanaged pointer. |
13195 | 208 |
class SymbolPropertyEntry : public HashtableEntry<Symbol*, mtSymbol> { |
2534 | 209 |
friend class VMStructs; |
210 |
private: |
|
5420
586d3988e72b
6939134: JSR 292 adjustments to method handle invocation
jrose
parents:
2534
diff
changeset
|
211 |
intptr_t _symbol_mode; // secondary key |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
212 |
Method* _method; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
213 |
oop _method_type; |
2534 | 214 |
|
215 |
public: |
|
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
216 |
Symbol* symbol() const { return literal(); } |
2534 | 217 |
|
5420
586d3988e72b
6939134: JSR 292 adjustments to method handle invocation
jrose
parents:
2534
diff
changeset
|
218 |
intptr_t symbol_mode() const { return _symbol_mode; } |
586d3988e72b
6939134: JSR 292 adjustments to method handle invocation
jrose
parents:
2534
diff
changeset
|
219 |
void set_symbol_mode(intptr_t m) { _symbol_mode = m; } |
586d3988e72b
6939134: JSR 292 adjustments to method handle invocation
jrose
parents:
2534
diff
changeset
|
220 |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
221 |
Method* method() const { return _method; } |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
222 |
void set_method(Method* p) { _method = p; } |
2534 | 223 |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
224 |
oop method_type() const { return _method_type; } |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
225 |
oop* method_type_addr() { return &_method_type; } |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
226 |
void set_method_type(oop p) { _method_type = p; } |
2534 | 227 |
|
228 |
SymbolPropertyEntry* next() const { |
|
13195 | 229 |
return (SymbolPropertyEntry*)HashtableEntry<Symbol*, mtSymbol>::next(); |
2534 | 230 |
} |
231 |
||
232 |
SymbolPropertyEntry** next_addr() { |
|
13195 | 233 |
return (SymbolPropertyEntry**)HashtableEntry<Symbol*, mtSymbol>::next_addr(); |
2534 | 234 |
} |
235 |
||
46742 | 236 |
void print_entry(outputStream* st) const { |
2534 | 237 |
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
|
238 |
st->print("/mode=" INTX_FORMAT, symbol_mode()); |
2534 | 239 |
st->print(" -> "); |
240 |
bool printed = false; |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
241 |
if (method() != NULL) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
242 |
method()->print_value_on(st); |
2534 | 243 |
printed = true; |
244 |
} |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
245 |
if (method_type() != NULL) { |
2534 | 246 |
if (printed) st->print(" and "); |
24424
2658d7834c6e
8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents:
20408
diff
changeset
|
247 |
st->print(INTPTR_FORMAT, p2i((void *)method_type())); |
2534 | 248 |
printed = true; |
249 |
} |
|
250 |
st->print_cr(printed ? "" : "(empty)"); |
|
251 |
} |
|
252 |
}; |
|
253 |
||
254 |
// A system-internal mapping of symbols to pointers, both managed |
|
255 |
// and unmanaged. Used to record the auto-generation of each method |
|
256 |
// MethodHandle.invoke(S)T, for all signatures (S)T. |
|
13195 | 257 |
class SymbolPropertyTable : public Hashtable<Symbol*, mtSymbol> { |
2534 | 258 |
friend class VMStructs; |
259 |
private: |
|
260 |
// The following method is not MT-safe and must be done under lock. |
|
261 |
SymbolPropertyEntry** bucket_addr(int i) { |
|
13195 | 262 |
return (SymbolPropertyEntry**) Hashtable<Symbol*, mtSymbol>::bucket_addr(i); |
2534 | 263 |
} |
264 |
||
265 |
void add_entry(int index, SymbolPropertyEntry* new_entry) { |
|
266 |
ShouldNotReachHere(); |
|
267 |
} |
|
268 |
void set_entry(int index, SymbolPropertyEntry* new_entry) { |
|
269 |
ShouldNotReachHere(); |
|
270 |
} |
|
271 |
||
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
272 |
SymbolPropertyEntry* new_entry(unsigned int hash, Symbol* symbol, intptr_t symbol_mode) { |
13195 | 273 |
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
|
274 |
// 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
|
275 |
symbol->increment_refcount(); |
5420
586d3988e72b
6939134: JSR 292 adjustments to method handle invocation
jrose
parents:
2534
diff
changeset
|
276 |
entry->set_symbol_mode(symbol_mode); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
277 |
entry->set_method(NULL); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
278 |
entry->set_method_type(NULL); |
2534 | 279 |
return entry; |
280 |
} |
|
281 |
||
282 |
public: |
|
283 |
SymbolPropertyTable(int table_size); |
|
13195 | 284 |
SymbolPropertyTable(int table_size, HashtableBucket<mtSymbol>* t, int number_of_entries); |
2534 | 285 |
|
286 |
void free_entry(SymbolPropertyEntry* entry) { |
|
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
287 |
// decrement Symbol refcount here because hashtable doesn't. |
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
288 |
entry->literal()->decrement_refcount(); |
13195 | 289 |
Hashtable<Symbol*, mtSymbol>::free_entry(entry); |
2534 | 290 |
} |
291 |
||
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
292 |
unsigned int compute_hash(Symbol* sym, intptr_t symbol_mode) { |
2534 | 293 |
// Use the regular identity_hash. |
13195 | 294 |
return Hashtable<Symbol*, mtSymbol>::compute_hash(sym) ^ symbol_mode; |
5420
586d3988e72b
6939134: JSR 292 adjustments to method handle invocation
jrose
parents:
2534
diff
changeset
|
295 |
} |
586d3988e72b
6939134: JSR 292 adjustments to method handle invocation
jrose
parents:
2534
diff
changeset
|
296 |
|
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
297 |
int index_for(Symbol* name, intptr_t symbol_mode) { |
5420
586d3988e72b
6939134: JSR 292 adjustments to method handle invocation
jrose
parents:
2534
diff
changeset
|
298 |
return hash_to_index(compute_hash(name, symbol_mode)); |
2534 | 299 |
} |
300 |
||
301 |
// need not be locked; no state change |
|
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
302 |
SymbolPropertyEntry* find_entry(int index, unsigned int hash, Symbol* name, intptr_t name_mode); |
2534 | 303 |
|
304 |
// must be done under SystemDictionary_lock |
|
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
305 |
SymbolPropertyEntry* add_entry(int index, unsigned int hash, Symbol* name, intptr_t name_mode); |
2534 | 306 |
|
307 |
// GC support |
|
308 |
void oops_do(OopClosure* f); |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
309 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
310 |
void methods_do(void f(Method*)); |
2534 | 311 |
|
312 |
void verify(); |
|
47103
a993ec29ec75
8186842: Use Java class loaders for creating the CDS archive
ccheung
parents:
47098
diff
changeset
|
313 |
|
a993ec29ec75
8186842: Use Java class loaders for creating the CDS archive
ccheung
parents:
47098
diff
changeset
|
314 |
SymbolPropertyEntry* bucket(int i) { |
a993ec29ec75
8186842: Use Java class loaders for creating the CDS archive
ccheung
parents:
47098
diff
changeset
|
315 |
return (SymbolPropertyEntry*) Hashtable<Symbol*, mtSymbol>::bucket(i); |
a993ec29ec75
8186842: Use Java class loaders for creating the CDS archive
ccheung
parents:
47098
diff
changeset
|
316 |
} |
2534 | 317 |
}; |
7397 | 318 |
#endif // SHARE_VM_CLASSFILE_DICTIONARY_HPP |