Mercurial > hg > graal-compiler
diff src/share/vm/gc_implementation/shared/markSweep.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 | d1605aabd0a1 |
children | 89e0543e1737 c3c4a1d3801a 54b3b351d6f9 |
line wrap: on
line diff
--- a/src/share/vm/gc_implementation/shared/markSweep.cpp Mon Aug 31 05:27:29 2009 -0700 +++ b/src/share/vm/gc_implementation/shared/markSweep.cpp Wed Sep 02 00:04:29 2009 -0700 @@ -27,6 +27,7 @@ GrowableArray<oop>* MarkSweep::_marking_stack = NULL; GrowableArray<Klass*>* MarkSweep::_revisit_klass_stack = NULL; +GrowableArray<DataLayout*>* MarkSweep::_revisit_mdo_stack = NULL; GrowableArray<oop>* MarkSweep::_preserved_oop_stack = NULL; GrowableArray<markOop>* MarkSweep::_preserved_mark_stack= NULL; @@ -62,12 +63,37 @@ void MarkSweep::follow_weak_klass_links() { // All klasses on the revisit stack are marked at this point. // Update and follow all subklass, sibling and implementor links. + if (PrintRevisitStats) { + gclog_or_tty->print_cr("#classes in system dictionary = %d", SystemDictionary::number_of_classes()); + gclog_or_tty->print_cr("Revisit klass stack length = %d", _revisit_klass_stack->length()); + } for (int i = 0; i < _revisit_klass_stack->length(); i++) { _revisit_klass_stack->at(i)->follow_weak_klass_links(&is_alive,&keep_alive); } follow_stack(); } +#if ( defined(COMPILER1) || defined(COMPILER2) ) +void MarkSweep::revisit_mdo(DataLayout* p) { + _revisit_mdo_stack->push(p); +} + +void MarkSweep::follow_mdo_weak_refs() { + // All strongly reachable oops have been marked at this point; + // we can visit and clear any weak references from MDO's which + // we memoized during the strong marking phase. + assert(_marking_stack->is_empty(), "Marking stack should be empty"); + if (PrintRevisitStats) { + gclog_or_tty->print_cr("#classes in system dictionary = %d", SystemDictionary::number_of_classes()); + gclog_or_tty->print_cr("Revisit MDO stack length = %d", _revisit_mdo_stack->length()); + } + for (int i = 0; i < _revisit_mdo_stack->length(); i++) { + _revisit_mdo_stack->at(i)->follow_weak_refs(&is_alive); + } + follow_stack(); +} +#endif // ( COMPILER1 || COMPILER2 ) + MarkSweep::FollowRootClosure MarkSweep::follow_root_closure; void MarkSweep::FollowRootClosure::do_oop(oop* p) { follow_root(p); }