27 #include "gc_implementation/g1/concurrentG1RefineThread.hpp"
28 #include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
29 #include "gc_implementation/g1/g1CollectorPolicy.hpp"
30 #include "memory/resourceArea.hpp"
31 #include "runtime/handles.inline.hpp"
32 #include "runtime/mutexLocker.hpp"
33
34 ConcurrentG1RefineThread::
35 ConcurrentG1RefineThread(ConcurrentG1Refine* cg1r, ConcurrentG1RefineThread *next,
36 int worker_id_offset, int worker_id) :
37 ConcurrentGCThread(),
38 _worker_id_offset(worker_id_offset),
39 _worker_id(worker_id),
40 _active(false),
41 _next(next),
42 _monitor(NULL),
43 _cg1r(cg1r),
44 _vtime_accum(0.0)
45 {
46
47 // Each thread has its own monitor. The i-th thread is responsible for signalling
48 // to thread i+1 if the number of buffers in the queue exceeds a threashold for this
49 // thread. Monitors are also used to wake up the threads during termination.
50 // The 0th worker in notified by mutator threads and has a special monitor.
51 // The last worker is used for young gen rset size sampling.
52 if (worker_id > 0) {
53 _monitor = new Monitor(Mutex::nonleaf, "Refinement monitor", true);
54 } else {
55 _monitor = DirtyCardQ_CBL_mon;
56 }
57 initialize();
58 create_and_start();
59 }
60
61 void ConcurrentG1RefineThread::initialize() {
62 if (_worker_id < cg1r()->worker_thread_num()) {
63 // Current thread activation threshold
64 _threshold = MIN2<int>(cg1r()->thread_threshold_step() * (_worker_id + 1) + cg1r()->green_zone(),
65 cg1r()->yellow_zone());
66 // A thread deactivates once the number of buffer reached a deactivation threshold
67 _deactivation_threshold = MAX2<int>(_threshold - cg1r()->thread_threshold_step(), cg1r()->green_zone());
68 } else {
|
27 #include "gc_implementation/g1/concurrentG1RefineThread.hpp"
28 #include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
29 #include "gc_implementation/g1/g1CollectorPolicy.hpp"
30 #include "memory/resourceArea.hpp"
31 #include "runtime/handles.inline.hpp"
32 #include "runtime/mutexLocker.hpp"
33
34 ConcurrentG1RefineThread::
35 ConcurrentG1RefineThread(ConcurrentG1Refine* cg1r, ConcurrentG1RefineThread *next,
36 int worker_id_offset, int worker_id) :
37 ConcurrentGCThread(),
38 _worker_id_offset(worker_id_offset),
39 _worker_id(worker_id),
40 _active(false),
41 _next(next),
42 _monitor(NULL),
43 _cg1r(cg1r),
44 _vtime_accum(0.0)
45 {
46
47 // Each thread has its own monitor. The i-th thread is responsible for signaling
48 // to thread i+1 if the number of buffers in the queue exceeds a threshold for this
49 // thread. Monitors are also used to wake up the threads during termination.
50 // The 0th worker in notified by mutator threads and has a special monitor.
51 // The last worker is used for young gen rset size sampling.
52 if (worker_id > 0) {
53 _monitor = new Monitor(Mutex::nonleaf, "Refinement monitor", true);
54 } else {
55 _monitor = DirtyCardQ_CBL_mon;
56 }
57 initialize();
58 create_and_start();
59 }
60
61 void ConcurrentG1RefineThread::initialize() {
62 if (_worker_id < cg1r()->worker_thread_num()) {
63 // Current thread activation threshold
64 _threshold = MIN2<int>(cg1r()->thread_threshold_step() * (_worker_id + 1) + cg1r()->green_zone(),
65 cg1r()->yellow_zone());
66 // A thread deactivates once the number of buffer reached a deactivation threshold
67 _deactivation_threshold = MAX2<int>(_threshold - cg1r()->thread_threshold_step(), cg1r()->green_zone());
68 } else {
|