mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
6962930: make the string table size configurable
Reviewed-by: never, phh, stefank, kamg, dholmes, coleenp
This commit is contained in:
parent
31ac558f3d
commit
1ed31f9194
5 changed files with 32 additions and 29 deletions
|
@ -44,12 +44,10 @@ public class StringTable extends sun.jvm.hotspot.utilities.Hashtable {
|
||||||
private static synchronized void initialize(TypeDataBase db) {
|
private static synchronized void initialize(TypeDataBase db) {
|
||||||
Type type = db.lookupType("StringTable");
|
Type type = db.lookupType("StringTable");
|
||||||
theTableField = type.getAddressField("_the_table");
|
theTableField = type.getAddressField("_the_table");
|
||||||
stringTableSize = db.lookupIntConstant("StringTable::string_table_size").intValue();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fields
|
// Fields
|
||||||
private static AddressField theTableField;
|
private static AddressField theTableField;
|
||||||
private static int stringTableSize;
|
|
||||||
|
|
||||||
// Accessors
|
// Accessors
|
||||||
public static StringTable getTheTable() {
|
public static StringTable getTheTable() {
|
||||||
|
@ -57,10 +55,6 @@ public class StringTable extends sun.jvm.hotspot.utilities.Hashtable {
|
||||||
return (StringTable) VMObjectFactory.newObject(StringTable.class, tmp);
|
return (StringTable) VMObjectFactory.newObject(StringTable.class, tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getStringTableSize() {
|
|
||||||
return stringTableSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
public StringTable(Address addr) {
|
public StringTable(Address addr) {
|
||||||
super(addr);
|
super(addr);
|
||||||
}
|
}
|
||||||
|
|
|
@ -216,18 +216,14 @@ private:
|
||||||
oop basic_add(int index, Handle string_or_null, jchar* name, int len,
|
oop basic_add(int index, Handle string_or_null, jchar* name, int len,
|
||||||
unsigned int hashValue, TRAPS);
|
unsigned int hashValue, TRAPS);
|
||||||
|
|
||||||
// Table size
|
|
||||||
enum {
|
|
||||||
string_table_size = 1009
|
|
||||||
};
|
|
||||||
|
|
||||||
oop lookup(int index, jchar* chars, int length, unsigned int hashValue);
|
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)
|
StringTable(HashtableBucket* t, int number_of_entries)
|
||||||
: Hashtable<oop>(string_table_size, sizeof (HashtableEntry<oop>), t,
|
: Hashtable<oop>((int)StringTableSize, sizeof (HashtableEntry<oop>), t,
|
||||||
number_of_entries) {}
|
number_of_entries) {}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// The string table
|
// The string table
|
||||||
|
@ -241,7 +237,7 @@ public:
|
||||||
static void create_table(HashtableBucket* t, int length,
|
static void create_table(HashtableBucket* t, int length,
|
||||||
int number_of_entries) {
|
int number_of_entries) {
|
||||||
assert(_the_table == NULL, "One string table allowed.");
|
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.");
|
"bad shared string size.");
|
||||||
_the_table = new StringTable(t, number_of_entries);
|
_the_table = new StringTable(t, number_of_entries);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2819,22 +2819,38 @@ jint Arguments::parse_options_environment_variable(const char* name, SysClassPat
|
||||||
}
|
}
|
||||||
|
|
||||||
void Arguments::set_shared_spaces_flags() {
|
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
|
// Check whether class data sharing settings conflict with GC, compressed oops
|
||||||
// or page size, and fix them up. Explicit sharing options override other
|
// or page size, and fix them up. Explicit sharing options override other
|
||||||
// settings.
|
// settings.
|
||||||
const bool cannot_share = UseConcMarkSweepGC || CMSIncrementalMode ||
|
const bool cannot_share = UseConcMarkSweepGC || CMSIncrementalMode ||
|
||||||
UseG1GC || UseParNewGC || UseParallelGC || UseParallelOldGC ||
|
UseG1GC || UseParNewGC || UseParallelGC || UseParallelOldGC ||
|
||||||
UseCompressedOops || UseLargePages && FLAG_IS_CMDLINE(UseLargePages);
|
UseCompressedOops || UseLargePages && FLAG_IS_CMDLINE(UseLargePages);
|
||||||
const bool must_share = DumpSharedSpaces || RequireSharedSpaces;
|
|
||||||
const bool might_share = must_share || UseSharedSpaces;
|
|
||||||
if (cannot_share) {
|
if (cannot_share) {
|
||||||
if (must_share) {
|
if (must_share) {
|
||||||
warning("selecting serial gc and disabling large pages %s"
|
warning("selecting serial gc and disabling large pages %s"
|
||||||
"because of %s", "" LP64_ONLY("and compressed oops "),
|
"because of %s", "" LP64_ONLY("and compressed oops "),
|
||||||
DumpSharedSpaces ? "-Xshare:dump" : "-Xshare:on");
|
DumpSharedSpaces ? "-Xshare:dump" : "-Xshare:on");
|
||||||
force_serial_gc();
|
force_serial_gc();
|
||||||
FLAG_SET_CMDLINE(bool, UseLargePages, false);
|
FLAG_SET_CMDLINE(bool, UseLargePages, false);
|
||||||
LP64_ONLY(FLAG_SET_CMDLINE(bool, UseCompressedOops, false));
|
LP64_ONLY(FLAG_SET_CMDLINE(bool, UseCompressedOops, false));
|
||||||
} else {
|
} else {
|
||||||
if (UseSharedSpaces && Verbose) {
|
if (UseSharedSpaces && Verbose) {
|
||||||
warning("turning off use of shared archive because of "
|
warning("turning off use of shared archive because of "
|
||||||
|
|
|
@ -3756,6 +3756,9 @@ class CommandLineFlags {
|
||||||
diagnostic(bool, PrintDTraceDOF, false, \
|
diagnostic(bool, PrintDTraceDOF, false, \
|
||||||
"Print the DTrace DOF passed to the system for JSDT probes") \
|
"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, \
|
product(bool, UseVMInterruptibleIO, false, \
|
||||||
"(Unstable, Solaris-specific) Thread interrupt before or with " \
|
"(Unstable, Solaris-specific) Thread interrupt before or with " \
|
||||||
"EINTR for I/O operations results in OS_INTRPT. The default value"\
|
"EINTR for I/O operations results in OS_INTRPT. The default value"\
|
||||||
|
|
|
@ -1553,12 +1553,6 @@ static inline uint64_t cast_uint64_t(size_t x)
|
||||||
\
|
\
|
||||||
declare_constant(SymbolTable::symbol_table_size) \
|
declare_constant(SymbolTable::symbol_table_size) \
|
||||||
\
|
\
|
||||||
/***************/ \
|
|
||||||
/* StringTable */ \
|
|
||||||
/***************/ \
|
|
||||||
\
|
|
||||||
declare_constant(StringTable::string_table_size) \
|
|
||||||
\
|
|
||||||
/********************/ \
|
/********************/ \
|
||||||
/* SystemDictionary */ \
|
/* SystemDictionary */ \
|
||||||
/********************/ \
|
/********************/ \
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue