提交 e8a3fda0 编写于 作者: K kevinw

8019375: Internal symbol table size should be tunable.

Reviewed-by: coleenp, kamg
上级 f27d8d8b
......@@ -44,12 +44,10 @@ public class SymbolTable extends sun.jvm.hotspot.utilities.Hashtable {
private static synchronized void initialize(TypeDataBase db) {
Type type = db.lookupType("SymbolTable");
theTableField = type.getAddressField("_the_table");
symbolTableSize = db.lookupIntConstant("SymbolTable::symbol_table_size").intValue();
}
// Fields
private static AddressField theTableField;
private static int symbolTableSize;
// Accessors
public static SymbolTable getTheTable() {
......@@ -57,10 +55,6 @@ public class SymbolTable extends sun.jvm.hotspot.utilities.Hashtable {
return (SymbolTable) VMObjectFactory.newObject(SymbolTable.class, tmp);
}
public static int getSymbolTableSize() {
return symbolTableSize;
}
public SymbolTable(Address addr) {
super(addr);
}
......
......@@ -107,18 +107,13 @@ private:
add(loader_data, cp, names_count, name, lengths, cp_indices, hashValues, THREAD);
}
// Table size
enum {
symbol_table_size = 20011
};
Symbol* lookup(int index, const char* name, int len, unsigned int hash);
SymbolTable()
: Hashtable<Symbol*, mtSymbol>(symbol_table_size, sizeof (HashtableEntry<Symbol*, mtSymbol>)) {}
: Hashtable<Symbol*, mtSymbol>(SymbolTableSize, sizeof (HashtableEntry<Symbol*, mtSymbol>)) {}
SymbolTable(HashtableBucket<mtSymbol>* t, int number_of_entries)
: Hashtable<Symbol*, mtSymbol>(symbol_table_size, sizeof (HashtableEntry<Symbol*, mtSymbol>), t,
: Hashtable<Symbol*, mtSymbol>(SymbolTableSize, sizeof (HashtableEntry<Symbol*, mtSymbol>), t,
number_of_entries) {}
// Arena for permanent symbols (null class loader) that are never unloaded
......@@ -136,6 +131,9 @@ public:
// The symbol table
static SymbolTable* the_table() { return _the_table; }
// Size of one bucket in the string table. Used when checking for rollover.
static uint bucket_size() { return sizeof(HashtableBucket<mtSymbol>); }
static void create_table() {
assert(_the_table == NULL, "One symbol table allowed.");
_the_table = new SymbolTable();
......@@ -145,8 +143,11 @@ public:
static void create_table(HashtableBucket<mtSymbol>* t, int length,
int number_of_entries) {
assert(_the_table == NULL, "One symbol table allowed.");
assert(length == symbol_table_size * sizeof(HashtableBucket<mtSymbol>),
"bad shared symbol size.");
// If CDS archive used a different symbol table size, use that size instead
// which is better than giving an error.
SymbolTableSize = length/bucket_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.
......
......@@ -2045,6 +2045,9 @@ bool Arguments::check_vm_args_consistency() {
status = status && verify_interval(StringTableSize, minimumStringTableSize,
(max_uintx / StringTable::bucket_size()), "StringTable size");
status = status && verify_interval(SymbolTableSize, minimumSymbolTableSize,
(max_uintx / SymbolTable::bucket_size()), "SymbolTable size");
if (MinHeapFreeRatio > MaxHeapFreeRatio) {
jio_fprintf(defaultStream::error_stream(),
"MinHeapFreeRatio (" UINTX_FORMAT ") must be less than or "
......
......@@ -3727,6 +3727,9 @@ class CommandLineFlags {
product(uintx, StringTableSize, defaultStringTableSize, \
"Number of buckets in the interned String table") \
\
experimental(uintx, SymbolTableSize, defaultSymbolTableSize, \
"Number of buckets in the JVM internal Symbol table") \
\
develop(bool, TraceDefaultMethods, false, \
"Trace the default method processing steps") \
\
......
......@@ -27,7 +27,6 @@
#include "classfile/javaClasses.hpp"
#include "classfile/loaderConstraints.hpp"
#include "classfile/placeholders.hpp"
#include "classfile/symbolTable.hpp"
#include "classfile/systemDictionary.hpp"
#include "ci/ciField.hpp"
#include "ci/ciInstance.hpp"
......@@ -2249,12 +2248,6 @@ typedef BinaryTreeDictionary<Metablock, FreeList> MetablockTreeDictionary;
declare_preprocessor_constant("PERFDATA_BIG_ENDIAN", PERFDATA_BIG_ENDIAN) \
declare_preprocessor_constant("PERFDATA_LITTLE_ENDIAN", PERFDATA_LITTLE_ENDIAN) \
\
/***************/ \
/* SymbolTable */ \
/***************/ \
\
declare_constant(SymbolTable::symbol_table_size) \
\
/***********************************/ \
/* LoaderConstraintTable constants */ \
/***********************************/ \
......
......@@ -333,6 +333,9 @@ const int max_method_code_size = 64*K - 1; // JVM spec, 2nd ed. section 4.8.1 (
const int defaultStringTableSize = NOT_LP64(1009) LP64_ONLY(60013);
const int minimumStringTableSize=1009;
const int defaultSymbolTableSize = 20011;
const int minimumSymbolTableSize = 1009;
//----------------------------------------------------------------------------------------------------
// HotSwap - for JVMTI aka Class File Replacement and PopFrame
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册