< prev index next >

src/hotspot/share/classfile/protectionDomainCache.cpp

Print this page

        

*** 42,65 **** return hash_to_index(compute_hash(protection_domain)); } ProtectionDomainCacheTable::ProtectionDomainCacheTable(int table_size) : Hashtable<ClassLoaderWeakHandle, mtClass>(table_size, sizeof(ProtectionDomainCacheEntry)) ! { } void ProtectionDomainCacheTable::unlink() { ! assert(SafepointSynchronize::is_at_safepoint(), "must be"); for (int i = 0; i < table_size(); ++i) { ProtectionDomainCacheEntry** p = bucket_addr(i); ProtectionDomainCacheEntry* entry = bucket(i); while (entry != NULL) { oop pd = entry->object_no_keepalive(); if (pd != NULL) { p = entry->next_addr(); } else { ! LogTarget(Debug, protectiondomain) lt; if (lt.is_enabled()) { LogStream ls(lt); ls.print_cr("protection domain unlinked at %d", i); } entry->literal().release(); --- 42,71 ---- return hash_to_index(compute_hash(protection_domain)); } ProtectionDomainCacheTable::ProtectionDomainCacheTable(int table_size) : Hashtable<ClassLoaderWeakHandle, mtClass>(table_size, sizeof(ProtectionDomainCacheEntry)) ! { _dead_entries = false; ! } ! ! void ProtectionDomainCacheTable::trigger_cleanup() { ! MutexLockerEx ml(Service_lock, Mutex::_no_safepoint_check_flag); ! _dead_entries = true; ! Service_lock->notify_all(); } void ProtectionDomainCacheTable::unlink() { ! MutexLocker ml(SystemDictionary_lock); for (int i = 0; i < table_size(); ++i) { ProtectionDomainCacheEntry** p = bucket_addr(i); ProtectionDomainCacheEntry* entry = bucket(i); while (entry != NULL) { oop pd = entry->object_no_keepalive(); if (pd != NULL) { p = entry->next_addr(); } else { ! LogTarget(Debug, protectiondomain, table) lt; if (lt.is_enabled()) { LogStream ls(lt); ls.print_cr("protection domain unlinked at %d", i); } entry->literal().release();
*** 67,79 **** --- 73,87 ---- free_entry(entry); } entry = *p; } } + _dead_entries = false; } void ProtectionDomainCacheTable::print_on(outputStream* st) const { + assert_locked_or_safepoint(SystemDictionary_lock); st->print_cr("Protection domain cache table (table_size=%d, classes=%d)", table_size(), number_of_entries()); for (int index = 0; index < table_size(); index++) { for (ProtectionDomainCacheEntry* probe = bucket(index); probe != NULL;
*** 122,131 **** --- 130,140 ---- (void)entry->object(); return entry; } ProtectionDomainCacheEntry* ProtectionDomainCacheTable::find_entry(int index, Handle protection_domain) { + assert_locked_or_safepoint(SystemDictionary_lock); for (ProtectionDomainCacheEntry* e = bucket(index); e != NULL; e = e->next()) { if (oopDesc::equals(e->object_no_keepalive(), protection_domain())) { return e; } }
*** 136,145 **** --- 145,161 ---- ProtectionDomainCacheEntry* ProtectionDomainCacheTable::add_entry(int index, unsigned int hash, Handle protection_domain) { assert_locked_or_safepoint(SystemDictionary_lock); assert(index == index_for(protection_domain), "incorrect index?"); assert(find_entry(index, protection_domain) == NULL, "no double entry"); + LogTarget(Debug, protectiondomain, table) lt; + if (lt.is_enabled()) { + LogStream ls(lt); + ls.print("protection domain added "); + protection_domain->print_value_on(&ls); + ls.cr(); + } ClassLoaderWeakHandle w = ClassLoaderWeakHandle::create(protection_domain); ProtectionDomainCacheEntry* p = new_entry(hash, w); Hashtable<ClassLoaderWeakHandle, mtClass>::add_entry(index, p); return p; }
< prev index next >