39 class ParCompactionManager; |
39 class ParCompactionManager; |
40 class ObjectStartArray; |
40 class ObjectStartArray; |
41 class ParallelCompactData; |
41 class ParallelCompactData; |
42 class ParMarkBitMap; |
42 class ParMarkBitMap; |
43 |
43 |
44 class ParCompactionManager : public CHeapObj { |
44 class ParCompactionManager : public CHeapObj<mtGC> { |
45 friend class ParallelTaskTerminator; |
45 friend class ParallelTaskTerminator; |
46 friend class ParMarkBitMap; |
46 friend class ParMarkBitMap; |
47 friend class PSParallelCompact; |
47 friend class PSParallelCompact; |
48 friend class StealRegionCompactionTask; |
48 friend class StealRegionCompactionTask; |
49 friend class UpdateAndFillClosure; |
49 friend class UpdateAndFillClosure; |
64 // ------------------------ End don't putback if not needed |
64 // ------------------------ End don't putback if not needed |
65 |
65 |
66 private: |
66 private: |
67 // 32-bit: 4K * 8 = 32KiB; 64-bit: 8K * 16 = 128KiB |
67 // 32-bit: 4K * 8 = 32KiB; 64-bit: 8K * 16 = 128KiB |
68 #define QUEUE_SIZE (1 << NOT_LP64(12) LP64_ONLY(13)) |
68 #define QUEUE_SIZE (1 << NOT_LP64(12) LP64_ONLY(13)) |
69 typedef OverflowTaskQueue<ObjArrayTask, QUEUE_SIZE> ObjArrayTaskQueue; |
69 typedef OverflowTaskQueue<ObjArrayTask, mtGC, QUEUE_SIZE> ObjArrayTaskQueue; |
70 typedef GenericTaskQueueSet<ObjArrayTaskQueue> ObjArrayTaskQueueSet; |
70 typedef GenericTaskQueueSet<ObjArrayTaskQueue, mtGC> ObjArrayTaskQueueSet; |
71 #undef QUEUE_SIZE |
71 #undef QUEUE_SIZE |
72 |
72 |
73 static ParCompactionManager** _manager_array; |
73 static ParCompactionManager** _manager_array; |
74 static OopTaskQueueSet* _stack_array; |
74 static OopTaskQueueSet* _stack_array; |
75 static ObjArrayTaskQueueSet* _objarray_queues; |
75 static ObjArrayTaskQueueSet* _objarray_queues; |
76 static ObjectStartArray* _start_array; |
76 static ObjectStartArray* _start_array; |
77 static RegionTaskQueueSet* _region_array; |
77 static RegionTaskQueueSet* _region_array; |
78 static PSOldGen* _old_gen; |
78 static PSOldGen* _old_gen; |
79 |
79 |
80 private: |
80 private: |
81 OverflowTaskQueue<oop> _marking_stack; |
81 OverflowTaskQueue<oop, mtGC> _marking_stack; |
82 ObjArrayTaskQueue _objarray_stack; |
82 ObjArrayTaskQueue _objarray_stack; |
83 |
83 |
84 // Is there a way to reuse the _marking_stack for the |
84 // Is there a way to reuse the _marking_stack for the |
85 // saving empty regions? For now just create a different |
85 // saving empty regions? For now just create a different |
86 // type of TaskQueue. |
86 // type of TaskQueue. |
108 static int _recycled_top; |
108 static int _recycled_top; |
109 // The index into _recycled_stack_index of the last region stack index |
109 // The index into _recycled_stack_index of the last region stack index |
110 // popped. If -1, there has not been any entry popped. |
110 // popped. If -1, there has not been any entry popped. |
111 static int _recycled_bottom; |
111 static int _recycled_bottom; |
112 |
112 |
113 Stack<Klass*> _revisit_klass_stack; |
113 Stack<Klass*, mtGC> _revisit_klass_stack; |
114 Stack<DataLayout*> _revisit_mdo_stack; |
114 Stack<DataLayout*, mtGC> _revisit_mdo_stack; |
115 |
115 |
116 static ParMarkBitMap* _mark_bitmap; |
116 static ParMarkBitMap* _mark_bitmap; |
117 |
117 |
118 Action _action; |
118 Action _action; |
119 |
119 |
124 static void initialize(ParMarkBitMap* mbm); |
124 static void initialize(ParMarkBitMap* mbm); |
125 |
125 |
126 protected: |
126 protected: |
127 // Array of tasks. Needed by the ParallelTaskTerminator. |
127 // Array of tasks. Needed by the ParallelTaskTerminator. |
128 static RegionTaskQueueSet* region_array() { return _region_array; } |
128 static RegionTaskQueueSet* region_array() { return _region_array; } |
129 OverflowTaskQueue<oop>* marking_stack() { return &_marking_stack; } |
129 OverflowTaskQueue<oop, mtGC>* marking_stack() { return &_marking_stack; } |
130 |
130 |
131 // Pushes onto the marking stack. If the marking stack is full, |
131 // Pushes onto the marking stack. If the marking stack is full, |
132 // pushes onto the overflow stack. |
132 // pushes onto the overflow stack. |
133 void stack_push(oop obj); |
133 void stack_push(oop obj); |
134 // Do not implement an equivalent stack_pop. Deal with the |
134 // Do not implement an equivalent stack_pop. Deal with the |
173 // void drain_stacks(); |
173 // void drain_stacks(); |
174 |
174 |
175 bool should_update(); |
175 bool should_update(); |
176 bool should_copy(); |
176 bool should_copy(); |
177 |
177 |
178 Stack<Klass*>* revisit_klass_stack() { return &_revisit_klass_stack; } |
178 Stack<Klass*, mtGC>* revisit_klass_stack() { return &_revisit_klass_stack; } |
179 Stack<DataLayout*>* revisit_mdo_stack() { return &_revisit_mdo_stack; } |
179 Stack<DataLayout*, mtGC>* revisit_mdo_stack() { return &_revisit_mdo_stack; } |
180 |
180 |
181 // Save for later processing. Must not fail. |
181 // Save for later processing. Must not fail. |
182 inline void push(oop obj) { _marking_stack.push(obj); } |
182 inline void push(oop obj) { _marking_stack.push(obj); } |
183 inline void push_objarray(oop objarray, size_t index); |
183 inline void push_objarray(oop objarray, size_t index); |
184 inline void push_region(size_t index); |
184 inline void push_region(size_t index); |