mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 23:04:50 +02:00
8072498: Multi-thread JNI weak reference processing
Add parallel processing support to WeakProcessor. Reviewed-by: tschatzl, sjohanss
This commit is contained in:
parent
49b859b9d3
commit
1b02e70184
17 changed files with 863 additions and 58 deletions
|
@ -25,8 +25,12 @@
|
|||
#ifndef SHARE_VM_GC_SHARED_WEAKPROCESSOR_HPP
|
||||
#define SHARE_VM_GC_SHARED_WEAKPROCESSOR_HPP
|
||||
|
||||
#include "gc/shared/oopStorageParState.hpp"
|
||||
#include "gc/shared/workgroup.hpp"
|
||||
#include "memory/allocation.hpp"
|
||||
#include "memory/iterator.hpp"
|
||||
|
||||
class WeakProcessorPhaseTimes;
|
||||
class WorkGang;
|
||||
|
||||
// Helper class to aid in root scanning and cleaning of weak oops in the VM.
|
||||
//
|
||||
|
@ -41,6 +45,51 @@ public:
|
|||
|
||||
// Visit all oop*s and apply the given closure.
|
||||
static void oops_do(OopClosure* closure);
|
||||
|
||||
// Parallel version. Uses ergo_workers(), active workers, and
|
||||
// phase_time's max_threads to determine the number of threads to use.
|
||||
// IsAlive must be derived from BoolObjectClosure.
|
||||
// KeepAlive must be derived from OopClosure.
|
||||
template<typename IsAlive, typename KeepAlive>
|
||||
static void weak_oops_do(WorkGang* workers,
|
||||
IsAlive* is_alive,
|
||||
KeepAlive* keep_alive,
|
||||
WeakProcessorPhaseTimes* phase_times);
|
||||
|
||||
// Convenience parallel version. Uses ergo_workers() and active workers
|
||||
// to determine the number of threads to run. Implicitly logs phase times.
|
||||
// IsAlive must be derived from BoolObjectClosure.
|
||||
// KeepAlive must be derived from OopClosure.
|
||||
template<typename IsAlive, typename KeepAlive>
|
||||
static void weak_oops_do(WorkGang* workers,
|
||||
IsAlive* is_alive,
|
||||
KeepAlive* keep_alive,
|
||||
uint indent_log);
|
||||
|
||||
static uint ergo_workers(uint max_workers);
|
||||
class Task;
|
||||
|
||||
private:
|
||||
class GangTask;
|
||||
};
|
||||
|
||||
class WeakProcessor::Task {
|
||||
typedef OopStorage::ParState<false, false> StorageState;
|
||||
|
||||
WeakProcessorPhaseTimes* _phase_times;
|
||||
uint _nworkers;
|
||||
SubTasksDone _serial_phases_done;
|
||||
StorageState* _storage_states;
|
||||
|
||||
void initialize();
|
||||
|
||||
public:
|
||||
Task(uint nworkers); // No time tracking.
|
||||
Task(WeakProcessorPhaseTimes* phase_times, uint nworkers);
|
||||
~Task();
|
||||
|
||||
template<typename IsAlive, typename KeepAlive>
|
||||
void work(uint worker_id, IsAlive* is_alive, KeepAlive* keep_alive);
|
||||
};
|
||||
|
||||
#endif // SHARE_VM_GC_SHARED_WEAKPROCESSOR_HPP
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue