8019375: Internal symbol table size should be tunable.

Tue, 08 Oct 2013 09:33:51 +0100

author
kevinw
date
Tue, 08 Oct 2013 09:33:51 +0100
changeset 5850
c90e76575b03
parent 5848
ac9cb1d5a202
child 5851
ced68a57cdbd

8019375: Internal symbol table size should be tunable.
Reviewed-by: coleenp, kamg

agent/src/share/classes/sun/jvm/hotspot/memory/SymbolTable.java file | annotate | diff | comparison | revisions
src/share/vm/classfile/symbolTable.hpp file | annotate | diff | comparison | revisions
src/share/vm/runtime/arguments.cpp file | annotate | diff | comparison | revisions
src/share/vm/runtime/globals.hpp file | annotate | diff | comparison | revisions
src/share/vm/runtime/vmStructs.cpp file | annotate | diff | comparison | revisions
src/share/vm/utilities/globalDefinitions.hpp file | annotate | diff | comparison | revisions
     1.1 --- a/agent/src/share/classes/sun/jvm/hotspot/memory/SymbolTable.java	Mon Oct 07 12:20:28 2013 -0400
     1.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/memory/SymbolTable.java	Tue Oct 08 09:33:51 2013 +0100
     1.3 @@ -44,12 +44,10 @@
     1.4    private static synchronized void initialize(TypeDataBase db) {
     1.5      Type type = db.lookupType("SymbolTable");
     1.6      theTableField  = type.getAddressField("_the_table");
     1.7 -    symbolTableSize = db.lookupIntConstant("SymbolTable::symbol_table_size").intValue();
     1.8    }
     1.9  
    1.10    // Fields
    1.11    private static AddressField theTableField;
    1.12 -  private static int symbolTableSize;
    1.13  
    1.14    // Accessors
    1.15    public static SymbolTable getTheTable() {
    1.16 @@ -57,10 +55,6 @@
    1.17      return (SymbolTable) VMObjectFactory.newObject(SymbolTable.class, tmp);
    1.18    }
    1.19  
    1.20 -  public static int getSymbolTableSize() {
    1.21 -    return symbolTableSize;
    1.22 -  }
    1.23 -
    1.24    public SymbolTable(Address addr) {
    1.25      super(addr);
    1.26    }
     2.1 --- a/src/share/vm/classfile/symbolTable.hpp	Mon Oct 07 12:20:28 2013 -0400
     2.2 +++ b/src/share/vm/classfile/symbolTable.hpp	Tue Oct 08 09:33:51 2013 +0100
     2.3 @@ -107,18 +107,13 @@
     2.4      add(loader_data, cp, names_count, name, lengths, cp_indices, hashValues, THREAD);
     2.5    }
     2.6  
     2.7 -  // Table size
     2.8 -  enum {
     2.9 -    symbol_table_size = 20011
    2.10 -  };
    2.11 -
    2.12    Symbol* lookup(int index, const char* name, int len, unsigned int hash);
    2.13  
    2.14    SymbolTable()
    2.15 -    : Hashtable<Symbol*, mtSymbol>(symbol_table_size, sizeof (HashtableEntry<Symbol*, mtSymbol>)) {}
    2.16 +    : Hashtable<Symbol*, mtSymbol>(SymbolTableSize, sizeof (HashtableEntry<Symbol*, mtSymbol>)) {}
    2.17  
    2.18    SymbolTable(HashtableBucket<mtSymbol>* t, int number_of_entries)
    2.19 -    : Hashtable<Symbol*, mtSymbol>(symbol_table_size, sizeof (HashtableEntry<Symbol*, mtSymbol>), t,
    2.20 +    : Hashtable<Symbol*, mtSymbol>(SymbolTableSize, sizeof (HashtableEntry<Symbol*, mtSymbol>), t,
    2.21                  number_of_entries) {}
    2.22  
    2.23    // Arena for permanent symbols (null class loader) that are never unloaded
    2.24 @@ -136,6 +131,9 @@
    2.25    // The symbol table
    2.26    static SymbolTable* the_table() { return _the_table; }
    2.27  
    2.28 +  // Size of one bucket in the string table.  Used when checking for rollover.
    2.29 +  static uint bucket_size() { return sizeof(HashtableBucket<mtSymbol>); }
    2.30 +
    2.31    static void create_table() {
    2.32      assert(_the_table == NULL, "One symbol table allowed.");
    2.33      _the_table = new SymbolTable();
    2.34 @@ -145,8 +143,11 @@
    2.35    static void create_table(HashtableBucket<mtSymbol>* t, int length,
    2.36                             int number_of_entries) {
    2.37      assert(_the_table == NULL, "One symbol table allowed.");
    2.38 -    assert(length == symbol_table_size * sizeof(HashtableBucket<mtSymbol>),
    2.39 -           "bad shared symbol size.");
    2.40 +
    2.41 +    // If CDS archive used a different symbol table size, use that size instead
    2.42 +    // which is better than giving an error.
    2.43 +    SymbolTableSize = length/bucket_size();
    2.44 +
    2.45      _the_table = new SymbolTable(t, number_of_entries);
    2.46      // if CDS give symbol table a default arena size since most symbols
    2.47      // are already allocated in the shared misc section.
     3.1 --- a/src/share/vm/runtime/arguments.cpp	Mon Oct 07 12:20:28 2013 -0400
     3.2 +++ b/src/share/vm/runtime/arguments.cpp	Tue Oct 08 09:33:51 2013 +0100
     3.3 @@ -2045,6 +2045,9 @@
     3.4    status = status && verify_interval(StringTableSize, minimumStringTableSize,
     3.5      (max_uintx / StringTable::bucket_size()), "StringTable size");
     3.6  
     3.7 +  status = status && verify_interval(SymbolTableSize, minimumSymbolTableSize,
     3.8 +    (max_uintx / SymbolTable::bucket_size()), "SymbolTable size");
     3.9 +
    3.10    if (MinHeapFreeRatio > MaxHeapFreeRatio) {
    3.11      jio_fprintf(defaultStream::error_stream(),
    3.12                  "MinHeapFreeRatio (" UINTX_FORMAT ") must be less than or "
     4.1 --- a/src/share/vm/runtime/globals.hpp	Mon Oct 07 12:20:28 2013 -0400
     4.2 +++ b/src/share/vm/runtime/globals.hpp	Tue Oct 08 09:33:51 2013 +0100
     4.3 @@ -3727,6 +3727,9 @@
     4.4    product(uintx, StringTableSize, defaultStringTableSize,                   \
     4.5            "Number of buckets in the interned String table")                 \
     4.6                                                                              \
     4.7 +  experimental(uintx, SymbolTableSize, defaultSymbolTableSize,              \
     4.8 +          "Number of buckets in the JVM internal Symbol table")             \
     4.9 +                                                                            \
    4.10    develop(bool, TraceDefaultMethods, false,                                 \
    4.11            "Trace the default method processing steps")                      \
    4.12                                                                              \
     5.1 --- a/src/share/vm/runtime/vmStructs.cpp	Mon Oct 07 12:20:28 2013 -0400
     5.2 +++ b/src/share/vm/runtime/vmStructs.cpp	Tue Oct 08 09:33:51 2013 +0100
     5.3 @@ -27,7 +27,6 @@
     5.4  #include "classfile/javaClasses.hpp"
     5.5  #include "classfile/loaderConstraints.hpp"
     5.6  #include "classfile/placeholders.hpp"
     5.7 -#include "classfile/symbolTable.hpp"
     5.8  #include "classfile/systemDictionary.hpp"
     5.9  #include "ci/ciField.hpp"
    5.10  #include "ci/ciInstance.hpp"
    5.11 @@ -2249,12 +2248,6 @@
    5.12    declare_preprocessor_constant("PERFDATA_BIG_ENDIAN", PERFDATA_BIG_ENDIAN)       \
    5.13    declare_preprocessor_constant("PERFDATA_LITTLE_ENDIAN", PERFDATA_LITTLE_ENDIAN) \
    5.14                                                                            \
    5.15 -  /***************/                                                       \
    5.16 -  /* SymbolTable */                                                       \
    5.17 -  /***************/                                                       \
    5.18 -                                                                          \
    5.19 -  declare_constant(SymbolTable::symbol_table_size)                        \
    5.20 -                                                                          \
    5.21    /***********************************/                                   \
    5.22    /* LoaderConstraintTable constants */                                   \
    5.23    /***********************************/                                   \
     6.1 --- a/src/share/vm/utilities/globalDefinitions.hpp	Mon Oct 07 12:20:28 2013 -0400
     6.2 +++ b/src/share/vm/utilities/globalDefinitions.hpp	Tue Oct 08 09:33:51 2013 +0100
     6.3 @@ -333,6 +333,9 @@
     6.4  const int defaultStringTableSize = NOT_LP64(1009) LP64_ONLY(60013);
     6.5  const int minimumStringTableSize=1009;
     6.6  
     6.7 +const int defaultSymbolTableSize = 20011;
     6.8 +const int minimumSymbolTableSize = 1009;
     6.9 +
    6.10  
    6.11  //----------------------------------------------------------------------------------------------------
    6.12  // HotSwap - for JVMTI   aka Class File Replacement and PopFrame

mercurial