< prev index next >

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

Print this page

172   static inline bool is_at_shenandoah_safepoint() {
173     if (!SafepointSynchronize::is_at_safepoint()) return false;
174 
175     Thread* const thr = Thread::current();
176     // Shenandoah GC specific safepoints are scheduled by control thread.
177     // So if we are enter here from control thread, then we are definitely not
178     // at Shenandoah safepoint, but at something else.
179     if (thr == ShenandoahHeap::heap()->control_thread()) return false;
180 
181     // This is not VM thread, cannot see what VM thread is doing,
182     // so pretend this is a proper Shenandoah safepoint
183     if (!thr->is_VM_thread()) return true;
184 
185     // Otherwise check we are at proper operation type
186     VM_Operation* vm_op = VMThread::vm_operation();
187     if (vm_op == nullptr) return false;
188 
189     VM_Operation::VMOp_Type type = vm_op->type();
190     return type == VM_Operation::VMOp_ShenandoahInitMark ||
191            type == VM_Operation::VMOp_ShenandoahFinalMarkStartEvac ||

192            type == VM_Operation::VMOp_ShenandoahInitUpdateRefs ||
193            type == VM_Operation::VMOp_ShenandoahFinalUpdateRefs ||
194            type == VM_Operation::VMOp_ShenandoahFinalVerify ||
195            type == VM_Operation::VMOp_ShenandoahFullGC ||
196            type == VM_Operation::VMOp_ShenandoahDegeneratedGC;
197   }
198 };
199 
200 class ShenandoahWorkerSession : public StackObj {
201 protected:
202   ShenandoahWorkerSession(uint worker_id);
203 public:
204   static inline uint worker_id() {
205     return WorkerThread::worker_id();
206   }
207 };
208 
209 class ShenandoahConcurrentWorkerSession : public ShenandoahWorkerSession {
210 private:
211   EventGCPhaseConcurrent _event;

172   static inline bool is_at_shenandoah_safepoint() {
173     if (!SafepointSynchronize::is_at_safepoint()) return false;
174 
175     Thread* const thr = Thread::current();
176     // Shenandoah GC specific safepoints are scheduled by control thread.
177     // So if we are enter here from control thread, then we are definitely not
178     // at Shenandoah safepoint, but at something else.
179     if (thr == ShenandoahHeap::heap()->control_thread()) return false;
180 
181     // This is not VM thread, cannot see what VM thread is doing,
182     // so pretend this is a proper Shenandoah safepoint
183     if (!thr->is_VM_thread()) return true;
184 
185     // Otherwise check we are at proper operation type
186     VM_Operation* vm_op = VMThread::vm_operation();
187     if (vm_op == nullptr) return false;
188 
189     VM_Operation::VMOp_Type type = vm_op->type();
190     return type == VM_Operation::VMOp_ShenandoahInitMark ||
191            type == VM_Operation::VMOp_ShenandoahFinalMarkStartEvac ||
192            type == VM_Operation::VMOp_ShenandoahFinalRoots ||
193            type == VM_Operation::VMOp_ShenandoahInitUpdateRefs ||
194            type == VM_Operation::VMOp_ShenandoahFinalUpdateRefs ||
195            type == VM_Operation::VMOp_ShenandoahFinalVerify ||
196            type == VM_Operation::VMOp_ShenandoahFullGC ||
197            type == VM_Operation::VMOp_ShenandoahDegeneratedGC;
198   }
199 };
200 
201 class ShenandoahWorkerSession : public StackObj {
202 protected:
203   ShenandoahWorkerSession(uint worker_id);
204 public:
205   static inline uint worker_id() {
206     return WorkerThread::worker_id();
207   }
208 };
209 
210 class ShenandoahConcurrentWorkerSession : public ShenandoahWorkerSession {
211 private:
212   EventGCPhaseConcurrent _event;
< prev index next >