Mercurial > hg > graal-compiler
comparison src/share/vm/runtime/thread.cpp @ 192:6d13fcb3663f
6714404: Add UseStringCache switch to enable String caching under AggressiveOpts
Summary: Poke String.stringCacheEnabled during vm initialization
Reviewed-by: never
author | kvn |
---|---|
date | Fri, 13 Jun 2008 14:49:07 -0700 |
parents | cd0742ba123c |
children | d1605aabd0a1 69fefd031e6c |
comparison
equal
deleted
inserted
replaced
191:3ad4bacbcdbe | 192:6d13fcb3663f |
---|---|
2924 } else { | 2924 } else { |
2925 warning("java.lang.String not initialized"); | 2925 warning("java.lang.String not initialized"); |
2926 } | 2926 } |
2927 | 2927 |
2928 if (AggressiveOpts) { | 2928 if (AggressiveOpts) { |
2929 // Forcibly initialize java/util/HashMap and mutate the private | 2929 { |
2930 // static final "frontCacheEnabled" field before we start creating instances | 2930 // Forcibly initialize java/util/HashMap and mutate the private |
2931 // static final "frontCacheEnabled" field before we start creating instances | |
2931 #ifdef ASSERT | 2932 #ifdef ASSERT |
2932 klassOop tmp_k = SystemDictionary::find(vmSymbolHandles::java_util_HashMap(), Handle(), Handle(), CHECK_0); | 2933 klassOop tmp_k = SystemDictionary::find(vmSymbolHandles::java_util_HashMap(), Handle(), Handle(), CHECK_0); |
2933 assert(tmp_k == NULL, "java/util/HashMap should not be loaded yet"); | 2934 assert(tmp_k == NULL, "java/util/HashMap should not be loaded yet"); |
2934 #endif | 2935 #endif |
2935 klassOop k_o = SystemDictionary::resolve_or_null(vmSymbolHandles::java_util_HashMap(), Handle(), Handle(), CHECK_0); | 2936 klassOop k_o = SystemDictionary::resolve_or_null(vmSymbolHandles::java_util_HashMap(), Handle(), Handle(), CHECK_0); |
2936 KlassHandle k = KlassHandle(THREAD, k_o); | 2937 KlassHandle k = KlassHandle(THREAD, k_o); |
2937 guarantee(k.not_null(), "Must find java/util/HashMap"); | 2938 guarantee(k.not_null(), "Must find java/util/HashMap"); |
2938 instanceKlassHandle ik = instanceKlassHandle(THREAD, k()); | 2939 instanceKlassHandle ik = instanceKlassHandle(THREAD, k()); |
2939 ik->initialize(CHECK_0); | 2940 ik->initialize(CHECK_0); |
2940 fieldDescriptor fd; | 2941 fieldDescriptor fd; |
2941 // Possible we might not find this field; if so, don't break | 2942 // Possible we might not find this field; if so, don't break |
2942 if (ik->find_local_field(vmSymbols::frontCacheEnabled_name(), vmSymbols::bool_signature(), &fd)) { | 2943 if (ik->find_local_field(vmSymbols::frontCacheEnabled_name(), vmSymbols::bool_signature(), &fd)) { |
2943 k()->bool_field_put(fd.offset(), true); | 2944 k()->bool_field_put(fd.offset(), true); |
2945 } | |
2946 } | |
2947 | |
2948 if (UseStringCache) { | |
2949 // Forcibly initialize java/lang/String and mutate the private | |
2950 // static final "stringCacheEnabled" field before we start creating instances | |
2951 #ifdef ASSERT | |
2952 klassOop tmp_k = SystemDictionary::find(vmSymbolHandles::java_lang_String(), Handle(), Handle(), CHECK_0); | |
2953 assert(tmp_k == NULL, "java/lang/String should not be loaded yet"); | |
2954 #endif | |
2955 klassOop k_o = SystemDictionary::resolve_or_null(vmSymbolHandles::java_lang_String(), Handle(), Handle(), CHECK_0); | |
2956 KlassHandle k = KlassHandle(THREAD, k_o); | |
2957 guarantee(k.not_null(), "Must find java/lang/String"); | |
2958 instanceKlassHandle ik = instanceKlassHandle(THREAD, k()); | |
2959 ik->initialize(CHECK_0); | |
2960 fieldDescriptor fd; | |
2961 // Possible we might not find this field; if so, don't break | |
2962 if (ik->find_local_field(vmSymbols::stringCacheEnabled_name(), vmSymbols::bool_signature(), &fd)) { | |
2963 k()->bool_field_put(fd.offset(), true); | |
2964 } | |
2944 } | 2965 } |
2945 } | 2966 } |
2946 | 2967 |
2947 // Initialize java_lang.System (needed before creating the thread) | 2968 // Initialize java_lang.System (needed before creating the thread) |
2948 if (InitializeJavaLangSystem) { | 2969 if (InitializeJavaLangSystem) { |