提交 d35d2a8b 编写于 作者: P phh

6810653: Change String cache class used by Hotspot from String to StringValue

Summary: Change create_vm() to load and initialize StringValue rather than String.
Reviewed-by: kvn
上级 20b80b69
...@@ -49,6 +49,7 @@ ...@@ -49,6 +49,7 @@
template(java_lang_Object, "java/lang/Object") \ template(java_lang_Object, "java/lang/Object") \
template(java_lang_Class, "java/lang/Class") \ template(java_lang_Class, "java/lang/Class") \
template(java_lang_String, "java/lang/String") \ template(java_lang_String, "java/lang/String") \
template(java_lang_StringValue, "java/lang/StringValue") \
template(java_lang_Thread, "java/lang/Thread") \ template(java_lang_Thread, "java/lang/Thread") \
template(java_lang_ThreadGroup, "java/lang/ThreadGroup") \ template(java_lang_ThreadGroup, "java/lang/ThreadGroup") \
template(java_lang_Cloneable, "java/lang/Cloneable") \ template(java_lang_Cloneable, "java/lang/Cloneable") \
......
...@@ -3007,20 +3007,22 @@ jint Threads::create_vm(JavaVMInitArgs* args, bool* canTryAgain) { ...@@ -3007,20 +3007,22 @@ jint Threads::create_vm(JavaVMInitArgs* args, bool* canTryAgain) {
} }
if (UseStringCache) { if (UseStringCache) {
// Forcibly initialize java/lang/String and mutate the private // Forcibly initialize java/lang/StringValue and mutate the private
// static final "stringCacheEnabled" field before we start creating instances // static final "stringCacheEnabled" field before we start creating instances
klassOop k_o = SystemDictionary::resolve_or_null(vmSymbolHandles::java_lang_String(), Handle(), Handle(), CHECK_0); klassOop k_o = SystemDictionary::resolve_or_null(vmSymbolHandles::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); KlassHandle k = KlassHandle(THREAD, k_o);
guarantee(k.not_null(), "Must find java/lang/String");
instanceKlassHandle ik = instanceKlassHandle(THREAD, k()); instanceKlassHandle ik = instanceKlassHandle(THREAD, k());
ik->initialize(CHECK_0); ik->initialize(CHECK_0);
fieldDescriptor fd; fieldDescriptor fd;
// Possible we might not find this field; if so, don't break // 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)) { if (ik->find_local_field(vmSymbols::stringCacheEnabled_name(), vmSymbols::bool_signature(), &fd)) {
k()->bool_field_put(fd.offset(), true); k()->bool_field_put(fd.offset(), true);
} }
} }
} }
}
// Initialize java_lang.System (needed before creating the thread) // Initialize java_lang.System (needed before creating the thread)
if (InitializeJavaLangSystem) { if (InitializeJavaLangSystem) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册