33
34 // Base class for processing the contents of a SATB buffer.
35 class SATBBufferClosure : public StackObj {
36 protected:
37 ~SATBBufferClosure() { }
38
39 public:
40 // Process the SATB entries in the designated buffer range.
41 virtual void do_buffer(void** buffer, size_t size) = 0;
42 };
43
44 // A ptrQueue whose elements are "oops", pointers to object heads.
45 class ObjPtrQueue: public PtrQueue {
46 friend class SATBMarkQueueSet;
47
48 private:
49 // Filter out unwanted entries from the buffer.
50 void filter();
51
52 public:
53 ObjPtrQueue(PtrQueueSet* qset, bool perm = false) :
54 // SATB queues are only active during marking cycles. We create
55 // them with their active field set to false. If a thread is
56 // created during a cycle and its SATB queue needs to be activated
57 // before the thread starts running, we'll need to set its active
58 // field to true. This is done in JavaThread::initialize_queues().
59 PtrQueue(qset, perm, false /* active */) { }
60
61 // Process queue entries and free resources.
62 void flush();
63
64 // Apply cl to the active part of the buffer.
65 // Prerequisite: Must be at a safepoint.
66 void apply_closure_and_empty(SATBBufferClosure* cl);
67
68 // Overrides PtrQueue::should_enqueue_buffer(). See the method's
69 // definition for more information.
70 virtual bool should_enqueue_buffer();
71
72 #ifndef PRODUCT
73 // Helpful for debugging
74 void print(const char* name);
75 static void print(const char* name, void** buf, size_t index, size_t sz);
76 #endif // PRODUCT
77 };
78
79 class SATBMarkQueueSet: public PtrQueueSet {
|
33
34 // Base class for processing the contents of a SATB buffer.
35 class SATBBufferClosure : public StackObj {
36 protected:
37 ~SATBBufferClosure() { }
38
39 public:
40 // Process the SATB entries in the designated buffer range.
41 virtual void do_buffer(void** buffer, size_t size) = 0;
42 };
43
44 // A ptrQueue whose elements are "oops", pointers to object heads.
45 class ObjPtrQueue: public PtrQueue {
46 friend class SATBMarkQueueSet;
47
48 private:
49 // Filter out unwanted entries from the buffer.
50 void filter();
51
52 public:
53 ObjPtrQueue(SATBMarkQueueSet* qset, bool permanent = false);
54
55 // Process queue entries and free resources.
56 void flush();
57
58 // Apply cl to the active part of the buffer.
59 // Prerequisite: Must be at a safepoint.
60 void apply_closure_and_empty(SATBBufferClosure* cl);
61
62 // Overrides PtrQueue::should_enqueue_buffer(). See the method's
63 // definition for more information.
64 virtual bool should_enqueue_buffer();
65
66 #ifndef PRODUCT
67 // Helpful for debugging
68 void print(const char* name);
69 static void print(const char* name, void** buf, size_t index, size_t sz);
70 #endif // PRODUCT
71 };
72
73 class SATBMarkQueueSet: public PtrQueueSet {
|