1.1 --- a/src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.hpp Tue Nov 22 04:47:10 2011 -0500 1.2 +++ b/src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.hpp Tue Aug 09 10:16:01 2011 -0700 1.3 @@ -48,6 +48,7 @@ 1.4 friend class StealRegionCompactionTask; 1.5 friend class UpdateAndFillClosure; 1.6 friend class RefProcTaskExecutor; 1.7 + friend class IdleGCTask; 1.8 1.9 public: 1.10 1.11 @@ -85,7 +86,31 @@ 1.12 // Is there a way to reuse the _marking_stack for the 1.13 // saving empty regions? For now just create a different 1.14 // type of TaskQueue. 1.15 - RegionTaskQueue _region_stack; 1.16 + RegionTaskQueue* _region_stack; 1.17 + 1.18 + static RegionTaskQueue** _region_list; 1.19 + // Index in _region_list for current _region_stack. 1.20 + uint _region_stack_index; 1.21 + 1.22 + // Indexes of recycled region stacks/overflow stacks 1.23 + // Stacks of regions to be compacted are embedded in the tasks doing 1.24 + // the compaction. A thread that executes the task extracts the 1.25 + // region stack and drains it. These threads keep these region 1.26 + // stacks for use during compaction task stealing. If a thread 1.27 + // gets a second draining task, it pushed its current region stack 1.28 + // index into the array _recycled_stack_index and gets a new 1.29 + // region stack from the task. A thread that is executing a 1.30 + // compaction stealing task without ever having executing a 1.31 + // draining task, will get a region stack from _recycled_stack_index. 1.32 + // 1.33 + // Array of indexes into the array of region stacks. 1.34 + static uint* _recycled_stack_index; 1.35 + // The index into _recycled_stack_index of the last region stack index 1.36 + // pushed. If -1, there are no entries into _recycled_stack_index. 1.37 + static int _recycled_top; 1.38 + // The index into _recycled_stack_index of the last region stack index 1.39 + // popped. If -1, there has not been any entry popped. 1.40 + static int _recycled_bottom; 1.41 1.42 Stack<Klass*> _revisit_klass_stack; 1.43 Stack<DataLayout*> _revisit_mdo_stack; 1.44 @@ -104,7 +129,6 @@ 1.45 // Array of tasks. Needed by the ParallelTaskTerminator. 1.46 static RegionTaskQueueSet* region_array() { return _region_array; } 1.47 OverflowTaskQueue<oop>* marking_stack() { return &_marking_stack; } 1.48 - RegionTaskQueue* region_stack() { return &_region_stack; } 1.49 1.50 // Pushes onto the marking stack. If the marking stack is full, 1.51 // pushes onto the overflow stack. 1.52 @@ -116,10 +140,33 @@ 1.53 Action action() { return _action; } 1.54 void set_action(Action v) { _action = v; } 1.55 1.56 + RegionTaskQueue* region_stack() { return _region_stack; } 1.57 + void set_region_stack(RegionTaskQueue* v) { _region_stack = v; } 1.58 + 1.59 inline static ParCompactionManager* manager_array(int index); 1.60 1.61 + inline static RegionTaskQueue* region_list(int index) { 1.62 + return _region_list[index]; 1.63 + } 1.64 + 1.65 + uint region_stack_index() { return _region_stack_index; } 1.66 + void set_region_stack_index(uint v) { _region_stack_index = v; } 1.67 + 1.68 + // Pop and push unique reusable stack index 1.69 + static int pop_recycled_stack_index(); 1.70 + static void push_recycled_stack_index(uint v); 1.71 + static void reset_recycled_stack_index() { 1.72 + _recycled_bottom = _recycled_top = -1; 1.73 + } 1.74 + 1.75 ParCompactionManager(); 1.76 + ~ParCompactionManager(); 1.77 1.78 + // Pushes onto the region stack at the given index. If the 1.79 + // region stack is full, 1.80 + // pushes onto the region overflow stack. 1.81 + static void region_list_push(uint stack_index, size_t region_index); 1.82 + static void verify_region_list_empty(uint stack_index); 1.83 ParMarkBitMap* mark_bitmap() { return _mark_bitmap; } 1.84 1.85 // Take actions in preparation for a compaction.