< prev index next >
src/share/vm/runtime/sweeper.cpp
Print this page
rev 13233 : 8180932: Parallelize safepoint cleanup
Summary: Provide infrastructure to do safepoint cleanup tasks using parallel worker threads
Reviewed-by: dholmes, rehn, dcubed, thartmann
*** 1,7 ****
/*
! * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
--- 1,7 ----
/*
! * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*** 110,120 ****
}
void NMethodSweeper::record_sweep(CompiledMethod* nm, int line) {
if (_records != NULL) {
_records[_sweep_index].traversal = _traversals;
! _records[_sweep_index].traversal_mark = nm->is_nmethod() ? ((nmethod*)nm)->_stack_traversal_mark : 0;
_records[_sweep_index].compile_id = nm->compile_id();
_records[_sweep_index].kind = nm->compile_kind();
_records[_sweep_index].state = nm->get_state();
_records[_sweep_index].vep = nm->verified_entry_point();
_records[_sweep_index].uep = nm->entry_point();
--- 110,120 ----
}
void NMethodSweeper::record_sweep(CompiledMethod* nm, int line) {
if (_records != NULL) {
_records[_sweep_index].traversal = _traversals;
! _records[_sweep_index].traversal_mark = nm->is_nmethod() ? ((nmethod*)nm)->stack_traversal_mark() : 0;
_records[_sweep_index].compile_id = nm->compile_id();
_records[_sweep_index].kind = nm->compile_kind();
_records[_sweep_index].state = nm->get_state();
_records[_sweep_index].vep = nm->verified_entry_point();
_records[_sweep_index].uep = nm->entry_point();
*** 197,211 ****
* Scans the stacks of all Java threads and marks activations of not-entrant methods.
* No need to synchronize access, since 'mark_active_nmethods' is always executed at a
* safepoint.
*/
void NMethodSweeper::mark_active_nmethods() {
assert(SafepointSynchronize::is_at_safepoint(), "must be executed at a safepoint");
// If we do not want to reclaim not-entrant or zombie methods there is no need
// to scan stacks
if (!MethodFlushing) {
! return;
}
// Increase time so that we can estimate when to invoke the sweeper again.
_time_counter++;
--- 197,218 ----
* Scans the stacks of all Java threads and marks activations of not-entrant methods.
* No need to synchronize access, since 'mark_active_nmethods' is always executed at a
* safepoint.
*/
void NMethodSweeper::mark_active_nmethods() {
+ CodeBlobClosure* cl = prepare_mark_active_nmethods();
+ if (cl != NULL) {
+ Threads::nmethods_do(cl);
+ }
+ }
+
+ CodeBlobClosure* NMethodSweeper::prepare_mark_active_nmethods() {
assert(SafepointSynchronize::is_at_safepoint(), "must be executed at a safepoint");
// If we do not want to reclaim not-entrant or zombie methods there is no need
// to scan stacks
if (!MethodFlushing) {
! return NULL;
}
// Increase time so that we can estimate when to invoke the sweeper again.
_time_counter++;
*** 229,246 ****
_total_time_this_sweep = Tickspan();
if (PrintMethodFlushing) {
tty->print_cr("### Sweep: stack traversal %ld", _traversals);
}
! Threads::nmethods_do(&mark_activation_closure);
} else {
// Only set hotness counter
! Threads::nmethods_do(&set_hotness_closure);
}
- OrderAccess::storestore();
}
/**
* This function triggers a VM operation that does stack scanning of active
* methods. Stack scanning is mandatory for the sweeper to make progress.
--- 236,252 ----
_total_time_this_sweep = Tickspan();
if (PrintMethodFlushing) {
tty->print_cr("### Sweep: stack traversal %ld", _traversals);
}
! return &mark_activation_closure;
} else {
// Only set hotness counter
! return &set_hotness_closure;
}
}
/**
* This function triggers a VM operation that does stack scanning of active
* methods. Stack scanning is mandatory for the sweeper to make progress.
< prev index next >