159 inline bool G1ParScanThreadState::should_end_trim_queue_partially() const {
160 return _refs->overflow_empty() && _refs->size() <= _stack_drain_lower_threshold;
161 }
162
163 inline void G1ParScanThreadState::trim_queue_partially_internal() {
164 StarTask ref;
165 do {
166 // Drain the overflow stack first, so other threads can potentially steal.
167 while (_refs->pop_overflow(ref)) {
168 if (!_refs->try_push_to_taskqueue(ref)) {
169 dispatch_reference(ref);
170 }
171 }
172
173 while (_refs->pop_local(ref, _stack_drain_lower_threshold)) {
174 dispatch_reference(ref);
175 }
176 } while (!should_end_trim_queue_partially());
177 }
178
179 inline Tickspan G1ParScanThreadState::trim_queue_partially() {
180 Tickspan result;
181 if (should_start_trim_queue_partially()) {
182 const Ticks start = Ticks::now();
183 trim_queue_partially_internal();
184 result = Ticks::now() - start;
185 }
186 return result;
187 }
188
189 #endif // SHARE_VM_GC_G1_G1PARSCANTHREADSTATE_INLINE_HPP
|
159 inline bool G1ParScanThreadState::should_end_trim_queue_partially() const {
160 return _refs->overflow_empty() && _refs->size() <= _stack_drain_lower_threshold;
161 }
162
163 inline void G1ParScanThreadState::trim_queue_partially_internal() {
164 StarTask ref;
165 do {
166 // Drain the overflow stack first, so other threads can potentially steal.
167 while (_refs->pop_overflow(ref)) {
168 if (!_refs->try_push_to_taskqueue(ref)) {
169 dispatch_reference(ref);
170 }
171 }
172
173 while (_refs->pop_local(ref, _stack_drain_lower_threshold)) {
174 dispatch_reference(ref);
175 }
176 } while (!should_end_trim_queue_partially());
177 }
178
179 inline void G1ParScanThreadState::trim_queue_partially() {
180 if (should_start_trim_queue_partially()) {
181 const Ticks start = Ticks::now();
182 trim_queue_partially_internal();
183 _trim_ticks += Ticks::now() - start;
184 }
185 }
186
187 inline Tickspan G1ParScanThreadState::trim_ticks_and_reset() {
188 Tickspan result = _trim_ticks;
189 _trim_ticks = Tickspan();
190 return result;
191 }
192
193 #endif // SHARE_VM_GC_G1_G1PARSCANTHREADSTATE_INLINE_HPP
|