225 unsigned int hashValue = java_lang_String::hash_code(name, len);
226 oop found_string = lookup_shared(name, len, hashValue);
227 if (found_string != NULL) {
228 return found_string;
229 }
230 if (use_alternate_hashcode()) {
231 hashValue = alt_hash_string(name, len);
232 }
233 int index = the_table()->hash_to_index(hashValue);
234 found_string = the_table()->lookup_in_main_table(index, name, len, hashValue);
235
236 // Found
237 if (found_string != NULL) {
238 if (found_string != string_or_null()) {
239 ensure_string_alive(found_string);
240 }
241 return found_string;
242 }
243
244 debug_only(StableMemoryChecker smc(name, len * sizeof(name[0])));
245 assert(!Universe::heap()->is_in_reserved(name),
246 "proposed name of symbol must be stable");
247
248 HandleMark hm(THREAD); // cleanup strings created
249 Handle string;
250 // try to reuse the string if possible
251 if (!string_or_null.is_null()) {
252 string = string_or_null;
253 } else {
254 string = java_lang_String::create_from_unicode(name, len, CHECK_NULL);
255 }
256
257 #if INCLUDE_ALL_GCS
258 if (G1StringDedup::is_enabled()) {
259 // Deduplicate the string before it is interned. Note that we should never
260 // deduplicate a string after it has been interned. Doing so will counteract
261 // compiler optimizations done on e.g. interned string literals.
262 G1StringDedup::deduplicate(string());
263 }
264 #endif
265
|
225 unsigned int hashValue = java_lang_String::hash_code(name, len);
226 oop found_string = lookup_shared(name, len, hashValue);
227 if (found_string != NULL) {
228 return found_string;
229 }
230 if (use_alternate_hashcode()) {
231 hashValue = alt_hash_string(name, len);
232 }
233 int index = the_table()->hash_to_index(hashValue);
234 found_string = the_table()->lookup_in_main_table(index, name, len, hashValue);
235
236 // Found
237 if (found_string != NULL) {
238 if (found_string != string_or_null()) {
239 ensure_string_alive(found_string);
240 }
241 return found_string;
242 }
243
244 debug_only(StableMemoryChecker smc(name, len * sizeof(name[0])));
245 assert(!GC::gc()->heap()->is_in_reserved(name),
246 "proposed name of symbol must be stable");
247
248 HandleMark hm(THREAD); // cleanup strings created
249 Handle string;
250 // try to reuse the string if possible
251 if (!string_or_null.is_null()) {
252 string = string_or_null;
253 } else {
254 string = java_lang_String::create_from_unicode(name, len, CHECK_NULL);
255 }
256
257 #if INCLUDE_ALL_GCS
258 if (G1StringDedup::is_enabled()) {
259 // Deduplicate the string before it is interned. Note that we should never
260 // deduplicate a string after it has been interned. Doing so will counteract
261 // compiler optimizations done on e.g. interned string literals.
262 G1StringDedup::deduplicate(string());
263 }
264 #endif
265
|