comparison src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp @ 941:8b46c4d82093

4957990: Perm heap bloat in JVM Summary: Treat ProfileData in MDO's as a source of weak, not strong, roots. Fixes the bug for stop-world collection -- the case of concurrent collection will be fixed separately. Reviewed-by: jcoomes, jmasa, kvn, never
author ysr
date Wed, 02 Sep 2009 00:04:29 -0700
parents f18338cf04b0
children c3c4a1d3801a 54b3b351d6f9
comparison
equal deleted inserted replaced
940:8624da129f0b 941:8b46c4d82093
2376 purged_class); 2376 purged_class);
2377 follow_stack(cm); // Flush marking stack. 2377 follow_stack(cm); // Flush marking stack.
2378 2378
2379 // Update subklass/sibling/implementor links of live klasses 2379 // Update subklass/sibling/implementor links of live klasses
2380 // revisit_klass_stack is used in follow_weak_klass_links(). 2380 // revisit_klass_stack is used in follow_weak_klass_links().
2381 follow_weak_klass_links(cm); 2381 follow_weak_klass_links();
2382
2383 // Revisit memoized MDO's and clear any unmarked weak refs
2384 follow_mdo_weak_refs();
2382 2385
2383 // Visit symbol and interned string tables and delete unmarked oops 2386 // Visit symbol and interned string tables and delete unmarked oops
2384 SymbolTable::unlink(is_alive_closure()); 2387 SymbolTable::unlink(is_alive_closure());
2385 StringTable::unlink(is_alive_closure()); 2388 StringTable::unlink(is_alive_closure());
2386 2389
2719 obj->follow_contents(cm); 2722 obj->follow_contents(cm);
2720 } 2723 }
2721 } 2724 }
2722 2725
2723 void 2726 void
2724 PSParallelCompact::follow_weak_klass_links(ParCompactionManager* serial_cm) { 2727 PSParallelCompact::follow_weak_klass_links() {
2725 // All klasses on the revisit stack are marked at this point. 2728 // All klasses on the revisit stack are marked at this point.
2726 // Update and follow all subklass, sibling and implementor links. 2729 // Update and follow all subklass, sibling and implementor links.
2727 for (uint i = 0; i < ParallelGCThreads+1; i++) { 2730 if (PrintRevisitStats) {
2731 gclog_or_tty->print_cr("#classes in system dictionary = %d", SystemDictionary::number_of_classes());
2732 }
2733 for (uint i = 0; i < ParallelGCThreads + 1; i++) {
2728 ParCompactionManager* cm = ParCompactionManager::manager_array(i); 2734 ParCompactionManager* cm = ParCompactionManager::manager_array(i);
2729 KeepAliveClosure keep_alive_closure(cm); 2735 KeepAliveClosure keep_alive_closure(cm);
2730 for (int i = 0; i < cm->revisit_klass_stack()->length(); i++) { 2736 int length = cm->revisit_klass_stack()->length();
2731 cm->revisit_klass_stack()->at(i)->follow_weak_klass_links( 2737 if (PrintRevisitStats) {
2738 gclog_or_tty->print_cr("Revisit klass stack[%d] length = %d", i, length);
2739 }
2740 for (int j = 0; j < length; j++) {
2741 cm->revisit_klass_stack()->at(j)->follow_weak_klass_links(
2732 is_alive_closure(), 2742 is_alive_closure(),
2733 &keep_alive_closure); 2743 &keep_alive_closure);
2734 } 2744 }
2745 // revisit_klass_stack is cleared in reset()
2735 follow_stack(cm); 2746 follow_stack(cm);
2736 } 2747 }
2737 } 2748 }
2738 2749
2739 void 2750 void
2740 PSParallelCompact::revisit_weak_klass_link(ParCompactionManager* cm, Klass* k) { 2751 PSParallelCompact::revisit_weak_klass_link(ParCompactionManager* cm, Klass* k) {
2741 cm->revisit_klass_stack()->push(k); 2752 cm->revisit_klass_stack()->push(k);
2742 } 2753 }
2754
2755 #if ( defined(COMPILER1) || defined(COMPILER2) )
2756 void PSParallelCompact::revisit_mdo(ParCompactionManager* cm, DataLayout* p) {
2757 cm->revisit_mdo_stack()->push(p);
2758 }
2759
2760 void PSParallelCompact::follow_mdo_weak_refs() {
2761 // All strongly reachable oops have been marked at this point;
2762 // we can visit and clear any weak references from MDO's which
2763 // we memoized during the strong marking phase.
2764 if (PrintRevisitStats) {
2765 gclog_or_tty->print_cr("#classes in system dictionary = %d", SystemDictionary::number_of_classes());
2766 }
2767 for (uint i = 0; i < ParallelGCThreads + 1; i++) {
2768 ParCompactionManager* cm = ParCompactionManager::manager_array(i);
2769 GrowableArray<DataLayout*>* rms = cm->revisit_mdo_stack();
2770 int length = rms->length();
2771 if (PrintRevisitStats) {
2772 gclog_or_tty->print_cr("Revisit MDO stack[%d] length = %d", i, length);
2773 }
2774 for (int j = 0; j < length; j++) {
2775 rms->at(j)->follow_weak_refs(is_alive_closure());
2776 }
2777 // revisit_mdo_stack is cleared in reset()
2778 follow_stack(cm);
2779 }
2780 }
2781 #endif // ( COMPILER1 || COMPILER2 )
2782
2743 2783
2744 #ifdef VALIDATE_MARK_SWEEP 2784 #ifdef VALIDATE_MARK_SWEEP
2745 2785
2746 void PSParallelCompact::track_adjusted_pointer(void* p, bool isroot) { 2786 void PSParallelCompact::track_adjusted_pointer(void* p, bool isroot) {
2747 if (!ValidateMarkSweep) 2787 if (!ValidateMarkSweep)