35 // require these closure objects to be stack-allocated. |
35 // require these closure objects to be stack-allocated. |
36 class CardTableEntryClosure: public CHeapObj<mtGC> { |
36 class CardTableEntryClosure: public CHeapObj<mtGC> { |
37 public: |
37 public: |
38 // Process the card whose card table entry is "card_ptr". If returns |
38 // Process the card whose card table entry is "card_ptr". If returns |
39 // "false", terminate the iteration early. |
39 // "false", terminate the iteration early. |
40 virtual bool do_card_ptr(jbyte* card_ptr, uint worker_i = 0) = 0; |
40 virtual bool do_card_ptr(jbyte* card_ptr, uint worker_i) = 0; |
41 }; |
41 }; |
42 |
42 |
43 // A ptrQueue whose elements are "oops", pointers to object heads. |
43 // A ptrQueue whose elements are "oops", pointers to object heads. |
44 class DirtyCardQueue: public PtrQueue { |
44 class DirtyCardQueue: public PtrQueue { |
45 public: |
45 public: |
50 ~DirtyCardQueue(); |
50 ~DirtyCardQueue(); |
51 |
51 |
52 // Process queue entries and release resources. |
52 // Process queue entries and release resources. |
53 void flush() { flush_impl(); } |
53 void flush() { flush_impl(); } |
54 |
54 |
55 // Apply the closure to the elements from _index to _sz. If all |
|
56 // closure applications return true, then returns true. Stops |
|
57 // processing after the first closure application that returns |
|
58 // false, and returns false from this function. If "consume" is |
|
59 // true, _index is updated to follow the last processed element. |
|
60 bool apply_closure(CardTableEntryClosure* cl, |
|
61 bool consume = true, |
|
62 uint worker_i = 0); |
|
63 |
|
64 // Apply the closure to the elements of "node" from it's index to |
|
65 // buffer_size. If all closure applications return true, then |
|
66 // returns true. Stops processing after the first closure |
|
67 // application that returns false, and returns false from this |
|
68 // function. If "consume" is true, the node's index is updated to |
|
69 // follow the last processed element. |
|
70 static bool apply_closure_to_buffer(CardTableEntryClosure* cl, |
|
71 BufferNode* node, |
|
72 size_t buffer_size, |
|
73 bool consume = true, |
|
74 uint worker_i = 0); |
|
75 void **get_buf() { return _buf;} |
55 void **get_buf() { return _buf;} |
76 size_t get_index() { return _index;} |
56 size_t get_index() { return _index;} |
77 void reinitialize() { _buf = 0; _sz = 0; _index = 0;} |
57 void reinitialize() { _buf = 0; _sz = 0; _index = 0;} |
78 |
58 |
79 // Compiler support. |
59 // Compiler support. |
94 class DirtyCardQueueSet: public PtrQueueSet { |
74 class DirtyCardQueueSet: public PtrQueueSet { |
95 // The closure used in mut_process_buffer(). |
75 // The closure used in mut_process_buffer(). |
96 CardTableEntryClosure* _mut_process_closure; |
76 CardTableEntryClosure* _mut_process_closure; |
97 |
77 |
98 DirtyCardQueue _shared_dirty_card_queue; |
78 DirtyCardQueue _shared_dirty_card_queue; |
|
79 |
|
80 // Apply the closure to the elements of "node" from it's index to |
|
81 // buffer_size. If all closure applications return true, then |
|
82 // returns true. Stops processing after the first closure |
|
83 // application that returns false, and returns false from this |
|
84 // function. If "consume" is true, the node's index is updated to |
|
85 // follow the last processed element. |
|
86 bool apply_closure_to_buffer(CardTableEntryClosure* cl, |
|
87 BufferNode* node, |
|
88 bool consume, |
|
89 uint worker_i = 0); |
99 |
90 |
100 bool mut_process_buffer(BufferNode* node); |
91 bool mut_process_buffer(BufferNode* node); |
101 |
92 |
102 // Protected by the _cbl_mon. |
93 // Protected by the _cbl_mon. |
103 FreeIdSet* _free_ids; |
94 FreeIdSet* _free_ids; |