< prev index next >

src/hotspot/share/classfile/stringTable.cpp

Print this page
rev 48032 : imported patch Access_strings
rev 48033 : [mq]: Access_strings_v2

@@ -150,12 +150,14 @@
                                       int len, unsigned int hash) {
   int count = 0;
   for (HashtableEntry<oop, mtSymbol>* l = bucket(index); l != NULL; l = l->next()) {
     count++;
     if (l->hash() == hash) {
-      oop string = string_object_no_keepalive(l);
-      if (java_lang_String::equals(string, name, len)) {
+      if (java_lang_String::equals(string_object_no_keepalive(l), name, len)) {
+        // We must perform a new load with string_object() that keeps the string
+        // alive as we must expose the oop as strongly reachable when exiting
+        // this context, in case the oop gets published.
         return string_object(l);
       }
     }
   }
   // If the bucket size is too deep check if this hash code is insufficient.
< prev index next >