< prev index next >

src/hotspot/share/classfile/symbolTable.cpp

Print this page

*** 174,183 **** --- 174,188 ---- _arena = new (mtSymbol) Arena(mtSymbol, symbol_alloc_arena_size); } } void SymbolTable::delete_symbol(Symbol* sym) { + if (Arguments::is_dumping_archive()) { + // Do not delete symbols as we may be in the middle of preparing the + // symbols for dumping. + return; + } if (sym->is_permanent()) { MutexLocker ml(SymbolArena_lock, Mutex::_no_safepoint_check_flag); // Protect arena // Deleting permanent symbol should not occur very often (insert race condition), // so log it. log_trace_symboltable_helper(sym, "Freeing permanent symbol");
*** 219,234 **** --- 224,245 ---- Symbol* SymbolTable::allocate_symbol(const char* name, int len, bool c_heap) { assert (len <= Symbol::max_length(), "should be checked by caller"); Symbol* sym; if (Arguments::is_dumping_archive()) { + // Need to make all symbols permanent -- or else some symbols may be GC'ed + // during the archive dumping code that's executed outside of a safepoint. c_heap = false; } if (c_heap) { // refcount starts as 1 sym = new (len) Symbol((const u1*)name, len, 1); assert(sym != NULL, "new should call vm_exit_out_of_memory if C_HEAP is exhausted"); + } else if (DumpSharedSpaces) { + // See comments inside Symbol::operator new(size_t, int) + sym = new (len) Symbol((const u1*)name, len, PERM_REFCOUNT); + assert(sym != NULL, "new should call vm_exit_out_of_memory if failed to allocate symbol during DumpSharedSpaces"); } else { // Allocate to global arena MutexLocker ml(SymbolArena_lock, Mutex::_no_safepoint_check_flag); // Protect arena sym = new (len, arena()) Symbol((const u1*)name, len, PERM_REFCOUNT); }
< prev index next >