Mercurial > hg > truffle
diff src/share/vm/classfile/symbolTable.hpp @ 5979:fc9d8850ab8b
7150058: Allocate symbols from null boot loader to an arena for NMT
Summary: Move symbol allocation to an arena so NMT doesn't have to track them at startup.
Reviewed-by: never, kamg, zgu
author | coleenp |
---|---|
date | Fri, 23 Mar 2012 11:16:05 -0400 |
parents | 94ec88ca68e2 |
children | e9140bf80b4a |
line wrap: on
line diff
--- a/src/share/vm/classfile/symbolTable.hpp Thu Mar 15 13:37:13 2012 +0100 +++ b/src/share/vm/classfile/symbolTable.hpp Fri Mar 23 11:16:05 2012 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -82,24 +82,24 @@ static int symbols_removed; static int symbols_counted; - Symbol* allocate_symbol(const u1* name, int len, TRAPS); // Assumes no characters larger than 0x7F - bool allocate_symbols(int names_count, const u1** names, int* lengths, Symbol** syms, TRAPS); + Symbol* allocate_symbol(const u1* name, int len, bool c_heap, TRAPS); // Assumes no characters larger than 0x7F // Adding elements - Symbol* basic_add(int index, u1* name, int len, - unsigned int hashValue, TRAPS); - bool basic_add(constantPoolHandle cp, int names_count, + Symbol* basic_add(int index, u1* name, int len, unsigned int hashValue, + bool c_heap, TRAPS); + + bool basic_add(Handle class_loader, constantPoolHandle cp, int names_count, const char** names, int* lengths, int* cp_indices, unsigned int* hashValues, TRAPS); - static void new_symbols(constantPoolHandle cp, int names_count, + static void new_symbols(Handle class_loader, constantPoolHandle cp, + int names_count, const char** name, int* lengths, int* cp_indices, unsigned int* hashValues, TRAPS) { - add(cp, names_count, name, lengths, cp_indices, hashValues, THREAD); + add(class_loader, cp, names_count, name, lengths, cp_indices, hashValues, THREAD); } - // Table size enum { symbol_table_size = 20011 @@ -114,10 +114,16 @@ : Hashtable<Symbol*>(symbol_table_size, sizeof (HashtableEntry<Symbol*>), t, number_of_entries) {} + // Arena for permanent symbols (null class loader) that are never unloaded + static Arena* _arena; + static Arena* arena() { return _arena; } // called for statistics + static void initialize_symbols(int arena_alloc_size = 0); public: enum { - symbol_alloc_batch_size = 8 + symbol_alloc_batch_size = 8, + // Pick initial size based on java -version size measurements + symbol_alloc_arena_size = 360*K }; // The symbol table @@ -126,6 +132,7 @@ static void create_table() { assert(_the_table == NULL, "One symbol table allowed."); _the_table = new SymbolTable(); + initialize_symbols(symbol_alloc_arena_size); } static void create_table(HashtableBucket* t, int length, @@ -134,6 +141,9 @@ assert(length == symbol_table_size * sizeof(HashtableBucket), "bad shared symbol size."); _the_table = new SymbolTable(t, number_of_entries); + // if CDS give symbol table a default arena size since most symbols + // are already allocated in the shared misc section. + initialize_symbols(); } static Symbol* lookup(const char* name, int len, TRAPS); @@ -151,7 +161,7 @@ static Symbol* lookup_unicode(const jchar* name, int len, TRAPS); static Symbol* lookup_only_unicode(const jchar* name, int len, unsigned int& hash); - static void add(constantPoolHandle cp, int names_count, + static void add(Handle class_loader, constantPoolHandle cp, int names_count, const char** names, int* lengths, int* cp_indices, unsigned int* hashValues, TRAPS); @@ -174,6 +184,9 @@ return lookup(sym, begin, end, THREAD); } + // Create a symbol in the arena for symbols that are not deleted + static Symbol* new_permanent_symbol(const char* name, TRAPS); + // Symbol lookup static Symbol* lookup(int index, const char* name, int len, TRAPS);