changeset 36187:1d61b06a3ae1

8149837: String.intern creates morre work than necessary for G1 Summary: Only use the SATB read barrier when reading existing strings from string table, not when adding new strings. Reviewed-by: stefank, kbarrett
author drwhite
date Wed, 17 Feb 2016 18:02:03 -0500
parents 06763de0d7ad
children 99b6836dd3e8 2fbe2434b914 07d2ba48d1d3
files hotspot/src/share/vm/classfile/stringTable.cpp
diffstat 1 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/hotspot/src/share/vm/classfile/stringTable.cpp	Thu Feb 18 17:10:48 2016 -0500
+++ b/hotspot/src/share/vm/classfile/stringTable.cpp	Wed Feb 17 18:02:03 2016 -0500
@@ -200,7 +200,6 @@
   return string;
 }
 
-
 oop StringTable::intern(Handle string_or_null, jchar* name,
                         int len, TRAPS) {
   oop found_string = lookup_shared(name, len);
@@ -214,7 +213,9 @@
 
   // Found
   if (found_string != NULL) {
-    ensure_string_alive(found_string);
+    if (found_string != string_or_null()) {
+      ensure_string_alive(found_string);
+    }
     return found_string;
   }
 
@@ -249,7 +250,9 @@
                                   hashValue, CHECK_NULL);
   }
 
-  ensure_string_alive(added_or_found);
+  if (added_or_found != string()) {
+    ensure_string_alive(added_or_found);
+  }
 
   return added_or_found;
 }