src/share/vm/classfile/symbolTable.cpp

Print this page
rev 4736 : 8015422: Large performance hit when the StringTable is walked twice in Parallel Scavenge
Summary: Combine the calls to StringTable::unlink and StringTable::oops_do in Parallel Scavenge.
Reviewed-by: TBD1, TBD2

@@ -735,11 +735,11 @@
   Handle string;
   oop result = intern(string, chars, length, CHECK_NULL);
   return result;
 }
 
-void StringTable::unlink(BoolObjectClosure* is_alive) {
+void StringTable::unlink(BoolObjectClosure* is_alive, OopClosure* keep_alive) {
   // Readers of the table are unlocked, so we should only be removing
   // entries at a safepoint.
   assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint");
   for (int i = 0; i < the_table()->table_size(); ++i) {
     HashtableEntry<oop, mtSymbol>** p = the_table()->bucket_addr(i);

@@ -747,10 +747,13 @@
     while (entry != NULL) {
       assert(entry->literal() != NULL, "just checking");
       assert(!entry->is_shared(), "CDS not used for the StringTable");
 
       if (is_alive->do_object_b(entry->literal())) {
+        if (keep_alive != NULL) {
+          keep_alive->do_oop((oop*)entry->literal_addr());
+        }
         p = entry->next_addr();
       } else {
         *p = entry->next();
         the_table()->free_entry(entry);
       }