From 368945608cd50d561d6b73ddf147fef5f281a714 Mon Sep 17 00:00:00 2001 From: stefank Date: Mon, 27 May 2013 12:58:42 +0200 Subject: [PATCH] 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: pliden, coleenp --- src/share/vm/classfile/symbolTable.cpp | 5 ++++- src/share/vm/classfile/symbolTable.hpp | 5 ++++- .../vm/gc_implementation/parallelScavenge/psScavenge.cpp | 8 +++----- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/share/vm/classfile/symbolTable.cpp b/src/share/vm/classfile/symbolTable.cpp index f4590c62f..c78ea2d35 100644 --- a/src/share/vm/classfile/symbolTable.cpp +++ b/src/share/vm/classfile/symbolTable.cpp @@ -737,7 +737,7 @@ oop StringTable::intern(const char* utf8_string, TRAPS) { return result; } -void StringTable::unlink(BoolObjectClosure* is_alive) { +void StringTable::unlink_or_oops_do(BoolObjectClosure* is_alive, OopClosure* f) { // 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"); @@ -748,6 +748,9 @@ void StringTable::unlink(BoolObjectClosure* is_alive) { assert(!entry->is_shared(), "CDS not used for the StringTable"); if (is_alive->do_object_b(entry->literal())) { + if (f != NULL) { + f->do_oop((oop*)entry->literal_addr()); + } p = entry->next_addr(); } else { *p = entry->next(); diff --git a/src/share/vm/classfile/symbolTable.hpp b/src/share/vm/classfile/symbolTable.hpp index a2896382f..4701e74b5 100644 --- a/src/share/vm/classfile/symbolTable.hpp +++ b/src/share/vm/classfile/symbolTable.hpp @@ -272,7 +272,10 @@ public: // GC support // Delete pointers to otherwise-unreachable objects. - static void unlink(BoolObjectClosure* cl); + static void unlink_or_oops_do(BoolObjectClosure* cl, OopClosure* f); + static void unlink(BoolObjectClosure* cl) { + unlink_or_oops_do(cl, NULL); + } // Invoke "f->do_oop" on the locations of all oops in the table. static void oops_do(OopClosure* f); diff --git a/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp b/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp index 72d2df4b9..f209a802b 100644 --- a/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp +++ b/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp @@ -450,11 +450,9 @@ bool PSScavenge::invoke_no_policy() { reference_processor()->enqueue_discovered_references(NULL); } - // Unlink any dead interned Strings - StringTable::unlink(&_is_alive_closure); - // Process the remaining live ones - PSScavengeRootsClosure root_closure(promotion_manager); - StringTable::oops_do(&root_closure); + // Unlink any dead interned Strings and process the remaining live ones. + PSScavengeRootsClosure root_closure(promotion_manager); + StringTable::unlink_or_oops_do(&_is_alive_closure, &root_closure); // Finally, flush the promotion_manager's labs, and deallocate its stacks. PSPromotionManager::post_scavenge(); -- GitLab