53 // The state needed by thread performing parallel young-gen collection. |
53 // The state needed by thread performing parallel young-gen collection. |
54 class ParScanThreadState { |
54 class ParScanThreadState { |
55 friend class ParScanThreadStateSet; |
55 friend class ParScanThreadStateSet; |
56 private: |
56 private: |
57 ObjToScanQueue *_work_queue; |
57 ObjToScanQueue *_work_queue; |
|
58 GrowableArray<oop>* _overflow_stack; |
58 |
59 |
59 ParGCAllocBuffer _to_space_alloc_buffer; |
60 ParGCAllocBuffer _to_space_alloc_buffer; |
60 |
61 |
61 ParScanWithoutBarrierClosure _to_space_closure; // scan_without_gc_barrier |
62 ParScanWithoutBarrierClosure _to_space_closure; // scan_without_gc_barrier |
62 ParScanWithBarrierClosure _old_gen_closure; // scan_with_gc_barrier |
63 ParScanWithBarrierClosure _old_gen_closure; // scan_with_gc_barrier |
131 ParScanClosure& older_gen_closure() { return _older_gen_closure; } |
135 ParScanClosure& older_gen_closure() { return _older_gen_closure; } |
132 ParRootScanWithoutBarrierClosure& to_space_root_closure() { return _to_space_root_closure; }; |
136 ParRootScanWithoutBarrierClosure& to_space_root_closure() { return _to_space_root_closure; }; |
133 |
137 |
134 // Decrease queue size below "max_size". |
138 // Decrease queue size below "max_size". |
135 void trim_queues(int max_size); |
139 void trim_queues(int max_size); |
|
140 |
|
141 // Private overflow stack usage |
|
142 GrowableArray<oop>* overflow_stack() { return _overflow_stack; } |
|
143 bool take_from_overflow_stack(); |
|
144 void push_on_overflow_stack(oop p); |
136 |
145 |
137 // Is new_obj a candidate for scan_partial_array_and_push_remainder method. |
146 // Is new_obj a candidate for scan_partial_array_and_push_remainder method. |
138 inline bool should_be_partially_scanned(oop new_obj, oop old_obj) const; |
147 inline bool should_be_partially_scanned(oop new_obj, oop old_obj) const; |
139 |
148 |
140 int* hash_seed() { return &_hash_seed; } |
149 int* hash_seed() { return &_hash_seed; } |
376 |
385 |
377 // in support of testing overflow code |
386 // in support of testing overflow code |
378 NOT_PRODUCT(int _overflow_counter;) |
387 NOT_PRODUCT(int _overflow_counter;) |
379 NOT_PRODUCT(bool should_simulate_overflow();) |
388 NOT_PRODUCT(bool should_simulate_overflow();) |
380 |
389 |
|
390 // Accessor for overflow list |
|
391 oop overflow_list() { return _overflow_list; } |
|
392 |
381 // Push the given (from-space) object on the global overflow list. |
393 // Push the given (from-space) object on the global overflow list. |
382 void push_on_overflow_list(oop from_space_obj, ParScanThreadState* par_scan_state); |
394 void push_on_overflow_list(oop from_space_obj, ParScanThreadState* par_scan_state); |
383 |
395 |
384 // If the global overflow list is non-empty, move some tasks from it |
396 // If the global overflow list is non-empty, move some tasks from it |
385 // onto "work_q" (which must be empty). No more than 1/4 of the |
397 // onto "work_q" (which need not be empty). No more than 1/4 of the |
386 // max_elems of "work_q" are moved. |
398 // available space on "work_q" is used. |
387 bool take_from_overflow_list(ParScanThreadState* par_scan_state); |
399 bool take_from_overflow_list(ParScanThreadState* par_scan_state); |
|
400 bool take_from_overflow_list_work(ParScanThreadState* par_scan_state); |
388 |
401 |
389 // The task queues to be used by parallel GC threads. |
402 // The task queues to be used by parallel GC threads. |
390 ObjToScanQueueSet* task_queues() { |
403 ObjToScanQueueSet* task_queues() { |
391 return _task_queues; |
404 return _task_queues; |
392 } |
405 } |