< prev index next >

src/hotspot/share/classfile/moduleEntry.cpp

Print this page

294   // Initialize fields specific to a ModuleEntry
295   entry->init();
296 
297   // Unnamed modules can read all other unnamed modules.
298   entry->set_can_read_all_unnamed();
299 
300   if (!module_handle.is_null()) {
301     entry->set_module(cld->add_handle(module_handle));
302   }
303 
304   entry->set_loader_data(cld);
305   entry->_is_open = true;
306 
307   JFR_ONLY(INIT_ID(entry);)
308 
309   return entry;
310 }
311 
312 void ModuleEntry::delete_unnamed_module() {
313   // Do not need unlink_entry() since the unnamed module is not in the hashtable
314   FREE_C_HEAP_ARRAY(char, this);
315 }
316 
317 ModuleEntryTable::ModuleEntryTable(int table_size)
318   : Hashtable<Symbol*, mtModule>(table_size, sizeof(ModuleEntry))
319 {
320 }
321 
322 ModuleEntryTable::~ModuleEntryTable() {
323   // Walk through all buckets and all entries in each bucket,
324   // freeing each entry.
325   for (int i = 0; i < table_size(); ++i) {
326     for (ModuleEntry* m = bucket(i); m != NULL;) {
327       ModuleEntry* to_remove = m;
328       // read next before freeing.
329       m = m->next();
330 
331       ResourceMark rm;
332       if (to_remove->name() != NULL) {
333         log_info(module, unload)("unloading module %s", to_remove->name()->as_C_string());
334       }

294   // Initialize fields specific to a ModuleEntry
295   entry->init();
296 
297   // Unnamed modules can read all other unnamed modules.
298   entry->set_can_read_all_unnamed();
299 
300   if (!module_handle.is_null()) {
301     entry->set_module(cld->add_handle(module_handle));
302   }
303 
304   entry->set_loader_data(cld);
305   entry->_is_open = true;
306 
307   JFR_ONLY(INIT_ID(entry);)
308 
309   return entry;
310 }
311 
312 void ModuleEntry::delete_unnamed_module() {
313   // Do not need unlink_entry() since the unnamed module is not in the hashtable
314   FREE_C_HEAP_OBJ(this);
315 }
316 
317 ModuleEntryTable::ModuleEntryTable(int table_size)
318   : Hashtable<Symbol*, mtModule>(table_size, sizeof(ModuleEntry))
319 {
320 }
321 
322 ModuleEntryTable::~ModuleEntryTable() {
323   // Walk through all buckets and all entries in each bucket,
324   // freeing each entry.
325   for (int i = 0; i < table_size(); ++i) {
326     for (ModuleEntry* m = bucket(i); m != NULL;) {
327       ModuleEntry* to_remove = m;
328       // read next before freeing.
329       m = m->next();
330 
331       ResourceMark rm;
332       if (to_remove->name() != NULL) {
333         log_info(module, unload)("unloading module %s", to_remove->name()->as_C_string());
334       }
< prev index next >