提交 55a8f298 编写于 作者: S stefank

8013160: NPG: Remove unnecessary mark stack draining after CodeCache::do_unloading

Reviewed-by: coleenp, mgerdin
上级 c09d6baa
...@@ -6007,26 +6007,23 @@ void CMSCollector::refProcessingWork(bool asynch, bool clear_all_soft_refs) { ...@@ -6007,26 +6007,23 @@ void CMSCollector::refProcessingWork(bool asynch, bool clear_all_soft_refs) {
&cmsDrainMarkingStackClosure, &cmsDrainMarkingStackClosure,
NULL); NULL);
} }
verify_work_stacks_empty();
} }
// This is the point where the entire marking should have completed.
verify_work_stacks_empty();
if (should_unload_classes()) { if (should_unload_classes()) {
{ {
TraceTime t("class unloading", PrintGCDetails, false, gclog_or_tty); TraceTime t("class unloading", PrintGCDetails, false, gclog_or_tty);
// Follow SystemDictionary roots and unload classes // Unload classes and purge the SystemDictionary.
bool purged_class = SystemDictionary::do_unloading(&_is_alive_closure); bool purged_class = SystemDictionary::do_unloading(&_is_alive_closure);
// Follow CodeCache roots and unload any methods marked for unloading // Unload nmethods.
CodeCache::do_unloading(&_is_alive_closure, purged_class); CodeCache::do_unloading(&_is_alive_closure, purged_class);
cmsDrainMarkingStackClosure.do_void(); // Prune dead klasses from subklass/sibling/implementor lists.
verify_work_stacks_empty();
// Update subklass/sibling/implementor links in KlassKlass descendants
Klass::clean_weak_klass_links(&_is_alive_closure); Klass::clean_weak_klass_links(&_is_alive_closure);
// Nothing should have been pushed onto the working stacks.
verify_work_stacks_empty();
} }
{ {
...@@ -6040,11 +6037,10 @@ void CMSCollector::refProcessingWork(bool asynch, bool clear_all_soft_refs) { ...@@ -6040,11 +6037,10 @@ void CMSCollector::refProcessingWork(bool asynch, bool clear_all_soft_refs) {
// Need to check if we really scanned the StringTable. // Need to check if we really scanned the StringTable.
if ((roots_scanning_options() & SharedHeap::SO_Strings) == 0) { if ((roots_scanning_options() & SharedHeap::SO_Strings) == 0) {
TraceTime t("scrub string table", PrintGCDetails, false, gclog_or_tty); TraceTime t("scrub string table", PrintGCDetails, false, gclog_or_tty);
// Now clean up stale oops in StringTable // Delete entries for dead interned strings.
StringTable::unlink(&_is_alive_closure); StringTable::unlink(&_is_alive_closure);
} }
verify_work_stacks_empty();
// Restore any preserved marks as a result of mark stack or // Restore any preserved marks as a result of mark stack or
// work queue overflow // work queue overflow
restore_preserved_marks_if_any(); // done single-threaded for now restore_preserved_marks_if_any(); // done single-threaded for now
......
...@@ -144,29 +144,25 @@ void G1MarkSweep::mark_sweep_phase1(bool& marked_for_unloading, ...@@ -144,29 +144,25 @@ void G1MarkSweep::mark_sweep_phase1(bool& marked_for_unloading,
&GenMarkSweep::follow_stack_closure, &GenMarkSweep::follow_stack_closure,
NULL); NULL);
// Follow system dictionary roots and unload classes
// This is the point where the entire marking should have completed.
assert(GenMarkSweep::_marking_stack.is_empty(), "Marking should have completed");
// Unload classes and purge the SystemDictionary.
bool purged_class = SystemDictionary::do_unloading(&GenMarkSweep::is_alive); bool purged_class = SystemDictionary::do_unloading(&GenMarkSweep::is_alive);
assert(GenMarkSweep::_marking_stack.is_empty(),
"stack should be empty by now");
// Follow code cache roots (has to be done after system dictionary, // Unload nmethods.
// assumes all live klasses are marked)
CodeCache::do_unloading(&GenMarkSweep::is_alive, purged_class); CodeCache::do_unloading(&GenMarkSweep::is_alive, purged_class);
GenMarkSweep::follow_stack();
// Update subklass/sibling/implementor links of live klasses // Prune dead klasses from subklass/sibling/implementor lists.
Klass::clean_weak_klass_links(&GenMarkSweep::is_alive); Klass::clean_weak_klass_links(&GenMarkSweep::is_alive);
assert(GenMarkSweep::_marking_stack.is_empty(),
"stack should be empty by now");
// Visit interned string tables and delete unmarked oops // Delete entries for dead interned strings.
StringTable::unlink(&GenMarkSweep::is_alive); StringTable::unlink(&GenMarkSweep::is_alive);
// Clean up unreferenced symbols in symbol table. // Clean up unreferenced symbols in symbol table.
SymbolTable::unlink(); SymbolTable::unlink();
assert(GenMarkSweep::_marking_stack.is_empty(),
"stack should be empty by now");
if (VerifyDuringGC) { if (VerifyDuringGC) {
HandleMark hm; // handle scope HandleMark hm; // handle scope
COMPILER2_PRESENT(DerivedPointerTableDeactivate dpt_deact); COMPILER2_PRESENT(DerivedPointerTableDeactivate dpt_deact);
......
...@@ -517,23 +517,23 @@ void PSMarkSweep::mark_sweep_phase1(bool clear_all_softrefs) { ...@@ -517,23 +517,23 @@ void PSMarkSweep::mark_sweep_phase1(bool clear_all_softrefs) {
is_alive_closure(), mark_and_push_closure(), follow_stack_closure(), NULL); is_alive_closure(), mark_and_push_closure(), follow_stack_closure(), NULL);
} }
// Follow system dictionary roots and unload classes // This is the point where the entire marking should have completed.
assert(_marking_stack.is_empty(), "Marking should have completed");
// Unload classes and purge the SystemDictionary.
bool purged_class = SystemDictionary::do_unloading(is_alive_closure()); bool purged_class = SystemDictionary::do_unloading(is_alive_closure());
// Follow code cache roots // Unload nmethods.
CodeCache::do_unloading(is_alive_closure(), purged_class); CodeCache::do_unloading(is_alive_closure(), purged_class);
follow_stack(); // Flush marking stack
// Update subklass/sibling/implementor links of live klasses // Prune dead klasses from subklass/sibling/implementor lists.
Klass::clean_weak_klass_links(&is_alive); Klass::clean_weak_klass_links(is_alive_closure());
assert(_marking_stack.is_empty(), "just drained");
// Visit interned string tables and delete unmarked oops // Delete entries for dead interned strings.
StringTable::unlink(is_alive_closure()); StringTable::unlink(is_alive_closure());
// Clean up unreferenced symbols in symbol table. // Clean up unreferenced symbols in symbol table.
SymbolTable::unlink(); SymbolTable::unlink();
assert(_marking_stack.is_empty(), "stack should be empty by now");
} }
......
...@@ -2354,22 +2354,24 @@ void PSParallelCompact::marking_phase(ParCompactionManager* cm, ...@@ -2354,22 +2354,24 @@ void PSParallelCompact::marking_phase(ParCompactionManager* cm,
} }
TraceTime tm_c("class unloading", print_phases(), true, gclog_or_tty); TraceTime tm_c("class unloading", print_phases(), true, gclog_or_tty);
// This is the point where the entire marking should have completed.
assert(cm->marking_stacks_empty(), "Marking should have completed");
// Follow system dictionary roots and unload classes. // Follow system dictionary roots and unload classes.
bool purged_class = SystemDictionary::do_unloading(is_alive_closure()); bool purged_class = SystemDictionary::do_unloading(is_alive_closure());
// Follow code cache roots. // Unload nmethods.
CodeCache::do_unloading(is_alive_closure(), purged_class); CodeCache::do_unloading(is_alive_closure(), purged_class);
cm->follow_marking_stacks(); // Flush marking stack.
// Update subklass/sibling/implementor links of live klasses // Prune dead klasses from subklass/sibling/implementor lists.
Klass::clean_weak_klass_links(is_alive_closure()); Klass::clean_weak_klass_links(is_alive_closure());
// Visit interned string tables and delete unmarked oops // Delete entries for dead interned strings.
StringTable::unlink(is_alive_closure()); StringTable::unlink(is_alive_closure());
// Clean up unreferenced symbols in symbol table. // Clean up unreferenced symbols in symbol table.
SymbolTable::unlink(); SymbolTable::unlink();
assert(cm->marking_stacks_empty(), "marking stacks should be empty");
} }
void PSParallelCompact::follow_klass(ParCompactionManager* cm, Klass* klass) { void PSParallelCompact::follow_klass(ParCompactionManager* cm, Klass* klass) {
......
...@@ -223,23 +223,23 @@ void GenMarkSweep::mark_sweep_phase1(int level, ...@@ -223,23 +223,23 @@ void GenMarkSweep::mark_sweep_phase1(int level,
&is_alive, &keep_alive, &follow_stack_closure, NULL); &is_alive, &keep_alive, &follow_stack_closure, NULL);
} }
// Follow system dictionary roots and unload classes // This is the point where the entire marking should have completed.
assert(_marking_stack.is_empty(), "Marking should have completed");
// Unload classes and purge the SystemDictionary.
bool purged_class = SystemDictionary::do_unloading(&is_alive); bool purged_class = SystemDictionary::do_unloading(&is_alive);
// Follow code cache roots // Unload nmethods.
CodeCache::do_unloading(&is_alive, purged_class); CodeCache::do_unloading(&is_alive, purged_class);
follow_stack(); // Flush marking stack
// Update subklass/sibling/implementor links of live klasses // Prune dead klasses from subklass/sibling/implementor lists.
Klass::clean_weak_klass_links(&is_alive); Klass::clean_weak_klass_links(&is_alive);
assert(_marking_stack.is_empty(), "just drained");
// Visit interned string tables and delete unmarked oops // Delete entries for dead interned strings.
StringTable::unlink(&is_alive); StringTable::unlink(&is_alive);
// Clean up unreferenced symbols in symbol table. // Clean up unreferenced symbols in symbol table.
SymbolTable::unlink(); SymbolTable::unlink();
assert(_marking_stack.is_empty(), "stack should be empty by now");
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册