8004872: Early loading of HashMap and StringValue under -XX:+AggressiveOpts can be removed
Summary: this fix also removes the -XX:+UseStringCache option
Reviewed-by: dholmes, acorn, iklam
--- a/hotspot/src/share/vm/classfile/vmSymbols.hpp Wed Jul 17 13:48:15 2013 +0200
+++ b/hotspot/src/share/vm/classfile/vmSymbols.hpp Thu Jul 18 14:57:51 2013 -0700
@@ -53,8 +53,6 @@
template(java_lang_Object, "java/lang/Object") \
template(java_lang_Class, "java/lang/Class") \
template(java_lang_String, "java/lang/String") \
- template(java_lang_StringValue, "java/lang/StringValue") \
- template(java_lang_StringCache, "java/lang/StringValue$StringCache") \
template(java_lang_Thread, "java/lang/Thread") \
template(java_lang_ThreadGroup, "java/lang/ThreadGroup") \
template(java_lang_Cloneable, "java/lang/Cloneable") \
@@ -106,7 +104,6 @@
template(java_util_Vector, "java/util/Vector") \
template(java_util_AbstractList, "java/util/AbstractList") \
template(java_util_Hashtable, "java/util/Hashtable") \
- template(java_util_HashMap, "java/util/HashMap") \
template(java_lang_Compiler, "java/lang/Compiler") \
template(sun_misc_Signal, "sun/misc/Signal") \
template(java_lang_AssertionStatusDirectives, "java/lang/AssertionStatusDirectives") \
@@ -367,8 +364,6 @@
template(offset_name, "offset") \
template(count_name, "count") \
template(hash_name, "hash") \
- template(frontCacheEnabled_name, "frontCacheEnabled") \
- template(stringCacheEnabled_name, "stringCacheEnabled") \
template(numberOfLeadingZeros_name, "numberOfLeadingZeros") \
template(numberOfTrailingZeros_name, "numberOfTrailingZeros") \
template(bitCount_name, "bitCount") \
--- a/hotspot/src/share/vm/opto/bytecodeInfo.cpp Wed Jul 17 13:48:15 2013 +0200
+++ b/hotspot/src/share/vm/opto/bytecodeInfo.cpp Thu Jul 18 14:57:51 2013 -0700
@@ -297,15 +297,6 @@
}
}
- if (UseStringCache) {
- // Do not inline StringCache::profile() method used only at the beginning.
- if (callee_method->name() == ciSymbol::profile_name() &&
- callee_method->holder()->name() == ciSymbol::java_lang_StringCache()) {
- set_msg("profiling method");
- return true;
- }
- }
-
// use frequency-based objections only for non-trivial methods
if (callee_method->code_size() <= MaxTrivialSize) {
return false;
--- a/hotspot/src/share/vm/runtime/arguments.cpp Wed Jul 17 13:48:15 2013 +0200
+++ b/hotspot/src/share/vm/runtime/arguments.cpp Thu Jul 18 14:57:51 2013 -0700
@@ -263,6 +263,7 @@
{ "UseISM", JDK_Version::jdk(8), JDK_Version::jdk(9) },
{ "UsePermISM", JDK_Version::jdk(8), JDK_Version::jdk(9) },
{ "UseMPSS", JDK_Version::jdk(8), JDK_Version::jdk(9) },
+ { "UseStringCache", JDK_Version::jdk(8), JDK_Version::jdk(9) },
#ifdef PRODUCT
{ "DesiredMethodLimit",
JDK_Version::jdk_update(7, 2), JDK_Version::jdk(8) },
--- a/hotspot/src/share/vm/runtime/globals.hpp Wed Jul 17 13:48:15 2013 +0200
+++ b/hotspot/src/share/vm/runtime/globals.hpp Thu Jul 18 14:57:51 2013 -0700
@@ -2589,9 +2589,6 @@
product(bool, AggressiveOpts, false, \
"Enable aggressive optimizations - see arguments.cpp") \
\
- product(bool, UseStringCache, false, \
- "Enable String cache capabilities on String.java") \
- \
/* statistics */ \
develop(bool, CountCompiledCalls, false, \
"counts method invocations") \
--- a/hotspot/src/share/vm/runtime/thread.cpp Wed Jul 17 13:48:15 2013 +0200
+++ b/hotspot/src/share/vm/runtime/thread.cpp Thu Jul 18 14:57:51 2013 -0700
@@ -3490,44 +3490,6 @@
initialize_class(vmSymbols::java_lang_String(), CHECK_0);
- if (AggressiveOpts) {
- {
- // Forcibly initialize java/util/HashMap and mutate the private
- // static final "frontCacheEnabled" field before we start creating instances
-#ifdef ASSERT
- Klass* tmp_k = SystemDictionary::find(vmSymbols::java_util_HashMap(), Handle(), Handle(), CHECK_0);
- assert(tmp_k == NULL, "java/util/HashMap should not be loaded yet");
-#endif
- Klass* k_o = SystemDictionary::resolve_or_null(vmSymbols::java_util_HashMap(), Handle(), Handle(), CHECK_0);
- KlassHandle k = KlassHandle(THREAD, k_o);
- guarantee(k.not_null(), "Must find java/util/HashMap");
- instanceKlassHandle ik = instanceKlassHandle(THREAD, k());
- ik->initialize(CHECK_0);
- fieldDescriptor fd;
- // Possible we might not find this field; if so, don't break
- if (ik->find_local_field(vmSymbols::frontCacheEnabled_name(), vmSymbols::bool_signature(), &fd)) {
- k()->java_mirror()->bool_field_put(fd.offset(), true);
- }
- }
-
- if (UseStringCache) {
- // Forcibly initialize java/lang/StringValue and mutate the private
- // static final "stringCacheEnabled" field before we start creating instances
- Klass* k_o = SystemDictionary::resolve_or_null(vmSymbols::java_lang_StringValue(), Handle(), Handle(), CHECK_0);
- // Possible that StringValue isn't present: if so, silently don't break
- if (k_o != NULL) {
- KlassHandle k = KlassHandle(THREAD, k_o);
- instanceKlassHandle ik = instanceKlassHandle(THREAD, k());
- ik->initialize(CHECK_0);
- fieldDescriptor fd;
- // Possible we might not find this field: if so, silently don't break
- if (ik->find_local_field(vmSymbols::stringCacheEnabled_name(), vmSymbols::bool_signature(), &fd)) {
- k()->java_mirror()->bool_field_put(fd.offset(), true);
- }
- }
- }
- }
-
// Initialize java_lang.System (needed before creating the thread)
initialize_class(vmSymbols::java_lang_System(), CHECK_0);
initialize_class(vmSymbols::java_lang_ThreadGroup(), CHECK_0);