735 Handle string; |
735 Handle string; |
736 oop result = intern(string, chars, length, CHECK_NULL); |
736 oop result = intern(string, chars, length, CHECK_NULL); |
737 return result; |
737 return result; |
738 } |
738 } |
739 |
739 |
740 void StringTable::unlink(BoolObjectClosure* is_alive) { |
740 void StringTable::unlink_or_oops_do(BoolObjectClosure* is_alive, OopClosure* f) { |
741 // Readers of the table are unlocked, so we should only be removing |
741 // Readers of the table are unlocked, so we should only be removing |
742 // entries at a safepoint. |
742 // entries at a safepoint. |
743 assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint"); |
743 assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint"); |
744 for (int i = 0; i < the_table()->table_size(); ++i) { |
744 for (int i = 0; i < the_table()->table_size(); ++i) { |
745 HashtableEntry<oop, mtSymbol>** p = the_table()->bucket_addr(i); |
745 HashtableEntry<oop, mtSymbol>** p = the_table()->bucket_addr(i); |
746 HashtableEntry<oop, mtSymbol>* entry = the_table()->bucket(i); |
746 HashtableEntry<oop, mtSymbol>* entry = the_table()->bucket(i); |
747 while (entry != NULL) { |
747 while (entry != NULL) { |
748 assert(!entry->is_shared(), "CDS not used for the StringTable"); |
748 assert(!entry->is_shared(), "CDS not used for the StringTable"); |
749 |
749 |
750 if (is_alive->do_object_b(entry->literal())) { |
750 if (is_alive->do_object_b(entry->literal())) { |
|
751 if (f != NULL) { |
|
752 f->do_oop((oop*)entry->literal_addr()); |
|
753 } |
751 p = entry->next_addr(); |
754 p = entry->next_addr(); |
752 } else { |
755 } else { |
753 *p = entry->next(); |
756 *p = entry->next(); |
754 the_table()->free_entry(entry); |
757 the_table()->free_entry(entry); |
755 } |
758 } |