5#ifndef RUNTIME_VM_HEAP_SAFEPOINT_H_
6#define RUNTIME_VM_HEAP_SAFEPOINT_H_
74 bool current_growth_controller_state_;
106 const Thread* current_thread)
const;
110 if (handlers_[
level]->SafepointInProgress()) {
121 : isolate_group_(isolate_group), level_(
level) {}
123 bool SafepointInProgress()
const {
124 ASSERT(threads_lock()->IsOwnedByCurrentThread());
125 ASSERT((operation_count_ > 0) == (owner_ !=
nullptr));
126 return ((operation_count_ > 0) && (owner_ !=
nullptr));
128 void SetSafepointInProgress(Thread*
T) {
129 ASSERT(threads_lock()->IsOwnedByCurrentThread());
130 ASSERT(owner_ ==
nullptr);
131 ASSERT(operation_count_ == 0);
132 operation_count_ = 1;
135 void ResetSafepointInProgress(Thread*
T) {
136 ASSERT(threads_lock()->IsOwnedByCurrentThread());
138 ASSERT(operation_count_ == 1);
139 ASSERT(num_threads_not_parked_ == 0);
140 operation_count_ = 0;
143 void NotifyWeAreParked(Thread*
T);
145 IsolateGroup* isolate_group()
const {
return isolate_group_; }
146 Monitor* threads_lock()
const {
147 return isolate_group_->thread_registry()->threads_lock();
154 void NotifyThreadsToGetToSafepointLevel(
156 MallocGrowableArray<Dart_Port>* oob_isolates);
157 void WaitUntilThreadsReachedSafepointLevel();
160 void NotifyThreadsToContinue(Thread*
T);
167 Monitor parked_lock_;
172 std::atomic<Thread*> owner_ =
nullptr;
175 std::atomic<int32_t> operation_count_ = 0;
179 int32_t num_threads_not_parked_ = 0;
196 IsolateGroup* isolate_group()
const {
return isolate_group_; }
197 Monitor* threads_lock()
const {
282 if (
T->IsSafepointRequested()) {
283 T->BlockForSafepoint();
330 ASSERT(
T->CanAcquireSafepointLocks());
388 if (
thread()->IsSafepointRequested()) {
406 if (
T->no_callback_scope_depth() == 0) {
416 if (
thread()->no_callback_scope_depth() == 0) {
455 uint32_t execution_state_;
489 uint32_t execution_state_;
520 uint32_t execution_state_;
~DeoptSafepointOperationScope()
DeoptSafepointOperationScope(Thread *T)
ForceGrowthSafepointOperationScope(Thread *T, SafepointLevel level)
~ForceGrowthSafepointOperationScope()
~GcSafepointOperationScope()
GcSafepointOperationScope(Thread *T)
ThreadRegistry * thread_registry() const
SafepointHandler * safepoint_handler() const
~ReloadSafepointOperationScope()
ReloadSafepointOperationScope(Thread *T)
SafepointLevel InnermostSafepointOperation(const Thread *current_thread) const
bool AnySafepointInProgressLocked()
SafepointHandler(IsolateGroup *I)
void EnterSafepointUsingLock(Thread *T)
void BlockForSafepoint(Thread *T)
friend class IsolateGroup
void ExitSafepointUsingLock(Thread *T)
~SafepointOperationScope()
SafepointOperationScope(Thread *T, SafepointLevel level)
Monitor * threads_lock() const
Isolate * isolate() const
void set_execution_state(ExecutionState state)
static Thread * Current()
Isolate * isolate() const
TransitionGeneratedToNative(Thread *T)
~TransitionGeneratedToNative()
TransitionGeneratedToVM(Thread *T)
~TransitionGeneratedToVM()
TransitionNativeToVM(Thread *T)
SafepointHandler * handler() const
TransitionSafepointState(Thread *T)
~TransitionSafepointState()
TransitionToGenerated(Thread *T)
TransitionToNative(Thread *T)
TransitionToVM(Thread *T)
TransitionVMToBlocked(Thread *T)
~TransitionVMToGenerated()
TransitionVMToGenerated(Thread *T)
TransitionVMToNative(Thread *T)