8015422: Large performance hit when the StringTable is walked twice in Parallel Scavenge

Mon, 27 May 2013 12:58:42 +0200

author
stefank
date
Mon, 27 May 2013 12:58:42 +0200
changeset 5196
8dbc025ff709
parent 5195
95c00927be11
child 5197
f41a577cffb0
child 5201
5534bd30c151

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 file | annotate | diff | comparison | revisions
src/share/vm/classfile/symbolTable.hpp file | annotate | diff | comparison | revisions
src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp file | annotate | diff | comparison | revisions
     1.1 --- a/src/share/vm/classfile/symbolTable.cpp	Mon May 27 12:56:34 2013 +0200
     1.2 +++ b/src/share/vm/classfile/symbolTable.cpp	Mon May 27 12:58:42 2013 +0200
     1.3 @@ -737,7 +737,7 @@
     1.4    return result;
     1.5  }
     1.6  
     1.7 -void StringTable::unlink(BoolObjectClosure* is_alive) {
     1.8 +void StringTable::unlink_or_oops_do(BoolObjectClosure* is_alive, OopClosure* f) {
     1.9    // Readers of the table are unlocked, so we should only be removing
    1.10    // entries at a safepoint.
    1.11    assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint");
    1.12 @@ -748,6 +748,9 @@
    1.13        assert(!entry->is_shared(), "CDS not used for the StringTable");
    1.14  
    1.15        if (is_alive->do_object_b(entry->literal())) {
    1.16 +        if (f != NULL) {
    1.17 +          f->do_oop((oop*)entry->literal_addr());
    1.18 +        }
    1.19          p = entry->next_addr();
    1.20        } else {
    1.21          *p = entry->next();
     2.1 --- a/src/share/vm/classfile/symbolTable.hpp	Mon May 27 12:56:34 2013 +0200
     2.2 +++ b/src/share/vm/classfile/symbolTable.hpp	Mon May 27 12:58:42 2013 +0200
     2.3 @@ -272,7 +272,10 @@
     2.4  
     2.5    // GC support
     2.6    //   Delete pointers to otherwise-unreachable objects.
     2.7 -  static void unlink(BoolObjectClosure* cl);
     2.8 +  static void unlink_or_oops_do(BoolObjectClosure* cl, OopClosure* f);
     2.9 +  static void unlink(BoolObjectClosure* cl) {
    2.10 +    unlink_or_oops_do(cl, NULL);
    2.11 +  }
    2.12  
    2.13    // Invoke "f->do_oop" on the locations of all oops in the table.
    2.14    static void oops_do(OopClosure* f);
     3.1 --- a/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp	Mon May 27 12:56:34 2013 +0200
     3.2 +++ b/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp	Mon May 27 12:58:42 2013 +0200
     3.3 @@ -450,11 +450,9 @@
     3.4        reference_processor()->enqueue_discovered_references(NULL);
     3.5      }
     3.6  
     3.7 -      // Unlink any dead interned Strings
     3.8 -      StringTable::unlink(&_is_alive_closure);
     3.9 -      // Process the remaining live ones
    3.10 -      PSScavengeRootsClosure root_closure(promotion_manager);
    3.11 -      StringTable::oops_do(&root_closure);
    3.12 +    // Unlink any dead interned Strings and process the remaining live ones.
    3.13 +    PSScavengeRootsClosure root_closure(promotion_manager);
    3.14 +    StringTable::unlink_or_oops_do(&_is_alive_closure, &root_closure);
    3.15  
    3.16      // Finally, flush the promotion_manager's labs, and deallocate its stacks.
    3.17      PSPromotionManager::post_scavenge();

mercurial