44 friend class UpdateAndFillClosure;
45 friend class RefProcTaskExecutor;
46 friend class PCRefProcTask;
47 friend class MarkFromRootsTask;
48 friend class UpdateDensePrefixAndCompactionTask;
49
50 public:
51
52 // ------------------------ Don't putback if not needed
53 // Actions that the compaction manager should take.
54 enum Action {
55 Update,
56 Copy,
57 UpdateAndCopy,
58 CopyAndUpdate,
59 NotValid
60 };
61 // ------------------------ End don't putback if not needed
62
63 private:
64 // 32-bit: 4K * 8 = 32KiB; 64-bit: 8K * 16 = 128KiB
65 #define QUEUE_SIZE (1 << NOT_LP64(12) LP64_ONLY(13))
66 typedef OverflowTaskQueue<ObjArrayTask, mtGC, QUEUE_SIZE> ObjArrayTaskQueue;
67 typedef GenericTaskQueueSet<ObjArrayTaskQueue, mtGC> ObjArrayTaskQueueSet;
68 #undef QUEUE_SIZE
69
70 static ParCompactionManager** _manager_array;
71 static OopTaskQueueSet* _stack_array;
72 static ObjArrayTaskQueueSet* _objarray_queues;
73 static ObjectStartArray* _start_array;
74 static RegionTaskQueueSet* _region_array;
75 static PSOldGen* _old_gen;
76
77 private:
78 OverflowTaskQueue<oop, mtGC> _marking_stack;
79 ObjArrayTaskQueue _objarray_stack;
80 size_t _next_shadow_region;
81
82 // Is there a way to reuse the _marking_stack for the
83 // saving empty regions? For now just create a different
84 // type of TaskQueue.
85 RegionTaskQueue _region_stack;
86
87 static ParMarkBitMap* _mark_bitmap;
88
89 // Contains currently free shadow regions. We use it in
90 // a LIFO fashion for better data locality and utilization.
91 static GrowableArray<size_t>* _shadow_region_array;
92
93 // Provides mutual exclusive access of _shadow_region_array.
94 // See pop/push_shadow_region_mt_safe() below
95 static Monitor* _shadow_region_monitor;
96
97 Action _action;
98
99 HeapWord* _last_query_beg;
100 oop _last_query_obj;
101 size_t _last_query_ret;
102
103 static PSOldGen* old_gen() { return _old_gen; }
104 static ObjectStartArray* start_array() { return _start_array; }
105 static OopTaskQueueSet* stack_array() { return _stack_array; }
106
107 static void initialize(ParMarkBitMap* mbm);
108
109 protected:
110 // Array of task queues. Needed by the task terminator.
111 static RegionTaskQueueSet* region_array() { return _region_array; }
112 OverflowTaskQueue<oop, mtGC>* marking_stack() { return &_marking_stack; }
113
114 // Pushes onto the marking stack. If the marking stack is full,
115 // pushes onto the overflow stack.
116 void stack_push(oop obj);
117 // Do not implement an equivalent stack_pop. Deal with the
118 // marking stack and overflow stack directly.
119
120 public:
121 static const size_t InvalidShadow = ~0;
122 static size_t pop_shadow_region_mt_safe(PSParallelCompact::RegionData* region_ptr);
123 static void push_shadow_region_mt_safe(size_t shadow_region);
124 static void push_shadow_region(size_t shadow_region);
125 static void remove_all_shadow_regions();
126
127 inline size_t next_shadow_region() { return _next_shadow_region; }
128 inline void set_next_shadow_region(size_t record) { _next_shadow_region = record; }
129 inline size_t move_next_shadow_region_by(size_t workers) {
130 _next_shadow_region += workers;
131 return next_shadow_region();
|
44 friend class UpdateAndFillClosure;
45 friend class RefProcTaskExecutor;
46 friend class PCRefProcTask;
47 friend class MarkFromRootsTask;
48 friend class UpdateDensePrefixAndCompactionTask;
49
50 public:
51
52 // ------------------------ Don't putback if not needed
53 // Actions that the compaction manager should take.
54 enum Action {
55 Update,
56 Copy,
57 UpdateAndCopy,
58 CopyAndUpdate,
59 NotValid
60 };
61 // ------------------------ End don't putback if not needed
62
63 private:
64 typedef GenericTaskQueue<oop, mtGC> OopTaskQueue;
65 typedef GenericTaskQueueSet<OopTaskQueue, mtGC> OopTaskQueueSet;
66
67 // 32-bit: 4K * 8 = 32KiB; 64-bit: 8K * 16 = 128KiB
68 #define QUEUE_SIZE (1 << NOT_LP64(12) LP64_ONLY(13))
69 typedef OverflowTaskQueue<ObjArrayTask, mtGC, QUEUE_SIZE> ObjArrayTaskQueue;
70 typedef GenericTaskQueueSet<ObjArrayTaskQueue, mtGC> ObjArrayTaskQueueSet;
71 #undef QUEUE_SIZE
72 typedef OverflowTaskQueue<size_t, mtGC> RegionTaskQueue;
73 typedef GenericTaskQueueSet<RegionTaskQueue, mtGC> RegionTaskQueueSet;
74
75 static ParCompactionManager** _manager_array;
76 static OopTaskQueueSet* _oop_task_queues;
77 static ObjArrayTaskQueueSet* _objarray_task_queues;
78 static ObjectStartArray* _start_array;
79 static RegionTaskQueueSet* _region_task_queues;
80 static PSOldGen* _old_gen;
81
82 private:
83 OverflowTaskQueue<oop, mtGC> _marking_stack;
84 ObjArrayTaskQueue _objarray_stack;
85 size_t _next_shadow_region;
86
87 // Is there a way to reuse the _marking_stack for the
88 // saving empty regions? For now just create a different
89 // type of TaskQueue.
90 RegionTaskQueue _region_stack;
91
92 static ParMarkBitMap* _mark_bitmap;
93
94 // Contains currently free shadow regions. We use it in
95 // a LIFO fashion for better data locality and utilization.
96 static GrowableArray<size_t>* _shadow_region_array;
97
98 // Provides mutual exclusive access of _shadow_region_array.
99 // See pop/push_shadow_region_mt_safe() below
100 static Monitor* _shadow_region_monitor;
101
102 Action _action;
103
104 HeapWord* _last_query_beg;
105 oop _last_query_obj;
106 size_t _last_query_ret;
107
108 static PSOldGen* old_gen() { return _old_gen; }
109 static ObjectStartArray* start_array() { return _start_array; }
110 static OopTaskQueueSet* oop_task_queues() { return _oop_task_queues; }
111
112 static void initialize(ParMarkBitMap* mbm);
113
114 protected:
115 // Array of task queues. Needed by the task terminator.
116 static RegionTaskQueueSet* region_task_queues() { return _region_task_queues; }
117 OverflowTaskQueue<oop, mtGC>* marking_stack() { return &_marking_stack; }
118
119 // Pushes onto the marking stack. If the marking stack is full,
120 // pushes onto the overflow stack.
121 void stack_push(oop obj);
122 // Do not implement an equivalent stack_pop. Deal with the
123 // marking stack and overflow stack directly.
124
125 public:
126 static const size_t InvalidShadow = ~0;
127 static size_t pop_shadow_region_mt_safe(PSParallelCompact::RegionData* region_ptr);
128 static void push_shadow_region_mt_safe(size_t shadow_region);
129 static void push_shadow_region(size_t shadow_region);
130 static void remove_all_shadow_regions();
131
132 inline size_t next_shadow_region() { return _next_shadow_region; }
133 inline void set_next_shadow_region(size_t record) { _next_shadow_region = record; }
134 inline size_t move_next_shadow_region_by(size_t workers) {
135 _next_shadow_region += workers;
136 return next_shadow_region();
|