aboutsummaryrefslogtreecommitdiff
path: root/src/share/vm
diff options
context:
space:
mode:
authorkevinw <none@none>2013-10-08 09:33:51 +0100
committerkevinw <none@none>2013-10-08 09:33:51 +0100
commitf8d31e244eafea2f58f917e162eef20ab53e0beb (patch)
treed72c0c33642b0ef0d4170fd74bee055ee56252bb /src/share/vm
parent930eb0a0696083766969db14687995b525c5b83a (diff)
8019375: Internal symbol table size should be tunable.
Reviewed-by: coleenp, kamg
Diffstat (limited to 'src/share/vm')
-rw-r--r--src/share/vm/classfile/symbolTable.hpp19
-rw-r--r--src/share/vm/runtime/arguments.cpp3
-rw-r--r--src/share/vm/runtime/globals.hpp3
-rw-r--r--src/share/vm/runtime/vmStructs.cpp7
-rw-r--r--src/share/vm/utilities/globalDefinitions.hpp3
5 files changed, 19 insertions, 16 deletions
diff --git a/src/share/vm/classfile/symbolTable.hpp b/src/share/vm/classfile/symbolTable.hpp
index dc7d0337a..50cde69d8 100644
--- a/src/share/vm/classfile/symbolTable.hpp
+++ b/src/share/vm/classfile/symbolTable.hpp
@@ -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.
diff --git a/src/share/vm/runtime/arguments.cpp b/src/share/vm/runtime/arguments.cpp
index 1c69cbd45..6b3bdab39 100644
--- a/src/share/vm/runtime/arguments.cpp
+++ b/src/share/vm/runtime/arguments.cpp
@@ -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 "
diff --git a/src/share/vm/runtime/globals.hpp b/src/share/vm/runtime/globals.hpp
index e8b7d1719..edc1c02d4 100644
--- a/src/share/vm/runtime/globals.hpp
+++ b/src/share/vm/runtime/globals.hpp
@@ -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") \
\
diff --git a/src/share/vm/runtime/vmStructs.cpp b/src/share/vm/runtime/vmStructs.cpp
index 004461577..ba3c86f6f 100644
--- a/src/share/vm/runtime/vmStructs.cpp
+++ b/src/share/vm/runtime/vmStructs.cpp
@@ -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 */ \
/***********************************/ \
diff --git a/src/share/vm/utilities/globalDefinitions.hpp b/src/share/vm/utilities/globalDefinitions.hpp
index 8febe5474..68a5b0c86 100644
--- a/src/share/vm/utilities/globalDefinitions.hpp
+++ b/src/share/vm/utilities/globalDefinitions.hpp
@@ -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