< prev index next >

src/hotspot/share/classfile/packageEntry.cpp

Print this page


 174 PackageEntryTable::~PackageEntryTable() {
 175   // Walk through all buckets and all entries in each bucket,
 176   // freeing each entry.
 177   for (int i = 0; i < table_size(); ++i) {
 178     for (PackageEntry* p = bucket(i); p != NULL;) {
 179       PackageEntry* to_remove = p;
 180       // read next before freeing.
 181       p = p->next();
 182 
 183       // Clean out the C heap allocated qualified exports list first before freeing the entry
 184       to_remove->delete_qualified_exports();
 185       to_remove->name()->decrement_refcount();
 186 
 187       // Unlink from the Hashtable prior to freeing
 188       unlink_entry(to_remove);
 189       FREE_C_HEAP_ARRAY(char, to_remove);
 190     }
 191   }
 192   assert(number_of_entries() == 0, "should have removed all entries");
 193   assert(new_entry_free_list() == NULL, "entry present on PackageEntryTable's free list");
 194   free_buckets();
 195 }
 196 
 197 PackageEntry* PackageEntryTable::new_entry(unsigned int hash, Symbol* name, ModuleEntry* module) {
 198   assert(Module_lock->owned_by_self(), "should have the Module_lock");
 199   PackageEntry* entry = (PackageEntry*)Hashtable<Symbol*, mtModule>::allocate_new_entry(hash, name);
 200 
 201   JFR_ONLY(INIT_ID(entry);)
 202 
 203   // Initialize fields specific to a PackageEntry
 204   entry->init();
 205   entry->name()->increment_refcount();
 206   entry->set_module(module);
 207   return entry;
 208 }
 209 
 210 void PackageEntryTable::add_entry(int index, PackageEntry* new_entry) {
 211   assert(Module_lock->owned_by_self(), "should have the Module_lock");
 212   Hashtable<Symbol*, mtModule>::add_entry(index, (HashtableEntry<Symbol*, mtModule>*)new_entry);
 213 }
 214 




 174 PackageEntryTable::~PackageEntryTable() {
 175   // Walk through all buckets and all entries in each bucket,
 176   // freeing each entry.
 177   for (int i = 0; i < table_size(); ++i) {
 178     for (PackageEntry* p = bucket(i); p != NULL;) {
 179       PackageEntry* to_remove = p;
 180       // read next before freeing.
 181       p = p->next();
 182 
 183       // Clean out the C heap allocated qualified exports list first before freeing the entry
 184       to_remove->delete_qualified_exports();
 185       to_remove->name()->decrement_refcount();
 186 
 187       // Unlink from the Hashtable prior to freeing
 188       unlink_entry(to_remove);
 189       FREE_C_HEAP_ARRAY(char, to_remove);
 190     }
 191   }
 192   assert(number_of_entries() == 0, "should have removed all entries");
 193   assert(new_entry_free_list() == NULL, "entry present on PackageEntryTable's free list");

 194 }
 195 
 196 PackageEntry* PackageEntryTable::new_entry(unsigned int hash, Symbol* name, ModuleEntry* module) {
 197   assert(Module_lock->owned_by_self(), "should have the Module_lock");
 198   PackageEntry* entry = (PackageEntry*)Hashtable<Symbol*, mtModule>::allocate_new_entry(hash, name);
 199 
 200   JFR_ONLY(INIT_ID(entry);)
 201 
 202   // Initialize fields specific to a PackageEntry
 203   entry->init();
 204   entry->name()->increment_refcount();
 205   entry->set_module(module);
 206   return entry;
 207 }
 208 
 209 void PackageEntryTable::add_entry(int index, PackageEntry* new_entry) {
 210   assert(Module_lock->owned_by_self(), "should have the Module_lock");
 211   Hashtable<Symbol*, mtModule>::add_entry(index, (HashtableEntry<Symbol*, mtModule>*)new_entry);
 212 }
 213 


< prev index next >