@@ -113,7 +113,19 @@ ParCompactionManager::gc_thread_compaction_manager(uint index) {
113113 return _manager_array[index];
114114}
115115
116- bool ParCompactionManager::transfer_from_overflow_stack (ObjArrayTask& task) {
116+ inline void ParCompactionManager::publish_and_drain_oop_tasks () {
117+ oop obj;
118+ while (marking_stack ()->pop_overflow (obj)) {
119+ if (!marking_stack ()->try_push_to_taskqueue (obj)) {
120+ follow_contents (obj);
121+ }
122+ }
123+ while (marking_stack ()->pop_local (obj)) {
124+ follow_contents (obj);
125+ }
126+ }
127+
128+ bool ParCompactionManager::publish_or_pop_objarray_tasks (ObjArrayTask& task) {
117129 while (_objarray_stack.pop_overflow (task)) {
118130 if (!_objarray_stack.try_push_to_taskqueue (task)) {
119131 return true ;
@@ -126,19 +138,12 @@ void ParCompactionManager::follow_marking_stacks() {
126138 do {
127139 // First, try to move tasks from the overflow stack into the shared buffer, so
128140 // that other threads can steal. Otherwise process the overflow stack first.
129- oop obj;
130- while (marking_stack ()->pop_overflow (obj)) {
131- if (!marking_stack ()->try_push_to_taskqueue (obj)) {
132- follow_contents (obj);
133- }
134- }
135- while (marking_stack ()->pop_local (obj)) {
136- follow_contents (obj);
137- }
141+ publish_and_drain_oop_tasks ();
138142
139143 // Process ObjArrays one at a time to avoid marking stack bloat.
140144 ObjArrayTask task;
141- if (transfer_from_overflow_stack (task) || _objarray_stack.pop_local (task)) {
145+ if (publish_or_pop_objarray_tasks (task) ||
146+ _objarray_stack.pop_local (task)) {
142147 follow_array ((objArrayOop)task.obj (), task.index ());
143148 }
144149 } while (!marking_stacks_empty ());
0 commit comments