< prev index next >

src/share/vm/runtime/sweeper.cpp

Print this page
rev 13053 : 8180932: Parallelize safepoint cleanup
Summary: Provide infrastructure to do safepoint cleanup tasks using parallel worker threads
Reviewed-by: dholmes, rehn

*** 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,220 ---- * 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); + // TODO: Is this really needed? + OrderAccess::storestore(); + } + } + + 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. --- 238,254 ---- _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 >