--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/SymbolTable.java Tue Oct 08 02:56:06 2013 -0400
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/SymbolTable.java Tue Oct 08 11:37:54 2013 +0200
@@ -44,12 +44,10 @@
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 @@
return (SymbolTable) VMObjectFactory.newObject(SymbolTable.class, tmp);
}
- public static int getSymbolTableSize() {
- return symbolTableSize;
- }
-
public SymbolTable(Address addr) {
super(addr);
}
--- a/hotspot/src/share/vm/classfile/symbolTable.hpp Tue Oct 08 02:56:06 2013 -0400
+++ b/hotspot/src/share/vm/classfile/symbolTable.hpp Tue Oct 08 11:37:54 2013 +0200
@@ -107,18 +107,13 @@
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 @@
// 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 @@
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.
--- a/hotspot/src/share/vm/runtime/arguments.cpp Tue Oct 08 02:56:06 2013 -0400
+++ b/hotspot/src/share/vm/runtime/arguments.cpp Tue Oct 08 11:37:54 2013 +0200
@@ -2045,6 +2045,9 @@
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 "
--- a/hotspot/src/share/vm/runtime/globals.hpp Tue Oct 08 02:56:06 2013 -0400
+++ b/hotspot/src/share/vm/runtime/globals.hpp Tue Oct 08 11:37:54 2013 +0200
@@ -3727,6 +3727,9 @@
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") \
\
--- a/hotspot/src/share/vm/runtime/vmStructs.cpp Tue Oct 08 02:56:06 2013 -0400
+++ b/hotspot/src/share/vm/runtime/vmStructs.cpp Tue Oct 08 11:37:54 2013 +0200
@@ -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 @@
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 */ \
/***********************************/ \
--- a/hotspot/src/share/vm/utilities/globalDefinitions.hpp Tue Oct 08 02:56:06 2013 -0400
+++ b/hotspot/src/share/vm/utilities/globalDefinitions.hpp Tue Oct 08 11:37:54 2013 +0200
@@ -333,6 +333,9 @@
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