hotspot/src/share/vm/classfile/dictionary.cpp
changeset 46380 4a51438196cf
parent 46329 53ccc37bda19
child 46382 5520c435279b
equal deleted inserted replaced
46379:43ec76e10184 46380:4a51438196cf
   264   // Then iterate over the protection domain cache to apply the closure on the
   264   // Then iterate over the protection domain cache to apply the closure on the
   265   // previously marked ones.
   265   // previously marked ones.
   266   _pd_cache_table->always_strong_oops_do(blk);
   266   _pd_cache_table->always_strong_oops_do(blk);
   267 }
   267 }
   268 
   268 
   269 
       
   270 void Dictionary::always_strong_classes_do(KlassClosure* closure) {
       
   271   // Follow all system classes and temporary placeholders in dictionary
       
   272   for (int index = 0; index < table_size(); index++) {
       
   273     for (DictionaryEntry* probe = bucket(index);
       
   274                           probe != NULL;
       
   275                           probe = probe->next()) {
       
   276       Klass* e = probe->klass();
       
   277       ClassLoaderData* loader_data = probe->loader_data();
       
   278       if (is_strongly_reachable(loader_data, e)) {
       
   279         closure->do_klass(e);
       
   280       }
       
   281     }
       
   282   }
       
   283 }
       
   284 
       
   285 
       
   286 //   Just the classes from defining class loaders
   269 //   Just the classes from defining class loaders
   287 void Dictionary::classes_do(void f(Klass*)) {
   270 void Dictionary::classes_do(void f(Klass*)) {
   288   for (int index = 0; index < table_size(); index++) {
   271   for (int index = 0; index < table_size(); index++) {
   289     for (DictionaryEntry* probe = bucket(index);
   272     for (DictionaryEntry* probe = bucket(index);
   290                           probe != NULL;
   273                           probe != NULL;
   327 
   310 
   328 void Dictionary::oops_do(OopClosure* f) {
   311 void Dictionary::oops_do(OopClosure* f) {
   329   // Only the protection domain oops contain references into the heap. Iterate
   312   // Only the protection domain oops contain references into the heap. Iterate
   330   // over all of them.
   313   // over all of them.
   331   _pd_cache_table->oops_do(f);
   314   _pd_cache_table->oops_do(f);
   332 }
       
   333 
       
   334 void Dictionary::methods_do(void f(Method*)) {
       
   335   for (int index = 0; index < table_size(); index++) {
       
   336     for (DictionaryEntry* probe = bucket(index);
       
   337                           probe != NULL;
       
   338                           probe = probe->next()) {
       
   339       Klass* k = probe->klass();
       
   340       if (probe->loader_data() == k->class_loader_data()) {
       
   341         // only take klass is we have the entry with the defining class loader
       
   342         InstanceKlass::cast(k)->methods_do(f);
       
   343       }
       
   344     }
       
   345   }
       
   346 }
   315 }
   347 
   316 
   348 void Dictionary::unlink(BoolObjectClosure* is_alive) {
   317 void Dictionary::unlink(BoolObjectClosure* is_alive) {
   349   // Only the protection domain cache table may contain references to the heap
   318   // Only the protection domain cache table may contain references to the heap
   350   // that need to be unlinked.
   319   // that need to be unlinked.
   649   ProtectionDomainCacheEntry* p = new_entry(hash, protection_domain);
   618   ProtectionDomainCacheEntry* p = new_entry(hash, protection_domain);
   650   Hashtable<oop, mtClass>::add_entry(index, p);
   619   Hashtable<oop, mtClass>::add_entry(index, p);
   651   return p;
   620   return p;
   652 }
   621 }
   653 
   622 
   654 void ProtectionDomainCacheTable::free(ProtectionDomainCacheEntry* to_delete) {
       
   655   unsigned int hash = compute_hash(Handle(Thread::current(), to_delete->protection_domain()));
       
   656   int index = hash_to_index(hash);
       
   657 
       
   658   ProtectionDomainCacheEntry** p = bucket_addr(index);
       
   659   ProtectionDomainCacheEntry* entry = bucket(index);
       
   660   while (true) {
       
   661     assert(entry != NULL, "sanity");
       
   662 
       
   663     if (entry == to_delete) {
       
   664       *p = entry->next();
       
   665       Hashtable<oop, mtClass>::free_entry(entry);
       
   666       break;
       
   667     } else {
       
   668       p = entry->next_addr();
       
   669       entry = *p;
       
   670     }
       
   671   }
       
   672 }
       
   673 
   623 
   674 SymbolPropertyTable::SymbolPropertyTable(int table_size)
   624 SymbolPropertyTable::SymbolPropertyTable(int table_size)
   675   : Hashtable<Symbol*, mtSymbol>(table_size, sizeof(SymbolPropertyEntry))
   625   : Hashtable<Symbol*, mtSymbol>(table_size, sizeof(SymbolPropertyEntry))
   676 {
   626 {
   677 }
   627 }