JDK-6962930 : make the string table size configurable
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: gc
  • Affected Version: hs19,6u25
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2010-06-22
  • Updated: 2015-01-08
  • Resolved: 2011-04-25
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availabitlity Release.

To download the current JDK release, click here.
JDK 6 JDK 7 Other
6u30-revFixed 7Fixed hs21Fixed
Related Reports
Duplicate :  
Relates :  
Relates :  
Description
The size of the string table (a chained hash table) is currently a compile-time constant.  When the overflow chains become long, performance can degrade.  Allow the size of the string table to be set on the command line for performance experiments and as a workaround for applications which stress the string table.

Comments
SUGGESTED FIX # HG changeset patch # User jcoomes # Date 1300757880 25200 # Node ID 924777755fad2236d149bd2efad47b8a833fe680 # Parent 57552dca1708f2d8622d970ac18adce5bdf8bcec 6962930: make the string table size configurable Reviewed-by: never, phh, stefank, kamg, dholmes, coleenp diff --git a/agent/src/share/classes/sun/jvm/hotspot/memory/StringTable.java b/agent/src/share/classes/sun/jvm/hotspot/memory/StringTable.java --- a/agent/src/share/classes/sun/jvm/hotspot/memory/StringTable.java +++ b/agent/src/share/classes/sun/jvm/hotspot/memory/StringTable.java @@ -44,12 +44,10 @@ private static synchronized void initialize(TypeDataBase db) { Type type = db.lookupType("StringTable"); theTableField = type.getAddressField("_the_table"); - stringTableSize = db.lookupIntConstant("StringTable::string_table_size").intValue(); } // Fields private static AddressField theTableField; - private static int stringTableSize; // Accessors public static StringTable getTheTable() { @@ -57,10 +55,6 @@ return (StringTable) VMObjectFactory.newObject(StringTable.class, tmp); } - public static int getStringTableSize() { - return stringTableSize; - } - public StringTable(Address addr) { super(addr); } diff --git a/src/share/vm/classfile/symbolTable.hpp b/src/share/vm/classfile/symbolTable.hpp --- a/src/share/vm/classfile/symbolTable.hpp +++ b/src/share/vm/classfile/symbolTable.hpp @@ -216,18 +216,14 @@ oop basic_add(int index, Handle string_or_null, jchar* name, int len, unsigned int hashValue, TRAPS); - // Table size - enum { - string_table_size = 1009 - }; - oop lookup(int index, jchar* chars, int length, unsigned int hashValue); - StringTable() : Hashtable<oop>(string_table_size, sizeof (HashtableEntry<oop>)) {} + StringTable() : Hashtable<oop>((int)StringTableSize, + sizeof (HashtableEntry<oop>)) {} StringTable(HashtableBucket* t, int number_of_entries) - : Hashtable<oop>(string_table_size, sizeof (HashtableEntry<oop>), t, - number_of_entries) {} + : Hashtable<oop>((int)StringTableSize, sizeof (HashtableEntry<oop>), t, + number_of_entries) {} public: // The string table @@ -241,7 +237,7 @@ static void create_table(HashtableBucket* t, int length, int number_of_entries) { assert(_the_table == NULL, "One string table allowed."); - assert(length == string_table_size * sizeof(HashtableBucket), + assert((size_t)length == StringTableSize * sizeof(HashtableBucket), "bad shared string size."); _the_table = new StringTable(t, number_of_entries); } diff --git a/src/share/vm/runtime/arguments.cpp b/src/share/vm/runtime/arguments.cpp --- a/src/share/vm/runtime/arguments.cpp +++ b/src/share/vm/runtime/arguments.cpp @@ -2819,22 +2819,38 @@ } void Arguments::set_shared_spaces_flags() { + const bool must_share = DumpSharedSpaces || RequireSharedSpaces; + const bool might_share = must_share || UseSharedSpaces; + + // The string table is part of the shared archive so the size must match. + if (!FLAG_IS_DEFAULT(StringTableSize)) { + // Disable sharing. + if (must_share) { + warning("disabling shared archive %s because of non-default " + "StringTableSize", DumpSharedSpaces ? "creation" : "use"); + } + if (might_share) { + FLAG_SET_DEFAULT(DumpSharedSpaces, false); + FLAG_SET_DEFAULT(RequireSharedSpaces, false); + FLAG_SET_DEFAULT(UseSharedSpaces, false); + } + return; + } + // Check whether class data sharing settings conflict with GC, compressed oops // or page size, and fix them up. Explicit sharing options override other // settings. const bool cannot_share = UseConcMarkSweepGC || CMSIncrementalMode || UseG1GC || UseParNewGC || UseParallelGC || UseParallelOldGC || UseCompressedOops || UseLargePages && FLAG_IS_CMDLINE(UseLargePages); - const bool must_share = DumpSharedSpaces || RequireSharedSpaces; - const bool might_share = must_share || UseSharedSpaces; if (cannot_share) { if (must_share) { - warning("selecting serial gc and disabling large pages %s" - "because of %s", "" LP64_ONLY("and compressed oops "), - DumpSharedSpaces ? "-Xshare:dump" : "-Xshare:on"); - force_serial_gc(); - FLAG_SET_CMDLINE(bool, UseLargePages, false); - LP64_ONLY(FLAG_SET_CMDLINE(bool, UseCompressedOops, false)); + warning("selecting serial gc and disabling large pages %s" + "because of %s", "" LP64_ONLY("and compressed oops "), + DumpSharedSpaces ? "-Xshare:dump" : "-Xshare:on"); + force_serial_gc(); + FLAG_SET_CMDLINE(bool, UseLargePages, false); + LP64_ONLY(FLAG_SET_CMDLINE(bool, UseCompressedOops, false)); } else { if (UseSharedSpaces && Verbose) { warning("turning off use of shared archive because of " diff --git a/src/share/vm/runtime/globals.hpp b/src/share/vm/runtime/globals.hpp --- a/src/share/vm/runtime/globals.hpp +++ b/src/share/vm/runtime/globals.hpp @@ -3756,6 +3756,9 @@ diagnostic(bool, PrintDTraceDOF, false, \ "Print the DTrace DOF passed to the system for JSDT probes") \ \ + product(uintx, StringTableSize, 1009, \ + "Number of buckets in the interned String table") \ + \ product(bool, UseVMInterruptibleIO, false, \ "(Unstable, Solaris-specific) Thread interrupt before or with " \ "EINTR for I/O operations results in OS_INTRPT. The default value"\ diff --git a/src/share/vm/runtime/vmStructs.cpp b/src/share/vm/runtime/vmStructs.cpp --- a/src/share/vm/runtime/vmStructs.cpp +++ b/src/share/vm/runtime/vmStructs.cpp @@ -1553,12 +1553,6 @@ \ declare_constant(SymbolTable::symbol_table_size) \ \ - /***************/ \ - /* StringTable */ \ - /***************/ \ - \ - declare_constant(StringTable::string_table_size) \ - \ /********************/ \ /* SystemDictionary */ \ /********************/ \
2011-04-15

EVALUATION http://hg.openjdk.java.net/jdk7/hotspot-comp/hotspot/rev/924777755fad
2011-03-25

EVALUATION http://hg.openjdk.java.net/jdk7/hotspot-rt/hotspot/rev/924777755fad
2011-03-25

EVALUATION http://hg.openjdk.java.net/jdk7/hotspot/hotspot/rev/924777755fad
2011-03-25

EVALUATION http://hg.openjdk.java.net/jdk7/hotspot-gc/hotspot/rev/924777755fad
2011-03-22

EVALUATION See description.
2010-06-22