28 #include "gc/g1/g1FreeIdSet.hpp"
29 #include "gc/g1/g1RemSet.hpp"
30 #include "gc/g1/g1ThreadLocalData.hpp"
31 #include "gc/g1/heapRegionRemSet.hpp"
32 #include "gc/shared/suspendibleThreadSet.hpp"
33 #include "gc/shared/workgroup.hpp"
34 #include "runtime/atomic.hpp"
35 #include "runtime/flags/flagSetting.hpp"
36 #include "runtime/mutexLocker.hpp"
37 #include "runtime/safepoint.hpp"
38 #include "runtime/thread.inline.hpp"
39 #include "runtime/threadSMR.hpp"
40
41 // Closure used for updating remembered sets and recording references that
42 // point into the collection set while the mutator is running.
43 // Assumed to be only executed concurrently with the mutator. Yields via
44 // SuspendibleThreadSet after every card.
45 class G1RefineCardConcurrentlyClosure: public G1CardTableEntryClosure {
46 public:
47 bool do_card_ptr(jbyte* card_ptr, uint worker_i) {
48 G1CollectedHeap::heap()->g1_rem_set()->refine_card_concurrently(card_ptr, worker_i);
49
50 if (SuspendibleThreadSet::should_yield()) {
51 // Caller will actually yield.
52 return false;
53 }
54 // Otherwise, we finished successfully; return true.
55 return true;
56 }
57 };
58
59 G1DirtyCardQueue::G1DirtyCardQueue(G1DirtyCardQueueSet* qset, bool permanent) :
60 // Dirty card queues are always active, so we create them with their
61 // active field set to true.
62 PtrQueue(qset, permanent, true /* active */)
63 { }
64
65 G1DirtyCardQueue::~G1DirtyCardQueue() {
66 if (!is_permanent()) {
67 flush();
68 }
|
28 #include "gc/g1/g1FreeIdSet.hpp"
29 #include "gc/g1/g1RemSet.hpp"
30 #include "gc/g1/g1ThreadLocalData.hpp"
31 #include "gc/g1/heapRegionRemSet.hpp"
32 #include "gc/shared/suspendibleThreadSet.hpp"
33 #include "gc/shared/workgroup.hpp"
34 #include "runtime/atomic.hpp"
35 #include "runtime/flags/flagSetting.hpp"
36 #include "runtime/mutexLocker.hpp"
37 #include "runtime/safepoint.hpp"
38 #include "runtime/thread.inline.hpp"
39 #include "runtime/threadSMR.hpp"
40
41 // Closure used for updating remembered sets and recording references that
42 // point into the collection set while the mutator is running.
43 // Assumed to be only executed concurrently with the mutator. Yields via
44 // SuspendibleThreadSet after every card.
45 class G1RefineCardConcurrentlyClosure: public G1CardTableEntryClosure {
46 public:
47 bool do_card_ptr(jbyte* card_ptr, uint worker_i) {
48 G1CollectedHeap::heap()->rem_set()->refine_card_concurrently(card_ptr, worker_i);
49
50 if (SuspendibleThreadSet::should_yield()) {
51 // Caller will actually yield.
52 return false;
53 }
54 // Otherwise, we finished successfully; return true.
55 return true;
56 }
57 };
58
59 G1DirtyCardQueue::G1DirtyCardQueue(G1DirtyCardQueueSet* qset, bool permanent) :
60 // Dirty card queues are always active, so we create them with their
61 // active field set to true.
62 PtrQueue(qset, permanent, true /* active */)
63 { }
64
65 G1DirtyCardQueue::~G1DirtyCardQueue() {
66 if (!is_permanent()) {
67 flush();
68 }
|