src/share/vm/classfile/dictionary.hpp

Wed, 11 May 2016 12:03:46 -0400

author
shshahma
date
Wed, 11 May 2016 12:03:46 -0400
changeset 8525
0095e54dcaa1
parent 8497
50e62b688ddc
child 8604
04d83ba48607
child 9327
f96fcd9e1e1b
permissions
-rw-r--r--

8155981: Bolster bytecode verification
Reviewed-by: acorn, jdn
Contributed-by: harold.seigel@oracle.com

duke@435 1 /*
iklam@8497 2 * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
duke@435 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@435 4 *
duke@435 5 * This code is free software; you can redistribute it and/or modify it
duke@435 6 * under the terms of the GNU General Public License version 2 only, as
duke@435 7 * published by the Free Software Foundation.
duke@435 8 *
duke@435 9 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@435 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@435 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@435 12 * version 2 for more details (a copy is included in the LICENSE file that
duke@435 13 * accompanied this code).
duke@435 14 *
duke@435 15 * You should have received a copy of the GNU General Public License version
duke@435 16 * 2 along with this work; if not, write to the Free Software Foundation,
duke@435 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@435 18 *
trims@1907 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
trims@1907 20 * or visit www.oracle.com if you need additional information or have any
trims@1907 21 * questions.
duke@435 22 *
duke@435 23 */
duke@435 24
stefank@2314 25 #ifndef SHARE_VM_CLASSFILE_DICTIONARY_HPP
stefank@2314 26 #define SHARE_VM_CLASSFILE_DICTIONARY_HPP
stefank@2314 27
stefank@2314 28 #include "classfile/systemDictionary.hpp"
stefank@2314 29 #include "oops/instanceKlass.hpp"
tschatzl@5862 30 #include "oops/oop.inline.hpp"
stefank@2314 31 #include "utilities/hashtable.hpp"
stefank@2314 32
duke@435 33 class DictionaryEntry;
coleenp@4037 34 class PSPromotionManager;
tschatzl@5862 35 class ProtectionDomainCacheTable;
tschatzl@5862 36 class ProtectionDomainCacheEntry;
tschatzl@5862 37 class BoolObjectClosure;
duke@435 38
duke@435 39 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
duke@435 40 // The data structure for the system dictionary (and the shared system
duke@435 41 // dictionary).
duke@435 42
coleenp@4037 43 class Dictionary : public TwoOopHashtable<Klass*, mtClass> {
duke@435 44 friend class VMStructs;
duke@435 45 private:
duke@435 46 // current iteration index.
duke@435 47 static int _current_class_index;
duke@435 48 // pointer to the current hash table entry.
duke@435 49 static DictionaryEntry* _current_class_entry;
duke@435 50
tschatzl@5862 51 ProtectionDomainCacheTable* _pd_cache_table;
tschatzl@5862 52
duke@435 53 DictionaryEntry* get_entry(int index, unsigned int hash,
coleenp@4037 54 Symbol* name, ClassLoaderData* loader_data);
duke@435 55
iklam@8497 56 protected:
duke@435 57 DictionaryEntry* bucket(int i) {
coleenp@4037 58 return (DictionaryEntry*)Hashtable<Klass*, mtClass>::bucket(i);
duke@435 59 }
duke@435 60
duke@435 61 // The following method is not MT-safe and must be done under lock.
duke@435 62 DictionaryEntry** bucket_addr(int i) {
coleenp@4037 63 return (DictionaryEntry**)Hashtable<Klass*, mtClass>::bucket_addr(i);
duke@435 64 }
duke@435 65
duke@435 66 void add_entry(int index, DictionaryEntry* new_entry) {
coleenp@4037 67 Hashtable<Klass*, mtClass>::add_entry(index, (HashtableEntry<Klass*, mtClass>*)new_entry);
duke@435 68 }
duke@435 69
iklam@8497 70 static size_t entry_size();
iklam@8497 71
duke@435 72 public:
duke@435 73 Dictionary(int table_size);
zgu@3900 74 Dictionary(int table_size, HashtableBucket<mtClass>* t, int number_of_entries);
duke@435 75
coleenp@4037 76 DictionaryEntry* new_entry(unsigned int hash, Klass* klass, ClassLoaderData* loader_data);
duke@435 77
duke@435 78 DictionaryEntry* new_entry();
duke@435 79
duke@435 80 void free_entry(DictionaryEntry* entry);
duke@435 81
coleenp@4037 82 void add_klass(Symbol* class_name, ClassLoaderData* loader_data,KlassHandle obj);
duke@435 83
coleenp@4037 84 Klass* find_class(int index, unsigned int hash,
coleenp@4037 85 Symbol* name, ClassLoaderData* loader_data);
duke@435 86
coleenp@4037 87 Klass* find_shared_class(int index, unsigned int hash, Symbol* name);
duke@435 88
duke@435 89 // Compiler support
coleenp@4037 90 Klass* try_get_next_class();
duke@435 91
duke@435 92 // GC support
coleenp@4037 93 void oops_do(OopClosure* f);
coleenp@4037 94 void always_strong_oops_do(OopClosure* blk);
stefank@6992 95 void roots_oops_do(OopClosure* strong, OopClosure* weak);
duke@435 96
coleenp@4037 97 void always_strong_classes_do(KlassClosure* closure);
duke@435 98
coleenp@4037 99 void classes_do(void f(Klass*));
coleenp@4037 100 void classes_do(void f(Klass*, TRAPS), TRAPS);
coleenp@4037 101 void classes_do(void f(Klass*, ClassLoaderData*));
coleenp@4037 102
coleenp@4037 103 void methods_do(void f(Method*));
duke@435 104
tschatzl@5862 105 void unlink(BoolObjectClosure* is_alive);
iklam@7089 106 void remove_classes_in_error_state();
duke@435 107
duke@435 108 // Classes loaded by the bootstrap loader are always strongly reachable.
duke@435 109 // If we're not doing class unloading, all classes are strongly reachable.
coleenp@4037 110 static bool is_strongly_reachable(ClassLoaderData* loader_data, Klass* klass) {
duke@435 111 assert (klass != NULL, "should have non-null klass");
coleenp@4037 112 return (loader_data->is_the_null_class_loader_data() || !ClassUnloading);
duke@435 113 }
duke@435 114
thartmann@7064 115 // Unload (that is, break root links to) all unmarked classes and loaders.
thartmann@7064 116 void do_unloading();
duke@435 117
duke@435 118 // Protection domains
coleenp@4037 119 Klass* find(int index, unsigned int hash, Symbol* name,
coleenp@4037 120 ClassLoaderData* loader_data, Handle protection_domain, TRAPS);
duke@435 121 bool is_valid_protection_domain(int index, unsigned int hash,
coleenp@4037 122 Symbol* name, ClassLoaderData* loader_data,
duke@435 123 Handle protection_domain);
duke@435 124 void add_protection_domain(int index, unsigned int hash,
coleenp@4037 125 instanceKlassHandle klass, ClassLoaderData* loader_data,
duke@435 126 Handle protection_domain, TRAPS);
duke@435 127
duke@435 128 // Sharing support
duke@435 129 void reorder_dictionary();
duke@435 130
tschatzl@5862 131 ProtectionDomainCacheEntry* cache_get(oop protection_domain);
duke@435 132
iklam@7089 133 void print(bool details = true);
duke@435 134 void verify();
duke@435 135 };
duke@435 136
duke@435 137 // The following classes can be in dictionary.cpp, but we need these
tschatzl@5862 138 // to be in header file so that SA's vmStructs can access them.
tschatzl@5862 139 class ProtectionDomainCacheEntry : public HashtableEntry<oop, mtClass> {
tschatzl@5862 140 friend class VMStructs;
tschatzl@5862 141 private:
tschatzl@5862 142 // Flag indicating whether this protection domain entry is strongly reachable.
tschatzl@5862 143 // Used during iterating over the system dictionary to remember oops that need
tschatzl@5862 144 // to be updated.
tschatzl@5862 145 bool _strongly_reachable;
tschatzl@5862 146 public:
tschatzl@5862 147 oop protection_domain() { return literal(); }
tschatzl@5862 148
tschatzl@5862 149 void init() {
tschatzl@5862 150 _strongly_reachable = false;
tschatzl@5862 151 }
tschatzl@5862 152
tschatzl@5862 153 ProtectionDomainCacheEntry* next() {
tschatzl@5862 154 return (ProtectionDomainCacheEntry*)HashtableEntry<oop, mtClass>::next();
tschatzl@5862 155 }
tschatzl@5862 156
tschatzl@5862 157 ProtectionDomainCacheEntry** next_addr() {
tschatzl@5862 158 return (ProtectionDomainCacheEntry**)HashtableEntry<oop, mtClass>::next_addr();
tschatzl@5862 159 }
tschatzl@5862 160
tschatzl@5862 161 void oops_do(OopClosure* f) {
tschatzl@5862 162 f->do_oop(literal_addr());
tschatzl@5862 163 }
tschatzl@5862 164
tschatzl@5862 165 void set_strongly_reachable() { _strongly_reachable = true; }
tschatzl@5862 166 bool is_strongly_reachable() { return _strongly_reachable; }
tschatzl@5862 167 void reset_strongly_reachable() { _strongly_reachable = false; }
tschatzl@5862 168
tschatzl@5862 169 void print() PRODUCT_RETURN;
tschatzl@5862 170 void verify();
tschatzl@5862 171 };
tschatzl@5862 172
tschatzl@5862 173 // The ProtectionDomainCacheTable contains all protection domain oops. The system
tschatzl@5862 174 // dictionary entries reference its entries instead of having references to oops
tschatzl@5862 175 // directly.
tschatzl@5862 176 // This is used to speed up system dictionary iteration: the oops in the
tschatzl@5862 177 // protection domain are the only ones referring the Java heap. So when there is
tschatzl@5862 178 // need to update these, instead of going over every entry of the system dictionary,
tschatzl@5862 179 // we only need to iterate over this set.
tschatzl@5862 180 // The amount of different protection domains used is typically magnitudes smaller
tschatzl@5862 181 // than the number of system dictionary entries (loaded classes).
tschatzl@5862 182 class ProtectionDomainCacheTable : public Hashtable<oop, mtClass> {
tschatzl@5862 183 friend class VMStructs;
tschatzl@5862 184 private:
tschatzl@5862 185 ProtectionDomainCacheEntry* bucket(int i) {
tschatzl@5862 186 return (ProtectionDomainCacheEntry*) Hashtable<oop, mtClass>::bucket(i);
tschatzl@5862 187 }
tschatzl@5862 188
tschatzl@5862 189 // The following method is not MT-safe and must be done under lock.
tschatzl@5862 190 ProtectionDomainCacheEntry** bucket_addr(int i) {
tschatzl@5862 191 return (ProtectionDomainCacheEntry**) Hashtable<oop, mtClass>::bucket_addr(i);
tschatzl@5862 192 }
tschatzl@5862 193
tschatzl@5862 194 ProtectionDomainCacheEntry* new_entry(unsigned int hash, oop protection_domain) {
tschatzl@5862 195 ProtectionDomainCacheEntry* entry = (ProtectionDomainCacheEntry*) Hashtable<oop, mtClass>::new_entry(hash, protection_domain);
tschatzl@5862 196 entry->init();
tschatzl@5862 197 return entry;
tschatzl@5862 198 }
tschatzl@5862 199
tschatzl@5862 200 static unsigned int compute_hash(oop protection_domain) {
tschatzl@5862 201 return (unsigned int)(protection_domain->identity_hash());
tschatzl@5862 202 }
tschatzl@5862 203
tschatzl@5862 204 int index_for(oop protection_domain) {
tschatzl@5862 205 return hash_to_index(compute_hash(protection_domain));
tschatzl@5862 206 }
tschatzl@5862 207
tschatzl@5862 208 ProtectionDomainCacheEntry* add_entry(int index, unsigned int hash, oop protection_domain);
tschatzl@5862 209 ProtectionDomainCacheEntry* find_entry(int index, oop protection_domain);
tschatzl@5862 210
tschatzl@5862 211 public:
tschatzl@5862 212
tschatzl@5862 213 ProtectionDomainCacheTable(int table_size);
tschatzl@5862 214
tschatzl@5862 215 ProtectionDomainCacheEntry* get(oop protection_domain);
tschatzl@5862 216 void free(ProtectionDomainCacheEntry* entry);
tschatzl@5862 217
tschatzl@5862 218 void unlink(BoolObjectClosure* cl);
tschatzl@5862 219
tschatzl@5862 220 // GC support
tschatzl@5862 221 void oops_do(OopClosure* f);
tschatzl@5862 222 void always_strong_oops_do(OopClosure* f);
stefank@6992 223 void roots_oops_do(OopClosure* strong, OopClosure* weak);
tschatzl@5862 224
tschatzl@5862 225 static uint bucket_size();
tschatzl@5862 226
tschatzl@5862 227 void print() PRODUCT_RETURN;
tschatzl@5862 228 void verify();
tschatzl@5862 229 };
tschatzl@5862 230
duke@435 231
zgu@3900 232 class ProtectionDomainEntry :public CHeapObj<mtClass> {
duke@435 233 friend class VMStructs;
duke@435 234 public:
duke@435 235 ProtectionDomainEntry* _next;
tschatzl@5862 236 ProtectionDomainCacheEntry* _pd_cache;
duke@435 237
tschatzl@5862 238 ProtectionDomainEntry(ProtectionDomainCacheEntry* pd_cache, ProtectionDomainEntry* next) {
tschatzl@5862 239 _pd_cache = pd_cache;
tschatzl@5862 240 _next = next;
duke@435 241 }
duke@435 242
duke@435 243 ProtectionDomainEntry* next() { return _next; }
tschatzl@5862 244 oop protection_domain() { return _pd_cache->protection_domain(); }
duke@435 245 };
duke@435 246
duke@435 247 // An entry in the system dictionary, this describes a class as
coleenp@4037 248 // { Klass*, loader, protection_domain }.
duke@435 249
coleenp@4037 250 class DictionaryEntry : public HashtableEntry<Klass*, mtClass> {
duke@435 251 friend class VMStructs;
duke@435 252 private:
duke@435 253 // Contains the set of approved protection domains that can access
duke@435 254 // this system dictionary entry.
tschatzl@5862 255 //
tschatzl@5862 256 // This protection domain set is a set of tuples:
tschatzl@5862 257 //
tschatzl@5862 258 // (InstanceKlass C, initiating class loader ICL, Protection Domain PD)
tschatzl@5862 259 //
tschatzl@5862 260 // [Note that C.protection_domain(), which is stored in the java.lang.Class
tschatzl@5862 261 // mirror of C, is NOT the same as PD]
tschatzl@5862 262 //
tschatzl@5862 263 // If such an entry (C, ICL, PD) exists in the table, it means that
tschatzl@5862 264 // it is okay for a class Foo to reference C, where
tschatzl@5862 265 //
tschatzl@5862 266 // Foo.protection_domain() == PD, and
tschatzl@5862 267 // Foo's defining class loader == ICL
tschatzl@5862 268 //
tschatzl@5862 269 // The usage of the PD set can be seen in SystemDictionary::validate_protection_domain()
tschatzl@5862 270 // It is essentially a cache to avoid repeated Java up-calls to
tschatzl@5862 271 // ClassLoader.checkPackageAccess().
tschatzl@5862 272 //
duke@435 273 ProtectionDomainEntry* _pd_set;
coleenp@4037 274 ClassLoaderData* _loader_data;
duke@435 275
duke@435 276 public:
duke@435 277 // Tells whether a protection is in the approved set.
duke@435 278 bool contains_protection_domain(oop protection_domain) const;
duke@435 279 // Adds a protection domain to the approved set.
tschatzl@5862 280 void add_protection_domain(Dictionary* dict, oop protection_domain);
duke@435 281
coleenp@4037 282 Klass* klass() const { return (Klass*)literal(); }
coleenp@4037 283 Klass** klass_addr() { return (Klass**)literal_addr(); }
duke@435 284
duke@435 285 DictionaryEntry* next() const {
coleenp@4037 286 return (DictionaryEntry*)HashtableEntry<Klass*, mtClass>::next();
duke@435 287 }
duke@435 288
duke@435 289 DictionaryEntry** next_addr() {
coleenp@4037 290 return (DictionaryEntry**)HashtableEntry<Klass*, mtClass>::next_addr();
duke@435 291 }
duke@435 292
coleenp@4037 293 ClassLoaderData* loader_data() const { return _loader_data; }
coleenp@4037 294 void set_loader_data(ClassLoaderData* loader_data) { _loader_data = loader_data; }
duke@435 295
duke@435 296 ProtectionDomainEntry* pd_set() const { return _pd_set; }
duke@435 297 void set_pd_set(ProtectionDomainEntry* pd_set) { _pd_set = pd_set; }
duke@435 298
duke@435 299 bool has_protection_domain() { return _pd_set != NULL; }
duke@435 300
duke@435 301 // Tells whether the initiating class' protection can access the this _klass
duke@435 302 bool is_valid_protection_domain(Handle protection_domain) {
duke@435 303 if (!ProtectionDomainVerification) return true;
duke@435 304 if (!SystemDictionary::has_checkPackageAccess()) return true;
duke@435 305
duke@435 306 return protection_domain() == NULL
duke@435 307 ? true
duke@435 308 : contains_protection_domain(protection_domain());
duke@435 309 }
duke@435 310
tschatzl@5862 311 void set_strongly_reachable() {
duke@435 312 for (ProtectionDomainEntry* current = _pd_set;
duke@435 313 current != NULL;
duke@435 314 current = current->_next) {
tschatzl@5862 315 current->_pd_cache->set_strongly_reachable();
duke@435 316 }
duke@435 317 }
duke@435 318
duke@435 319 void verify_protection_domain_set() {
duke@435 320 for (ProtectionDomainEntry* current = _pd_set;
duke@435 321 current != NULL;
duke@435 322 current = current->_next) {
tschatzl@5862 323 current->_pd_cache->protection_domain()->verify();
duke@435 324 }
duke@435 325 }
duke@435 326
coleenp@4037 327 bool equals(Symbol* class_name, ClassLoaderData* loader_data) const {
coleenp@4037 328 Klass* klass = (Klass*)literal();
coleenp@4037 329 return (InstanceKlass::cast(klass)->name() == class_name &&
coleenp@4037 330 _loader_data == loader_data);
duke@435 331 }
duke@435 332
duke@435 333 void print() {
duke@435 334 int count = 0;
duke@435 335 for (ProtectionDomainEntry* current = _pd_set;
duke@435 336 current != NULL;
duke@435 337 current = current->_next) {
duke@435 338 count++;
duke@435 339 }
duke@435 340 tty->print_cr("pd set = #%d", count);
duke@435 341 }
duke@435 342 };
jrose@1145 343
coleenp@2497 344 // Entry in a SymbolPropertyTable, mapping a single Symbol*
jrose@1145 345 // to a managed and an unmanaged pointer.
zgu@3900 346 class SymbolPropertyEntry : public HashtableEntry<Symbol*, mtSymbol> {
jrose@1145 347 friend class VMStructs;
jrose@1145 348 private:
jrose@1862 349 intptr_t _symbol_mode; // secondary key
coleenp@4037 350 Method* _method;
coleenp@4037 351 oop _method_type;
jrose@1145 352
jrose@1145 353 public:
coleenp@2497 354 Symbol* symbol() const { return literal(); }
jrose@1145 355
jrose@1862 356 intptr_t symbol_mode() const { return _symbol_mode; }
jrose@1862 357 void set_symbol_mode(intptr_t m) { _symbol_mode = m; }
jrose@1862 358
coleenp@4037 359 Method* method() const { return _method; }
coleenp@4037 360 void set_method(Method* p) { _method = p; }
jrose@1145 361
coleenp@4037 362 oop method_type() const { return _method_type; }
coleenp@4037 363 oop* method_type_addr() { return &_method_type; }
coleenp@4037 364 void set_method_type(oop p) { _method_type = p; }
jrose@1145 365
jrose@1145 366 SymbolPropertyEntry* next() const {
zgu@3900 367 return (SymbolPropertyEntry*)HashtableEntry<Symbol*, mtSymbol>::next();
jrose@1145 368 }
jrose@1145 369
jrose@1145 370 SymbolPropertyEntry** next_addr() {
zgu@3900 371 return (SymbolPropertyEntry**)HashtableEntry<Symbol*, mtSymbol>::next_addr();
jrose@1145 372 }
jrose@1145 373
jrose@1145 374 void print_on(outputStream* st) const {
jrose@1145 375 symbol()->print_value_on(st);
jrose@1862 376 st->print("/mode="INTX_FORMAT, symbol_mode());
jrose@1145 377 st->print(" -> ");
jrose@1145 378 bool printed = false;
coleenp@4037 379 if (method() != NULL) {
coleenp@4037 380 method()->print_value_on(st);
jrose@1145 381 printed = true;
jrose@1145 382 }
coleenp@4037 383 if (method_type() != NULL) {
jrose@1145 384 if (printed) st->print(" and ");
drchase@6680 385 st->print(INTPTR_FORMAT, p2i((void *)method_type()));
jrose@1145 386 printed = true;
jrose@1145 387 }
jrose@1145 388 st->print_cr(printed ? "" : "(empty)");
jrose@1145 389 }
jrose@1145 390 };
jrose@1145 391
jrose@1145 392 // A system-internal mapping of symbols to pointers, both managed
jrose@1145 393 // and unmanaged. Used to record the auto-generation of each method
jrose@1145 394 // MethodHandle.invoke(S)T, for all signatures (S)T.
zgu@3900 395 class SymbolPropertyTable : public Hashtable<Symbol*, mtSymbol> {
jrose@1145 396 friend class VMStructs;
jrose@1145 397 private:
jrose@1145 398 SymbolPropertyEntry* bucket(int i) {
zgu@3900 399 return (SymbolPropertyEntry*) Hashtable<Symbol*, mtSymbol>::bucket(i);
jrose@1145 400 }
jrose@1145 401
jrose@1145 402 // The following method is not MT-safe and must be done under lock.
jrose@1145 403 SymbolPropertyEntry** bucket_addr(int i) {
zgu@3900 404 return (SymbolPropertyEntry**) Hashtable<Symbol*, mtSymbol>::bucket_addr(i);
jrose@1145 405 }
jrose@1145 406
jrose@1145 407 void add_entry(int index, SymbolPropertyEntry* new_entry) {
jrose@1145 408 ShouldNotReachHere();
jrose@1145 409 }
jrose@1145 410 void set_entry(int index, SymbolPropertyEntry* new_entry) {
jrose@1145 411 ShouldNotReachHere();
jrose@1145 412 }
jrose@1145 413
coleenp@2497 414 SymbolPropertyEntry* new_entry(unsigned int hash, Symbol* symbol, intptr_t symbol_mode) {
zgu@3900 415 SymbolPropertyEntry* entry = (SymbolPropertyEntry*) Hashtable<Symbol*, mtSymbol>::new_entry(hash, symbol);
coleenp@2497 416 // Hashtable with Symbol* literal must increment and decrement refcount.
coleenp@2497 417 symbol->increment_refcount();
jrose@1862 418 entry->set_symbol_mode(symbol_mode);
coleenp@4037 419 entry->set_method(NULL);
coleenp@4037 420 entry->set_method_type(NULL);
jrose@1145 421 return entry;
jrose@1145 422 }
jrose@1145 423
jrose@1145 424 public:
jrose@1145 425 SymbolPropertyTable(int table_size);
zgu@3900 426 SymbolPropertyTable(int table_size, HashtableBucket<mtSymbol>* t, int number_of_entries);
jrose@1145 427
jrose@1145 428 void free_entry(SymbolPropertyEntry* entry) {
coleenp@2497 429 // decrement Symbol refcount here because hashtable doesn't.
coleenp@2497 430 entry->literal()->decrement_refcount();
zgu@3900 431 Hashtable<Symbol*, mtSymbol>::free_entry(entry);
jrose@1145 432 }
jrose@1145 433
coleenp@2497 434 unsigned int compute_hash(Symbol* sym, intptr_t symbol_mode) {
jrose@1145 435 // Use the regular identity_hash.
zgu@3900 436 return Hashtable<Symbol*, mtSymbol>::compute_hash(sym) ^ symbol_mode;
jrose@1862 437 }
jrose@1862 438
coleenp@2497 439 int index_for(Symbol* name, intptr_t symbol_mode) {
jrose@1862 440 return hash_to_index(compute_hash(name, symbol_mode));
jrose@1145 441 }
jrose@1145 442
jrose@1145 443 // need not be locked; no state change
coleenp@2497 444 SymbolPropertyEntry* find_entry(int index, unsigned int hash, Symbol* name, intptr_t name_mode);
jrose@1145 445
jrose@1145 446 // must be done under SystemDictionary_lock
coleenp@2497 447 SymbolPropertyEntry* add_entry(int index, unsigned int hash, Symbol* name, intptr_t name_mode);
jrose@1145 448
jrose@1145 449 // GC support
jrose@1145 450 void oops_do(OopClosure* f);
coleenp@4037 451
coleenp@4037 452 void methods_do(void f(Method*));
jrose@1145 453
jrose@1145 454 // Sharing support
jrose@1145 455 void reorder_dictionary();
jrose@1145 456
jrose@1145 457 #ifndef PRODUCT
jrose@1145 458 void print();
jrose@1145 459 #endif
jrose@1145 460 void verify();
jrose@1145 461 };
stefank@2314 462 #endif // SHARE_VM_CLASSFILE_DICTIONARY_HPP

mercurial