< prev index next >

src/hotspot/share/gc/shenandoah/shenandoahUtils.hpp

Print this page

206   static inline bool is_at_shenandoah_safepoint() {
207     if (!SafepointSynchronize::is_at_safepoint()) return false;
208 
209     Thread* const thr = Thread::current();
210     // Shenandoah GC specific safepoints are scheduled by control thread.
211     // So if we are enter here from control thread, then we are definitely not
212     // at Shenandoah safepoint, but at something else.
213     if (thr == ShenandoahHeap::heap()->control_thread()) return false;
214 
215     // This is not VM thread, cannot see what VM thread is doing,
216     // so pretend this is a proper Shenandoah safepoint
217     if (!thr->is_VM_thread()) return true;
218 
219     // Otherwise check we are at proper operation type
220     VM_Operation* vm_op = VMThread::vm_operation();
221     if (vm_op == nullptr) return false;
222 
223     VM_Operation::VMOp_Type type = vm_op->type();
224     return type == VM_Operation::VMOp_ShenandoahInitMark ||
225            type == VM_Operation::VMOp_ShenandoahFinalMarkStartEvac ||

226            type == VM_Operation::VMOp_ShenandoahInitUpdateRefs ||
227            type == VM_Operation::VMOp_ShenandoahFinalUpdateRefs ||
228            type == VM_Operation::VMOp_ShenandoahFinalVerify ||
229            type == VM_Operation::VMOp_ShenandoahFullGC ||
230            type == VM_Operation::VMOp_ShenandoahDegeneratedGC;
231   }
232 };
233 
234 class ShenandoahWorkerSession : public StackObj {
235 protected:
236   ShenandoahWorkerSession(uint worker_id);
237 public:
238   static inline uint worker_id() {
239     return WorkerThread::worker_id();
240   }
241 };
242 
243 class ShenandoahConcurrentWorkerSession : public ShenandoahWorkerSession {
244 private:
245   EventGCPhaseConcurrent _event;

206   static inline bool is_at_shenandoah_safepoint() {
207     if (!SafepointSynchronize::is_at_safepoint()) return false;
208 
209     Thread* const thr = Thread::current();
210     // Shenandoah GC specific safepoints are scheduled by control thread.
211     // So if we are enter here from control thread, then we are definitely not
212     // at Shenandoah safepoint, but at something else.
213     if (thr == ShenandoahHeap::heap()->control_thread()) return false;
214 
215     // This is not VM thread, cannot see what VM thread is doing,
216     // so pretend this is a proper Shenandoah safepoint
217     if (!thr->is_VM_thread()) return true;
218 
219     // Otherwise check we are at proper operation type
220     VM_Operation* vm_op = VMThread::vm_operation();
221     if (vm_op == nullptr) return false;
222 
223     VM_Operation::VMOp_Type type = vm_op->type();
224     return type == VM_Operation::VMOp_ShenandoahInitMark ||
225            type == VM_Operation::VMOp_ShenandoahFinalMarkStartEvac ||
226            type == VM_Operation::VMOp_ShenandoahFinalRoots ||
227            type == VM_Operation::VMOp_ShenandoahInitUpdateRefs ||
228            type == VM_Operation::VMOp_ShenandoahFinalUpdateRefs ||
229            type == VM_Operation::VMOp_ShenandoahFinalVerify ||
230            type == VM_Operation::VMOp_ShenandoahFullGC ||
231            type == VM_Operation::VMOp_ShenandoahDegeneratedGC;
232   }
233 };
234 
235 class ShenandoahWorkerSession : public StackObj {
236 protected:
237   ShenandoahWorkerSession(uint worker_id);
238 public:
239   static inline uint worker_id() {
240     return WorkerThread::worker_id();
241   }
242 };
243 
244 class ShenandoahConcurrentWorkerSession : public ShenandoahWorkerSession {
245 private:
246   EventGCPhaseConcurrent _event;
< prev index next >