Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Static Public Member Functions | Friends | List of all members
dart::Thread Class Reference

#include <thread.h>

Inheritance diagram for dart::Thread:
dart::ThreadState dart::BaseThread

Public Types

enum  TaskKind {
  kUnknownTask = 0x0 , kMutatorTask = 0x1 , kCompilerTask = 0x2 , kMarkerTask = 0x4 ,
  kSweeperTask = 0x8 , kCompactorTask = 0x10 , kScavengerTask = 0x20 , kSampleBlockTask = 0x40
}
 
enum  { kOsrRequest = 0x1 }
 
enum  { kDidNotExit = 0 , kExitThroughFfi = 1 , kExitThroughRuntimeCall = 2 }
 
enum  { kVMInterrupt = 0x1 , kMessageInterrupt = 0x2 , kInterruptsMask = (kVMInterrupt | kMessageInterrupt) }
 
enum  ExecutionState { kThreadInVM = 0 , kThreadInGenerated , kThreadInNative , kThreadInBlockedState }
 

Public Member Functions

 ~Thread ()
 
bool HasActiveState ()
 
void AssertNonMutatorInvariants ()
 
void AssertNonDartMutatorInvariants ()
 
void AssertEmptyStackInvariants ()
 
void AssertEmptyThreadInvariants ()
 
void ReleaseStoreBuffer ()
 
void AcquireMarkingStack ()
 
void ReleaseMarkingStack ()
 
void SetStackLimit (uword value)
 
void ClearStackLimit ()
 
uword stack_limit_address () const
 
uword saved_stack_limit () const
 
uword saved_shadow_call_stack () const
 
uword write_barrier_mask () const
 
uword heap_base () const
 
int32_t IncrementAndGetStackOverflowCount ()
 
uint32_t IncrementAndGetRuntimeCallCount ()
 
TaskKind task_kind () const
 
uword GetAndClearStackOverflowFlags ()
 
void ScheduleInterrupts (uword interrupt_bits)
 
ErrorPtr HandleInterrupts ()
 
uword GetAndClearInterrupts ()
 
bool HasScheduledInterrupts () const
 
Monitorthread_lock () const
 
ApiLocalScopeapi_reusable_scope () const
 
void set_api_reusable_scope (ApiLocalScope *value)
 
ApiLocalScopeapi_top_scope () const
 
void set_api_top_scope (ApiLocalScope *value)
 
void EnterApiScope ()
 
void ExitApiScope ()
 
Isolateisolate () const
 
IsolateGroupisolate_group () const
 
bool IsDartMutatorThread () const
 
Isolatescheduled_dart_mutator_isolate () const
 
bool IsExecutingDartCode () const
 
bool HasExitedDartCode () const
 
bool HasCompilerState () const
 
CompilerStatecompiler_state ()
 
HierarchyInfohierarchy_info () const
 
void set_hierarchy_info (HierarchyInfo *value)
 
TypeUsageInfotype_usage_info () const
 
void set_type_usage_info (TypeUsageInfo *value)
 
CompilerTimingscompiler_timings () const
 
void set_compiler_timings (CompilerTimings *stats)
 
int32_t no_callback_scope_depth () const
 
void IncrementNoCallbackScopeDepth ()
 
void DecrementNoCallbackScopeDepth ()
 
bool force_growth () const
 
void IncrementForceGrowthScopeDepth ()
 
void DecrementForceGrowthScopeDepth ()
 
bool is_unwind_in_progress () const
 
void StartUnwindError ()
 
void StoreBufferAddObject (ObjectPtr obj)
 
void StoreBufferAddObjectGC (ObjectPtr obj)
 
void StoreBufferBlockProcess (StoreBuffer::ThresholdPolicy policy)
 
bool is_marking () const
 
void MarkingStackAddObject (ObjectPtr obj)
 
void DeferredMarkingStackAddObject (ObjectPtr obj)
 
void MarkingStackBlockProcess ()
 
void DeferredMarkingStackBlockProcess ()
 
uword top_exit_frame_info () const
 
void set_top_exit_frame_info (uword top_exit_frame_info)
 
Heapheap () const
 
uword top () const
 
uword end () const
 
uword true_end () const
 
void set_top (uword top)
 
void set_end (uword end)
 
void set_true_end (uword true_end)
 
int32_t no_safepoint_scope_depth () const
 
void IncrementNoSafepointScopeDepth ()
 
void DecrementNoSafepointScopeDepth ()
 
bool IsInNoReloadScope () const
 
bool IsInStoppedMutatorsScope () const
 
ObjectPoolPtr global_object_pool () const
 
void set_global_object_pool (ObjectPoolPtr raw_value)
 
const uworddispatch_table_array () const
 
void set_dispatch_table_array (const uword *array)
 
uword vm_tag () const
 
void set_vm_tag (uword tag)
 
int64_t unboxed_int64_runtime_arg () const
 
void set_unboxed_int64_runtime_arg (int64_t value)
 
int64_t unboxed_int64_runtime_second_arg () const
 
void set_unboxed_int64_runtime_second_arg (int64_t value)
 
double unboxed_double_runtime_arg () const
 
void set_unboxed_double_runtime_arg (double value)
 
simd128_value_t unboxed_simd128_runtime_arg () const
 
void set_unboxed_simd128_runtime_arg (simd128_value_t value)
 
ObjectPtr active_exception () const
 
void set_active_exception (const Object &value)
 
ObjectPtr active_stacktrace () const
 
void set_active_stacktrace (const Object &value)
 
uword resume_pc () const
 
void set_resume_pc (uword value)
 
ErrorPtr sticky_error () const
 
void set_sticky_error (const Error &value)
 
void ClearStickyError ()
 
DART_WARN_UNUSED_RESULT ErrorPtr StealStickyError ()
 
void ClearReusableHandles ()
 
bool IsAtSafepoint () const
 
bool IsAtSafepoint (SafepointLevel level) const
 
void SetAtSafepoint (bool value, SafepointLevel level)
 
bool IsSafepointRequestedLocked (SafepointLevel level) const
 
bool IsSafepointRequested () const
 
bool IsSafepointRequested (SafepointLevel level) const
 
bool IsSafepointLevelRequestedLocked (SafepointLevel level) const
 
void BlockForSafepoint ()
 
uword SetSafepointRequested (SafepointLevel level, bool value)
 
bool IsBlockedForSafepoint () const
 
void SetBlockedForSafepoint (bool value)
 
bool BypassSafepoints () const
 
bool UnwindErrorInProgress () const
 
void SetUnwindErrorInProgress (bool value)
 
bool OwnsGCSafepoint () const
 
bool OwnsReloadSafepoint () const
 
bool OwnsDeoptSafepoint () const
 
bool OwnsSafepoint () const
 
bool CanAcquireSafepointLocks () const
 
uword safepoint_state ()
 
ExecutionState execution_state () const
 
NO_SANITIZE_THREAD ExecutionState execution_state_cross_thread_for_testing () const
 
void set_execution_state (ExecutionState state)
 
virtual bool MayAllocateHandles ()
 
bool TryEnterSafepoint ()
 
void EnterSafepoint ()
 
bool TryExitSafepoint ()
 
void ExitSafepoint ()
 
void CheckForSafepoint ()
 
Threadnext () const
 
void VisitObjectPointers (ObjectPointerVisitor *visitor, ValidationPolicy validate_frames)
 
void RememberLiveTemporaries ()
 
void DeferredMarkLiveTemporaries ()
 
bool IsValidHandle (Dart_Handle object) const
 
bool IsValidLocalHandle (Dart_Handle object) const
 
intptr_t CountLocalHandles () const
 
int ZoneSizeInBytes () const
 
void UnwindScopes (uword stack_marker)
 
void InitVMConstants ()
 
int64_t GetNextTaskId ()
 
Randomrandom ()
 
void PrintJSON (JSONStream *stream) const
 
HeapProfileSamplerheap_sampler ()
 
PendingDeoptspending_deopts ()
 
SafepointLevel current_safepoint_level () const
 
template<class C >
CAllocateReusableHandle ()
 
- Public Member Functions inherited from dart::ThreadState
 ThreadState (bool is_os_thread)
 
virtual ~ThreadState ()
 
OSThreados_thread () const
 
void set_os_thread (OSThread *os_thread)
 
Zonezone () const
 
bool ZoneIsOwnedByThread (Zone *zone) const
 
StackResourcetop_resource () const
 
void set_top_resource (StackResource *value)
 
LongJumpScopelong_jump_base () const
 
void set_long_jump_base (LongJumpScope *value)
 
bool IsValidZoneHandle (Dart_Handle object) const
 
intptr_t CountZoneHandles () const
 
bool IsValidScopedHandle (Dart_Handle object) const
 
intptr_t CountScopedHandles () const
 
HandleScopetop_handle_scope () const
 
void set_top_handle_scope (HandleScope *handle_scope)
 
- Public Member Functions inherited from dart::BaseThread
bool is_os_thread () const
 

Static Public Member Functions

static const char * TaskKindToCString (TaskKind kind)
 
static ThreadCurrent ()
 
static void EnterIsolate (Isolate *isolate)
 
static void ExitIsolate (bool isolate_shutdown=false)
 
static bool EnterIsolateGroupAsHelper (IsolateGroup *isolate_group, TaskKind kind, bool bypass_safepoint)
 
static void ExitIsolateGroupAsHelper (bool bypass_safepoint)
 
static bool EnterIsolateGroupAsNonMutator (IsolateGroup *isolate_group, TaskKind kind)
 
static void ExitIsolateGroupAsNonMutator ()
 
static intptr_t stack_limit_offset ()
 
static intptr_t saved_stack_limit_offset ()
 
static uword saved_shadow_call_stack_offset ()
 
static intptr_t write_barrier_mask_offset ()
 
static intptr_t stack_overflow_flags_offset ()
 
static uword stack_overflow_shared_stub_entry_point_offset (bool fpu_regs)
 
static intptr_t safepoint_state_offset ()
 
static intptr_t exit_through_ffi_offset ()
 
static intptr_t api_top_scope_offset ()
 
static intptr_t double_truncate_round_supported_offset ()
 
static intptr_t tsan_utils_offset ()
 
static intptr_t isolate_offset ()
 
static intptr_t isolate_group_offset ()
 
static intptr_t field_table_values_offset ()
 
static intptr_t dart_stream_offset ()
 
static intptr_t service_extension_stream_offset ()
 
static intptr_t store_buffer_block_offset ()
 
static intptr_t marking_stack_block_offset ()
 
static intptr_t top_exit_frame_info_offset ()
 
static intptr_t top_offset ()
 
static intptr_t end_offset ()
 
static intptr_t write_barrier_wrappers_thread_offset (Register reg)
 
static intptr_t WriteBarrierWrappersOffsetForRegister (Register reg)
 
static bool CanLoadFromThread (const Object &object)
 
static intptr_t OffsetFromThread (const Object &object)
 
static bool ObjectAtOffset (intptr_t offset, Object *object)
 
static intptr_t OffsetFromThread (const RuntimeEntry *runtime_entry)
 
static intptr_t vm_tag_offset ()
 
static intptr_t unboxed_runtime_arg_offset ()
 
static intptr_t global_object_pool_offset ()
 
static intptr_t dispatch_table_array_offset ()
 
static intptr_t active_exception_offset ()
 
static intptr_t active_stacktrace_offset ()
 
static uword resume_pc_offset ()
 
static bool IsAtSafepoint (SafepointLevel level, uword state)
 
static bool IsSafepointLevelRequested (uword state, SafepointLevel level)
 
static bool IsBlockedForSafepoint (uword state)
 
static uword SetBypassSafepoints (bool value, uword state)
 
static intptr_t execution_state_offset ()
 
static uword full_safepoint_state_unacquired ()
 
static uword full_safepoint_state_acquired ()
 
static intptr_t next_task_id_offset ()
 
static intptr_t random_offset ()
 
- Static Public Member Functions inherited from dart::ThreadState
static ThreadStateCurrent ()
 
static intptr_t top_resource_offset ()
 

Friends

class RestoreWriteBarrierInvariantVisitor
 
class ApiZone
 
class ActiveIsolateScope
 
class InterruptChecker
 
class Isolate
 
class IsolateGroup
 
class NoActiveIsolateScope
 
class NoReloadScope
 
class RawReloadParticipationScope
 
class Simulator
 
class StackZone
 
class StoppedMutatorsScope
 
class ThreadRegistry
 
class CompilerState
 
class compiler::target::Thread
 
class FieldTable
 
class RuntimeCallDeoptScope
 
class Dart
 
class TransitionGeneratedToVM
 
class TransitionVMToGenerated
 
class MonitorLocker
 
IsolateCreateWithinExistingIsolateGroup (IsolateGroup *, const char *, char **)
 

Detailed Description

Definition at line 342 of file thread.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
kOsrRequest 

Definition at line 423 of file thread.h.

423 {
424 kOsrRequest = 0x1, // Current stack overflow caused by OSR request.
425 };

◆ anonymous enum

anonymous enum
Enumerator
kDidNotExit 
kExitThroughFfi 
kExitThroughRuntimeCall 

Definition at line 463 of file thread.h.

463 {
464 // Always true in generated state.
465 kDidNotExit = 0,
466 // The VM exited the generated state through FFI.
467 // This can be true in both native and VM state.
468 kExitThroughFfi = 1,
469 // The VM exited the generated state through a runtime call.
470 // This can be true in both native and VM state.
472 };
@ kExitThroughRuntimeCall
Definition thread.h:471
@ kExitThroughFfi
Definition thread.h:468

◆ anonymous enum

anonymous enum
Enumerator
kVMInterrupt 
kMessageInterrupt 
kInterruptsMask 

Definition at line 486 of file thread.h.

486 {
487 kVMInterrupt = 0x1, // Internal VM checks: safepoints, store buffers, etc.
488 kMessageInterrupt = 0x2, // An interrupt to process an out of band message.
489
491 };
@ kMessageInterrupt
Definition thread.h:488
@ kInterruptsMask
Definition thread.h:490

◆ ExecutionState

Enumerator
kThreadInVM 
kThreadInGenerated 
kThreadInNative 
kThreadInBlockedState 

Definition at line 1020 of file thread.h.

1020 {
1021 kThreadInVM = 0,
1025 };
@ kThreadInNative
Definition thread.h:1023
@ kThreadInBlockedState
Definition thread.h:1024
@ kThreadInGenerated
Definition thread.h:1022

◆ TaskKind

Enumerator
kUnknownTask 
kMutatorTask 
kCompilerTask 
kMarkerTask 
kSweeperTask 
kCompactorTask 
kScavengerTask 
kSampleBlockTask 

Definition at line 345 of file thread.h.

345 {
346 kUnknownTask = 0x0,
347 kMutatorTask = 0x1,
348 kCompilerTask = 0x2,
349 kMarkerTask = 0x4,
350 kSweeperTask = 0x8,
351 kCompactorTask = 0x10,
352 kScavengerTask = 0x20,
353 kSampleBlockTask = 0x40,
354 };
@ kCompilerTask
Definition thread.h:348
@ kScavengerTask
Definition thread.h:352
@ kSampleBlockTask
Definition thread.h:353
@ kCompactorTask
Definition thread.h:351

Constructor & Destructor Documentation

◆ ~Thread()

dart::Thread::~Thread ( )

Definition at line 37 of file thread.cc.

37 {
38 // We should cleanly exit any isolate before destruction.
39 ASSERT(isolate_ == nullptr);
40 ASSERT(store_buffer_block_ == nullptr);
41 ASSERT(marking_stack_block_ == nullptr);
42 // There should be no top api scopes at this point.
43 ASSERT(api_top_scope() == nullptr);
44 // Delete the reusable api scope if there is one.
45 if (api_reusable_scope_ != nullptr) {
46 delete api_reusable_scope_;
47 api_reusable_scope_ = nullptr;
48 }
49
50 DO_IF_TSAN(delete tsan_utils_);
51}
ApiLocalScope * api_top_scope() const
Definition thread.h:512
#define ASSERT(E)
#define DO_IF_TSAN(CODE)

Member Function Documentation

◆ AcquireMarkingStack()

void dart::Thread::AcquireMarkingStack ( )

◆ active_exception()

ObjectPtr dart::Thread::active_exception ( ) const
inline

Definition at line 848 of file thread.h.

848{ return active_exception_; }

◆ active_exception_offset()

static intptr_t dart::Thread::active_exception_offset ( )
inlinestatic

Definition at line 850 of file thread.h.

850 {
851 return OFFSET_OF(Thread, active_exception_);
852 }
friend class compiler::target::Thread
Definition thread.h:1464
#define OFFSET_OF(type, field)
Definition globals.h:138

◆ active_stacktrace()

ObjectPtr dart::Thread::active_stacktrace ( ) const
inline

Definition at line 854 of file thread.h.

854{ return active_stacktrace_; }

◆ active_stacktrace_offset()

static intptr_t dart::Thread::active_stacktrace_offset ( )
inlinestatic

Definition at line 856 of file thread.h.

856 {
857 return OFFSET_OF(Thread, active_stacktrace_);
858 }

◆ AllocateReusableHandle()

template<class C >
C * dart::Thread::AllocateReusableHandle ( )

Definition at line 889 of file thread.cc.

889 {
890 C* handle = reinterpret_cast<C*>(reusable_handles_.AllocateScopedHandle());
891 C::initializeHandle(handle, C::null());
892 return handle;
893}
uword AllocateScopedHandle()
Definition handles.h:96

◆ api_reusable_scope()

ApiLocalScope * dart::Thread::api_reusable_scope ( ) const
inline

Definition at line 504 of file thread.h.

504{ return api_reusable_scope_; }

◆ api_top_scope()

ApiLocalScope * dart::Thread::api_top_scope ( ) const
inline

Definition at line 512 of file thread.h.

512{ return api_top_scope_; }

◆ api_top_scope_offset()

static intptr_t dart::Thread::api_top_scope_offset ( )
inlinestatic

Definition at line 514 of file thread.h.

514 {
515 return OFFSET_OF(Thread, api_top_scope_);
516 }

◆ AssertEmptyStackInvariants()

void dart::Thread::AssertEmptyStackInvariants ( )

Definition at line 284 of file thread.cc.

284 {
285 ASSERT(zone() == nullptr);
286 ASSERT(top_handle_scope() == nullptr);
287 ASSERT(long_jump_base() == nullptr);
288 ASSERT(top_resource() == nullptr);
289 ASSERT(top_exit_frame_info_ == 0);
290 ASSERT(api_top_scope_ == nullptr);
291 ASSERT(!pending_deopts_.HasPendingDeopts());
292 ASSERT(compiler_state_ == nullptr);
293 ASSERT(hierarchy_info_ == nullptr);
294 ASSERT(type_usage_info_ == nullptr);
295 ASSERT(no_active_isolate_scope_ == nullptr);
296 ASSERT(compiler_timings_ == nullptr);
297 ASSERT(!exit_through_ffi_);
298 ASSERT(runtime_call_deopt_ability_ == RuntimeCallDeoptAbility::kCanLazyDeopt);
299 ASSERT(no_callback_scope_depth_ == 0);
300 ASSERT(force_growth_scope_depth_ == 0);
301 ASSERT(no_reload_scope_depth_ == 0);
302 ASSERT(stopped_mutators_scope_depth_ == 0);
303 ASSERT(stack_overflow_flags_ == 0);
304 DEBUG_ASSERT(!inside_compiler_);
305 DEBUG_ASSERT(no_safepoint_scope_depth_ == 0);
306
307 // Avoid running these asserts for `vm-isolate`.
308 if (active_stacktrace_.untag() != 0) {
310 ASSERT(active_exception_ == Object::null());
311 ASSERT(active_stacktrace_ == Object::null());
312 }
313}
#define DEBUG_ASSERT(cond)
Definition assert.h:321
UntaggedObject * untag() const
static ObjectPtr null()
Definition object.h:433
Zone * zone() const
HandleScope * top_handle_scope() const
LongJumpScope * long_jump_base() const
StackResource * top_resource() const
ErrorPtr sticky_error() const
Definition thread.cc:230

◆ AssertEmptyThreadInvariants()

void dart::Thread::AssertEmptyThreadInvariants ( )

Definition at line 315 of file thread.cc.

315 {
317
318 ASSERT(top_ == 0);
319 ASSERT(end_ == 0);
320 ASSERT(true_end_ == 0);
321 ASSERT(isolate_ == nullptr);
322 ASSERT(isolate_group_ == nullptr);
323 ASSERT(os_thread() == nullptr);
324 ASSERT(vm_tag_ == VMTag::kInvalidTagId);
325 ASSERT(task_kind_ == kUnknownTask);
326 ASSERT(execution_state_ == Thread::kThreadInNative);
327 ASSERT(scheduled_dart_mutator_isolate_ == nullptr);
328
329 ASSERT(write_barrier_mask_ == UntaggedObject::kGenerationalBarrierMask);
330 ASSERT(store_buffer_block_ == nullptr);
331 ASSERT(marking_stack_block_ == nullptr);
332 ASSERT(deferred_marking_stack_block_ == nullptr);
333 ASSERT(!is_unwind_in_progress_);
334
335 ASSERT(saved_stack_limit_ == OSThread::kInvalidStackLimit);
336 ASSERT(stack_limit_.load() == 0);
337 ASSERT(safepoint_state_ == 0);
338
339 // Avoid running these asserts for `vm-isolate`.
340 if (active_stacktrace_.untag() != 0) {
341 ASSERT(field_table_values_ == nullptr);
342 ASSERT(global_object_pool_ == Object::null());
343#define CHECK_REUSABLE_HANDLE(object) ASSERT(object##_handle_->IsNull());
345#undef CHECK_REUSABLE_HANDLE
346 }
347}
static const uword kInvalidStackLimit
Definition os_thread.h:88
T load(std::memory_order order=std::memory_order_relaxed) const
Definition atomic.h:21
OSThread * os_thread() const
void AssertEmptyStackInvariants()
Definition thread.cc:284
static constexpr intptr_t kGenerationalBarrierMask
Definition raw_object.h:180
@ kInvalidTagId
Definition tags.h:38
#define CHECK_REUSABLE_HANDLE(object)
#define REUSABLE_HANDLE_LIST(V)
Definition thread.h:78

◆ AssertNonDartMutatorInvariants()

void dart::Thread::AssertNonDartMutatorInvariants ( )

Definition at line 276 of file thread.cc.

276 {
278 ASSERT(isolate() == nullptr);
279 ASSERT(isolate_group() != nullptr);
280 ASSERT(task_kind_ != kMutatorTask);
281 DEBUG_ASSERT(!IsAnyReusableHandleScopeActive());
282}
bool IsDartMutatorThread() const
Definition thread.h:546
Isolate * isolate() const
Definition thread.h:533
IsolateGroup * isolate_group() const
Definition thread.h:540

◆ AssertNonMutatorInvariants()

void dart::Thread::AssertNonMutatorInvariants ( )

Definition at line 268 of file thread.cc.

268 {
270 ASSERT(store_buffer_block_ == nullptr);
271 ASSERT(marking_stack_block_ == nullptr);
272 ASSERT(deferred_marking_stack_block_ == nullptr);
274}
void AssertNonDartMutatorInvariants()
Definition thread.cc:276
bool BypassSafepoints() const
Definition thread.h:994

◆ BlockForSafepoint()

void dart::Thread::BlockForSafepoint ( )

Definition at line 1282 of file thread.cc.

1282 {
1284}
SafepointHandler * safepoint_handler()
Definition isolate.h:333
void BlockForSafepoint(Thread *T)
Definition safepoint.cc:324

◆ BypassSafepoints()

bool dart::Thread::BypassSafepoints ( ) const
inline

Definition at line 994 of file thread.h.

994 {
995 return BypassSafepointsField::decode(safepoint_state_);
996 }

◆ CanAcquireSafepointLocks()

bool dart::Thread::CanAcquireSafepointLocks ( ) const

Definition at line 1306 of file thread.cc.

1306 {
1307 // A thread may acquire locks and then enter a safepoint operation (e.g.
1308 // holding program lock, allocating objects which triggers GC).
1309 //
1310 // So if this code is called inside safepoint operation, we generally have to
1311 // assume other threads may hold locks and are blocked on the safepoint,
1312 // meaning we cannot hold safepoint and acquire locks (deadlock!).
1313 //
1314 // Though if we own a reload safepoint operation it means all other mutators
1315 // are blocked in very specific places, where we know no locks are held. As
1316 // such we allow the current thread to acquire locks.
1317 //
1318 // Example: We own reload safepoint operation, load kernel, which allocates
1319 // symbols, where the symbol implementation acquires the symbol lock (we know
1320 // other mutators at reload safepoint do not hold symbol lock).
1323}
SafepointLevel InnermostSafepointOperation(const Thread *current_thread) const
Definition safepoint.cc:291
@ kGCAndDeoptAndReload
Definition thread.h:295

◆ CanLoadFromThread()

bool dart::Thread::CanLoadFromThread ( const Object object)
static

Definition at line 1088 of file thread.cc.

1088 {
1089 // In order to allow us to use assembler helper routines with non-[Code]
1090 // objects *before* stubs are initialized, we only loop ver the stubs if the
1091 // [object] is in fact a [Code] object.
1092 if (object.IsCode()) {
1093#define CHECK_OBJECT(type_name, member_name, expr, default_init_value) \
1094 if (object.ptr() == expr) { \
1095 return true; \
1096 }
1098#undef CHECK_OBJECT
1099 }
1100
1101 // For non [Code] objects we check if the object equals to any of the cached
1102 // non-stub entries.
1103#define CHECK_OBJECT(type_name, member_name, expr, default_init_value) \
1104 if (object.ptr() == expr) { \
1105 return true; \
1106 }
1108#undef CHECK_OBJECT
1109 return false;
1110}
#define CHECK_OBJECT(type_name, member_name, expr, default_init_value)
#define CACHED_NON_VM_STUB_LIST(V)
Definition thread.h:174
#define CACHED_VM_STUBS_LIST(V)
Definition thread.h:100

◆ CheckForSafepoint()

void dart::Thread::CheckForSafepoint ( )
inline

Definition at line 1091 of file thread.h.

1091 {
1092 // If we are in a runtime call that doesn't support lazy deopt, we will only
1093 // respond to gc safepointing requests.
1095 if (IsSafepointRequested()) {
1097 }
1098 }
bool IsSafepointRequested() const
Definition thread.h:924
int32_t no_safepoint_scope_depth() const
Definition thread.h:705
void BlockForSafepoint()
Definition thread.cc:1282

◆ ClearReusableHandles()

void dart::Thread::ClearReusableHandles ( )

Definition at line 895 of file thread.cc.

895 {
896#define CLEAR_REUSABLE_HANDLE(object) *object##_handle_ = object::null();
898#undef CLEAR_REUSABLE_HANDLE
899}
#define CLEAR_REUSABLE_HANDLE(object)

◆ ClearStackLimit()

void dart::Thread::ClearStackLimit ( )

Definition at line 696 of file thread.cc.

696 {
698}
void SetStackLimit(uword value)
Definition thread.cc:685

◆ ClearStickyError()

void dart::Thread::ClearStickyError ( )

Definition at line 239 of file thread.cc.

239 {
240 sticky_error_ = Error::null();
241}

◆ compiler_state()

CompilerState & dart::Thread::compiler_state ( )
inline

Definition at line 583 of file thread.h.

583 {
585 return *compiler_state_;
586 }
bool HasCompilerState() const
Definition thread.h:581

◆ compiler_timings()

CompilerTimings * dart::Thread::compiler_timings ( ) const
inline

Definition at line 612 of file thread.h.

612{ return compiler_timings_; }

◆ CountLocalHandles()

intptr_t dart::Thread::CountLocalHandles ( ) const

Definition at line 1215 of file thread.cc.

1215 {
1216 intptr_t total = 0;
1217 ApiLocalScope* scope = api_top_scope_;
1218 while (scope != nullptr) {
1219 total += scope->local_handles()->CountHandles();
1220 scope = scope->previous();
1221 }
1222 return total;
1223}
LocalHandles * local_handles()
int CountHandles() const

◆ Current()

static Thread * dart::Thread::Current ( )
inlinestatic

Definition at line 361 of file thread.h.

361 {
362 return static_cast<Thread*>(OSThread::CurrentVMThread());
363 }
static ThreadState * CurrentVMThread()
Definition os_thread.h:184

◆ current_safepoint_level()

SafepointLevel dart::Thread::current_safepoint_level ( ) const
inline

Definition at line 1133 of file thread.h.

1133 {
1134 if (runtime_call_deopt_ability_ ==
1136 return SafepointLevel::kGC;
1137 }
1138 if (no_reload_scope_depth_ > 0 || allow_reload_scope_depth_ <= 0) {
1140 }
1142 }
@ kGC
Definition thread.h:291
@ kGCAndDeopt
Definition thread.h:293

◆ dart_stream_offset()

static intptr_t dart::Thread::dart_stream_offset ( )
inlinestatic

Definition at line 566 of file thread.h.

566 {
567 return OFFSET_OF(Thread, dart_stream_);
568 }

◆ DecrementForceGrowthScopeDepth()

void dart::Thread::DecrementForceGrowthScopeDepth ( )
inline

Definition at line 633 of file thread.h.

633 {
634 ASSERT(force_growth_scope_depth_ > 0);
635 force_growth_scope_depth_ -= 1;
636 }

◆ DecrementNoCallbackScopeDepth()

void dart::Thread::DecrementNoCallbackScopeDepth ( )
inline

Definition at line 623 of file thread.h.

623 {
624 ASSERT(no_callback_scope_depth_ > 0);
625 no_callback_scope_depth_ -= 1;
626 }

◆ DecrementNoSafepointScopeDepth()

void dart::Thread::DecrementNoSafepointScopeDepth ( )
inline

Definition at line 720 of file thread.h.

720 {
721#if defined(DEBUG)
722 ASSERT(no_safepoint_scope_depth_ > 0);
723 no_safepoint_scope_depth_ -= 1;
724#endif
725 }

◆ DeferredMarkingStackAddObject()

void dart::Thread::DeferredMarkingStackAddObject ( ObjectPtr  obj)

Definition at line 833 of file thread.cc.

833 {
834 deferred_marking_stack_block_->Push(obj);
835 if (deferred_marking_stack_block_->IsFull()) {
837 }
838}
void Push(ObjectPtr obj)
bool IsFull() const
void DeferredMarkingStackBlockProcess()
Definition thread.cc:821

◆ DeferredMarkingStackBlockProcess()

void dart::Thread::DeferredMarkingStackBlockProcess ( )

Definition at line 821 of file thread.cc.

821 {
822 DeferredMarkingStackRelease();
823 DeferredMarkingStackAcquire();
824}

◆ DeferredMarkLiveTemporaries()

void dart::Thread::DeferredMarkLiveTemporaries ( )

Definition at line 1078 of file thread.cc.

1078 {
1079 RestoreWriteBarrierInvariant(
1080 RestoreWriteBarrierInvariantOp::kAddToDeferredMarkingStack);
1081}

◆ dispatch_table_array()

const uword * dart::Thread::dispatch_table_array ( ) const
inline

Definition at line 784 of file thread.h.

784{ return dispatch_table_array_; }

◆ dispatch_table_array_offset()

static intptr_t dart::Thread::dispatch_table_array_offset ( )
inlinestatic

Definition at line 844 of file thread.h.

844 {
845 return OFFSET_OF(Thread, dispatch_table_array_);
846 }

◆ double_truncate_round_supported_offset()

static intptr_t dart::Thread::double_truncate_round_supported_offset ( )
inlinestatic

Definition at line 521 of file thread.h.

521 {
522 return OFFSET_OF(Thread, double_truncate_round_supported_);
523 }

◆ end()

uword dart::Thread::end ( ) const
inline

Definition at line 697 of file thread.h.

697{ return end_; }

◆ end_offset()

static intptr_t dart::Thread::end_offset ( )
inlinestatic

Definition at line 703 of file thread.h.

703{ return OFFSET_OF(Thread, end_); }

◆ EnterApiScope()

void dart::Thread::EnterApiScope ( )

Definition at line 1235 of file thread.cc.

1235 {
1237 ApiLocalScope* new_scope = api_reusable_scope();
1238 if (new_scope == nullptr) {
1239 new_scope = new ApiLocalScope(api_top_scope(), top_exit_frame_info());
1240 ASSERT(new_scope != nullptr);
1241 } else {
1242 new_scope->Reinit(this, api_top_scope(), top_exit_frame_info());
1243 set_api_reusable_scope(nullptr);
1244 }
1245 set_api_top_scope(new_scope); // New scope is now the top scope.
1246}
ApiLocalScope * api_reusable_scope() const
Definition thread.h:504
void set_api_reusable_scope(ApiLocalScope *value)
Definition thread.h:505
uword top_exit_frame_info() const
Definition thread.h:678
void set_api_top_scope(ApiLocalScope *value)
Definition thread.h:513
virtual bool MayAllocateHandles()
Definition thread.h:1042

◆ EnterIsolate()

void dart::Thread::EnterIsolate ( Isolate isolate)
static

Definition at line 366 of file thread.cc.

366 {
367 const bool is_resumable = isolate->mutator_thread() != nullptr;
368
369 // To let VM's thread pool (if we run on it) know that this thread is
370 // occupying a mutator again (decreases its max size).
371 const bool is_nested_reenter =
372 (is_resumable && isolate->mutator_thread()->top_exit_frame_info() != 0);
373
374 auto group = isolate->group();
375 if (!(is_nested_reenter && isolate->mutator_thread()->OwnsSafepoint())) {
376 group->IncreaseMutatorCount(isolate, is_nested_reenter);
377 }
378
379 // Two threads cannot enter isolate at same time.
381
382 // We lazily create a [Thread] structure for the mutator thread, but we'll
383 // reuse it until the death of the isolate.
384 Thread* thread = nullptr;
385 if (is_resumable) {
386 thread = isolate->mutator_thread();
387 ASSERT(thread->scheduled_dart_mutator_isolate_ == isolate);
388 ASSERT(thread->isolate() == isolate);
389 ASSERT(thread->isolate_group() == isolate->group());
390 {
391 // Descheduled isolates are reloadable (if nothing else prevents it).
392 RawReloadParticipationScope enable_reload(thread);
393 thread->ExitSafepoint();
394 }
395 } else {
396 thread = AddActiveThread(group, isolate, /*is_dart_mutator*/ true,
397 /*bypass_safepoint=*/false);
398 thread->SetupState(kMutatorTask);
399 thread->SetupMutatorState(kMutatorTask);
400 thread->SetupDartMutatorState(isolate);
401 }
402
404 ResumeDartMutatorThreadInternal(thread);
405}
Thread * scheduled_mutator_thread_
IsolateGroup * group() const
Definition isolate.h:990
Thread * mutator_thread() const
Definition isolate.cc:1884
bool OwnsSafepoint() const
Definition thread.cc:1301
friend class RawReloadParticipationScope
Definition thread.h:1458

◆ EnterIsolateGroupAsHelper()

bool dart::Thread::EnterIsolateGroupAsHelper ( IsolateGroup isolate_group,
TaskKind  kind,
bool  bypass_safepoint 
)
static

Definition at line 476 of file thread.cc.

478 {
479 Thread* thread = AddActiveThread(isolate_group, nullptr,
480 /*is_dart_mutator=*/false, bypass_safepoint);
481 if (thread != nullptr) {
482 thread->SetupState(kind);
483 // Even if [bypass_safepoint] is true, a thread may need mutator state (e.g.
484 // parallel scavenger threads write to the [Thread]s storebuffer)
485 thread->SetupMutatorState(kind);
486 ResumeThreadInternal(thread);
487
488 thread->AssertNonDartMutatorInvariants();
489 return true;
490 }
491 return false;
492}

◆ EnterIsolateGroupAsNonMutator()

bool dart::Thread::EnterIsolateGroupAsNonMutator ( IsolateGroup isolate_group,
TaskKind  kind 
)
static

Definition at line 506 of file thread.cc.

507 {
508 Thread* thread =
509 AddActiveThread(isolate_group, nullptr,
510 /*is_dart_mutator=*/false, /*bypass_safepoint=*/true);
511 if (thread != nullptr) {
512 thread->SetupState(kind);
513 ResumeThreadInternal(thread);
514
515 thread->AssertNonMutatorInvariants();
516 return true;
517 }
518 return false;
519}

◆ EnterSafepoint()

void dart::Thread::EnterSafepoint ( )
inline

Definition at line 1063 of file thread.h.

1063 {
1065 // First try a fast update of the thread state to indicate it is at a
1066 // safepoint.
1067 if (!TryEnterSafepoint()) {
1068 // Fast update failed which means we could potentially be in the middle
1069 // of a safepoint operation.
1070 EnterSafepointUsingLock();
1071 }
1072 }
bool TryEnterSafepoint()
Definition thread.h:1056

◆ execution_state()

ExecutionState dart::Thread::execution_state ( ) const
inline

Definition at line 1027 of file thread.h.

1027 {
1028 return static_cast<ExecutionState>(execution_state_);
1029 }

◆ execution_state_cross_thread_for_testing()

NO_SANITIZE_THREAD ExecutionState dart::Thread::execution_state_cross_thread_for_testing ( ) const
inline

Definition at line 1032 of file thread.h.

1032 {
1033 return static_cast<ExecutionState>(execution_state_);
1034 }

◆ execution_state_offset()

static intptr_t dart::Thread::execution_state_offset ( )
inlinestatic

Definition at line 1038 of file thread.h.

1038 {
1039 return OFFSET_OF(Thread, execution_state_);
1040 }

◆ exit_through_ffi_offset()

static intptr_t dart::Thread::exit_through_ffi_offset ( )
inlinestatic

Definition at line 474 of file thread.h.

474 {
475 return OFFSET_OF(Thread, exit_through_ffi_);
476 }

◆ ExitApiScope()

void dart::Thread::ExitApiScope ( )

Definition at line 1248 of file thread.cc.

1248 {
1250 ApiLocalScope* scope = api_top_scope();
1251 ApiLocalScope* reusable_scope = api_reusable_scope();
1252 set_api_top_scope(scope->previous()); // Reset top scope to previous.
1253 if (reusable_scope == nullptr) {
1254 scope->Reset(this); // Reset the old scope which we just exited.
1256 } else {
1257 ASSERT(reusable_scope != scope);
1258 delete scope;
1259 }
1260}

◆ ExitIsolate()

void dart::Thread::ExitIsolate ( bool  isolate_shutdown = false)
static

Definition at line 423 of file thread.cc.

423 {
424 Thread* thread = Thread::Current();
425 ASSERT(thread != nullptr);
426 ASSERT(thread->IsDartMutatorThread());
427 ASSERT(thread->isolate() != nullptr);
428 ASSERT(thread->isolate_group() != nullptr);
429 ASSERT(thread->isolate()->mutator_thread_ == thread);
430 ASSERT(thread->isolate()->scheduled_mutator_thread_ == thread);
431 DEBUG_ASSERT(!thread->IsAnyReusableHandleScopeActive());
432
433 auto isolate = thread->isolate();
434 auto group = thread->isolate_group();
435
436 thread->set_vm_tag(isolate->is_runnable() ? VMTag::kIdleTagId
437 : VMTag::kLoadWaitTagId);
438 if (thread->sticky_error() != Error::null()) {
439 ASSERT(isolate->sticky_error_ == Error::null());
440 isolate->sticky_error_ = thread->StealStickyError();
441 }
442
444
445 // Right now we keep the [Thread] object across the isolate's lifetime. This
446 // makes entering/exiting quite fast as it mainly boils down to safepoint
447 // transitions. Though any operation that walks over all active threads will
448 // see this thread as well (e.g. safepoint operations).
449 const bool is_nested_exit = thread->top_exit_frame_info() != 0;
450 if (ShouldSuspend(isolate_shutdown, thread)) {
451 const auto tag =
452 isolate->is_runnable() ? VMTag::kIdleTagId : VMTag::kLoadWaitTagId;
453 SuspendDartMutatorThreadInternal(thread, tag);
454 {
455 // Descheduled isolates are reloadable (if nothing else prevents it).
456 RawReloadParticipationScope enable_reload(thread);
457 thread->EnterSafepoint();
458 }
459 thread->set_execution_state(Thread::kThreadInNative);
460 } else {
461 thread->ResetDartMutatorState(isolate);
462 thread->ResetMutatorState();
463 thread->ResetState();
464 SuspendDartMutatorThreadInternal(thread, VMTag::kInvalidTagId);
465 FreeActiveThread(thread, /*bypass_safepoint=*/false);
466 }
467
468 // To let VM's thread pool (if we run on it) know that this thread is
469 // occupying a mutator again (decreases its max size).
470 ASSERT(!(isolate_shutdown && is_nested_exit));
471 if (!(is_nested_exit && thread->OwnsSafepoint())) {
472 group->DecreaseMutatorCount(isolate, is_nested_exit);
473 }
474}
bool is_runnable() const
Definition isolate.h:1048
static Thread * Current()
Definition thread.h:361
static bool ShouldSuspend(bool isolate_shutdown, Thread *thread)
Definition thread.cc:407

◆ ExitIsolateGroupAsHelper()

void dart::Thread::ExitIsolateGroupAsHelper ( bool  bypass_safepoint)
static

Definition at line 494 of file thread.cc.

494 {
495 Thread* thread = Thread::Current();
496 thread->AssertNonDartMutatorInvariants();
497
498 // Even if [bypass_safepoint] is true, a thread may need mutator state (e.g.
499 // parallel scavenger threads write to the [Thread]s storebuffer)
500 thread->ResetMutatorState();
501 thread->ResetState();
502 SuspendThreadInternal(thread, VMTag::kInvalidTagId);
503 FreeActiveThread(thread, bypass_safepoint);
504}

◆ ExitIsolateGroupAsNonMutator()

void dart::Thread::ExitIsolateGroupAsNonMutator ( )
static

Definition at line 521 of file thread.cc.

521 {
522 Thread* thread = Thread::Current();
523 ASSERT(thread != nullptr);
524 thread->AssertNonMutatorInvariants();
525
526 thread->ResetState();
527 SuspendThreadInternal(thread, VMTag::kInvalidTagId);
528 FreeActiveThread(thread, /*bypass_safepoint=*/true);
529}

◆ ExitSafepoint()

void dart::Thread::ExitSafepoint ( )
inline

Definition at line 1081 of file thread.h.

1081 {
1082 // First try a fast update of the thread state to indicate it is not at a
1083 // safepoint anymore.
1084 if (!TryExitSafepoint()) {
1085 // Fast update failed which means we could potentially be in the middle
1086 // of a safepoint operation.
1087 ExitSafepointUsingLock();
1088 }
1089 }
bool TryExitSafepoint()
Definition thread.h:1074

◆ field_table_values_offset()

static intptr_t dart::Thread::field_table_values_offset ( )
inlinestatic

Definition at line 542 of file thread.h.

542 {
543 return OFFSET_OF(Thread, field_table_values_);
544 }

◆ force_growth()

bool dart::Thread::force_growth ( ) const
inline

Definition at line 628 of file thread.h.

628{ return force_growth_scope_depth_ != 0; }

◆ full_safepoint_state_acquired()

static uword dart::Thread::full_safepoint_state_acquired ( )
inlinestatic

Definition at line 1051 of file thread.h.

1051 {
1052 return (1 << AtSafepointField::shift()) |
1054 }
static constexpr int shift()
Definition bitfield.h:161

◆ full_safepoint_state_unacquired()

static uword dart::Thread::full_safepoint_state_unacquired ( )
inlinestatic

Definition at line 1047 of file thread.h.

1047 {
1048 return (0 << AtSafepointField::shift()) |
1050 }

◆ GetAndClearInterrupts()

uword dart::Thread::GetAndClearInterrupts ( )

Definition at line 719 of file thread.cc.

719 {
720 uword interrupt_bits = 0;
721 uword old_limit = stack_limit_.load();
722 uword new_limit = saved_stack_limit_;
723 do {
724 if (IsInterruptLimit(old_limit)) {
725 interrupt_bits = interrupt_bits | (old_limit & kInterruptsMask);
726 } else {
727 return interrupt_bits;
728 }
729 } while (!stack_limit_.compare_exchange_weak(old_limit, new_limit));
730
731 return interrupt_bits;
732}
bool compare_exchange_weak(T &expected, T desired, std::memory_order order=std::memory_order_relaxed)
Definition atomic.h:52
uintptr_t uword
Definition globals.h:501
static bool IsInterruptLimit(uword limit)
Definition thread.cc:700

◆ GetAndClearStackOverflowFlags()

uword dart::Thread::GetAndClearStackOverflowFlags ( )

Definition at line 780 of file thread.cc.

780 {
781 uword stack_overflow_flags = stack_overflow_flags_;
782 stack_overflow_flags_ = 0;
783 return stack_overflow_flags;
784}

◆ GetNextTaskId()

int64_t dart::Thread::GetNextTaskId ( )
inline

Definition at line 1116 of file thread.h.

1116{ return next_task_id_++; }

◆ global_object_pool()

ObjectPoolPtr dart::Thread::global_object_pool ( ) const
inline

Definition at line 779 of file thread.h.

779{ return global_object_pool_; }

◆ global_object_pool_offset()

static intptr_t dart::Thread::global_object_pool_offset ( )
inlinestatic

Definition at line 840 of file thread.h.

840 {
841 return OFFSET_OF(Thread, global_object_pool_);
842 }

◆ HandleInterrupts()

ErrorPtr dart::Thread::HandleInterrupts ( )

Definition at line 734 of file thread.cc.

734 {
735 uword interrupt_bits = GetAndClearInterrupts();
736 if ((interrupt_bits & kVMInterrupt) != 0) {
738 if (isolate_group()->store_buffer()->Overflowed()) {
739 // Evacuate: If the popular store buffer targets are copied instead of
740 // promoted, the store buffer won't shrink and a second scavenge will
741 // occur that does promote them.
743 }
744 heap()->CheckFinalizeMarking(this);
745
746#if !defined(PRODUCT)
747 if (isolate()->TakeHasCompletedBlocks()) {
749 }
750#endif // !defined(PRODUCT)
751
752#if !defined(PRODUCT) || defined(FORCE_INCLUDE_SAMPLING_HEAP_PROFILER)
753 HeapProfileSampler& sampler = heap_sampler();
754 if (sampler.ShouldSetThreadSamplingInterval()) {
755 sampler.SetThreadSamplingInterval();
756 }
757 if (sampler.ShouldUpdateThreadEnable()) {
758 sampler.UpdateThreadEnable();
759 }
760#endif // !defined(PRODUCT) || defined(FORCE_INCLUDE_SAMPLING_HEAP_PROFILER)
761 }
762 if ((interrupt_bits & kMessageInterrupt) != 0) {
765 if (status != MessageHandler::kOK) {
766 // False result from HandleOOBMessages signals that the isolate should
767 // be terminating.
768 if (FLAG_trace_isolates) {
770 "[!] Terminating isolate due to OOB message:\n"
771 "\tisolate: %s\n",
772 isolate()->name());
773 }
774 return StealStickyError();
775 }
776 }
777 return Error::null();
778}
void CheckFinalizeMarking(Thread *thread)
Definition heap.cc:616
void CollectGarbage(Thread *thread, GCType type, GCReason reason)
Definition heap.cc:547
MessageHandler * message_handler() const
Definition isolate.cc:2380
MessageStatus HandleOOBMessages()
static void static void PrintErr(const char *format,...) PRINTF_ATTRIBUTE(1
static void ProcessCompletedBlocks(Isolate *isolate)
Definition profiler.cc:1831
uword GetAndClearInterrupts()
Definition thread.cc:719
DART_WARN_UNUSED_RESULT ErrorPtr StealStickyError()
Definition thread.cc:243
Heap * heap() const
Definition thread.cc:876
void CheckForSafepoint()
Definition thread.h:1091
HeapProfileSampler & heap_sampler()
Definition thread.h:1128
const char *const name

◆ HasActiveState()

bool dart::Thread::HasActiveState ( )

Definition at line 349 of file thread.cc.

349 {
350 // Do we have active dart frames?
351 if (top_exit_frame_info() != 0) {
352 return true;
353 }
354 // Do we have active embedder scopes?
355 if (api_top_scope() != nullptr) {
356 return true;
357 }
358 // Do we have active vm zone?
359 if (zone() != nullptr) {
360 return true;
361 }
363 return false;
364}

◆ HasCompilerState()

bool dart::Thread::HasCompilerState ( ) const
inline

Definition at line 581 of file thread.h.

581{ return compiler_state_ != nullptr; }

◆ HasExitedDartCode()

bool dart::Thread::HasExitedDartCode ( ) const

Definition at line 884 of file thread.cc.

884 {
885 return (top_exit_frame_info() != 0) && !VMTag::IsDartTag(vm_tag());
886}
uword vm_tag() const
Definition thread.h:808
static bool IsDartTag(uword id)
Definition tags.h:64

◆ HasScheduledInterrupts()

bool dart::Thread::HasScheduledInterrupts ( ) const
inline

Definition at line 496 of file thread.h.

496 {
497 return (stack_limit_.load() & kInterruptsMask) != 0;
498 }

◆ heap()

Heap * dart::Thread::heap ( ) const

Definition at line 876 of file thread.cc.

876 {
877 return isolate_group_->heap();
878}
Heap * heap() const
Definition isolate.h:295

◆ heap_base()

uword dart::Thread::heap_base ( ) const
inline

Definition at line 428 of file thread.h.

428 {
429#if defined(DART_COMPRESSED_POINTERS)
430 return heap_base_;
431#else
432 return 0;
433#endif
434 }

◆ heap_sampler()

HeapProfileSampler & dart::Thread::heap_sampler ( )
inline

Definition at line 1128 of file thread.h.

1128{ return heap_sampler_; }

◆ hierarchy_info()

HierarchyInfo * dart::Thread::hierarchy_info ( ) const
inline

Definition at line 588 of file thread.h.

588 {
589 ASSERT(isolate_group_ != nullptr);
590 return hierarchy_info_;
591 }

◆ IncrementAndGetRuntimeCallCount()

uint32_t dart::Thread::IncrementAndGetRuntimeCallCount ( )
inline

Definition at line 450 of file thread.h.

450{ return ++runtime_call_count_; }

◆ IncrementAndGetStackOverflowCount()

int32_t dart::Thread::IncrementAndGetStackOverflowCount ( )
inline

Definition at line 446 of file thread.h.

446 {
447 return ++stack_overflow_count_;
448 }

◆ IncrementForceGrowthScopeDepth()

void dart::Thread::IncrementForceGrowthScopeDepth ( )
inline

Definition at line 629 of file thread.h.

629 {
630 ASSERT(force_growth_scope_depth_ < INT_MAX);
631 force_growth_scope_depth_ += 1;
632 }

◆ IncrementNoCallbackScopeDepth()

void dart::Thread::IncrementNoCallbackScopeDepth ( )
inline

Definition at line 619 of file thread.h.

619 {
620 ASSERT(no_callback_scope_depth_ < INT_MAX);
621 no_callback_scope_depth_ += 1;
622 }

◆ IncrementNoSafepointScopeDepth()

void dart::Thread::IncrementNoSafepointScopeDepth ( )
inline

Definition at line 713 of file thread.h.

713 {
714#if defined(DEBUG)
715 ASSERT(no_safepoint_scope_depth_ < INT_MAX);
716 no_safepoint_scope_depth_ += 1;
717#endif
718 }

◆ InitVMConstants()

void dart::Thread::InitVMConstants ( )

Definition at line 181 of file thread.cc.

181 {
182#if defined(DART_COMPRESSED_POINTERS)
183 heap_base_ = Object::null()->heap_base();
184#endif
185
186#define ASSERT_VM_HEAP(type_name, member_name, init_expr, default_init_value) \
187 ASSERT((init_expr)->IsOldObject());
189#undef ASSERT_VM_HEAP
190
191#define INIT_VALUE(type_name, member_name, init_expr, default_init_value) \
192 ASSERT(member_name == default_init_value); \
193 member_name = (init_expr);
195#undef INIT_VALUE
196
197 for (intptr_t i = 0; i < kNumberOfDartAvailableCpuRegs; ++i) {
198 write_barrier_wrappers_entry_points_[i] =
199 StubCode::WriteBarrierWrappers().EntryPoint() +
201 }
202
203#define INIT_VALUE(name) \
204 ASSERT(name##_entry_point_ == 0); \
205 name##_entry_point_ = k##name##RuntimeEntry.GetEntryPoint();
207#undef INIT_VALUE
208
209#define INIT_VALUE(returntype, name, ...) \
210 ASSERT(name##_entry_point_ == 0); \
211 name##_entry_point_ = k##name##RuntimeEntry.GetEntryPoint();
213#undef INIT_VALUE
214
215// Setup the thread specific reusable handles.
216#define REUSABLE_HANDLE_ALLOCATION(object) \
217 this->object##_handle_ = this->AllocateReusableHandle<object>();
219#undef REUSABLE_HANDLE_ALLOCATION
220}
uword heap_base() const
const intptr_t kStoreBufferWrapperSize
constexpr int kNumberOfDartAvailableCpuRegs
#define RUNTIME_ENTRY_LIST(V)
#define LEAF_RUNTIME_ENTRY_LIST(V)
#define INIT_VALUE(type_name, member_name, init_expr, default_init_value)
#define ASSERT_VM_HEAP(type_name, member_name, init_expr, default_init_value)
#define REUSABLE_HANDLE_ALLOCATION(object)
#define CACHED_CONSTANTS_LIST(V)
Definition thread.h:267
#define CACHED_VM_OBJECTS_LIST(V)
Definition thread.h:185

◆ is_marking()

bool dart::Thread::is_marking ( ) const
inline

Definition at line 669 of file thread.h.

669{ return marking_stack_block_ != nullptr; }

◆ is_unwind_in_progress()

bool dart::Thread::is_unwind_in_progress ( ) const
inline

Definition at line 638 of file thread.h.

638{ return is_unwind_in_progress_; }

◆ IsAtSafepoint() [1/3]

bool dart::Thread::IsAtSafepoint ( ) const
inline

Definition at line 904 of file thread.h.

904 {
905 // Owning a higher level safepoint implies owning the lower levels as well.
907 }
bool IsAtSafepoint() const
Definition thread.h:904

◆ IsAtSafepoint() [2/3]

bool dart::Thread::IsAtSafepoint ( SafepointLevel  level) const
inline

Definition at line 908 of file thread.h.

908 {
909 return IsAtSafepoint(level, safepoint_state_.load());
910 }

◆ IsAtSafepoint() [3/3]

static bool dart::Thread::IsAtSafepoint ( SafepointLevel  level,
uword  state 
)
inlinestatic

Definition at line 898 of file thread.h.

898 {
899 const uword mask = AtSafepointBits(level);
900 return (state & mask) == mask;
901 }
AtkStateType state

◆ IsBlockedForSafepoint() [1/2]

bool dart::Thread::IsBlockedForSafepoint ( ) const
inline

Definition at line 986 of file thread.h.

986 {
987 return BlockedForSafepointField::decode(safepoint_state_);
988 }

◆ IsBlockedForSafepoint() [2/2]

static bool dart::Thread::IsBlockedForSafepoint ( uword  state)
inlinestatic

Definition at line 983 of file thread.h.

983 {
985 }

◆ IsDartMutatorThread()

bool dart::Thread::IsDartMutatorThread ( ) const
inline

Definition at line 546 of file thread.h.

546 {
547 return scheduled_dart_mutator_isolate_ != nullptr;
548 }

◆ IsExecutingDartCode()

bool dart::Thread::IsExecutingDartCode ( ) const

Definition at line 880 of file thread.cc.

880 {
881 return (top_exit_frame_info() == 0) && VMTag::IsDartTag(vm_tag());
882}

◆ IsInNoReloadScope()

bool dart::Thread::IsInNoReloadScope ( ) const
inline

Definition at line 727 of file thread.h.

727{ return no_reload_scope_depth_ > 0; }

◆ IsInStoppedMutatorsScope()

bool dart::Thread::IsInStoppedMutatorsScope ( ) const
inline

Definition at line 729 of file thread.h.

729 {
730 return stopped_mutators_scope_depth_ > 0;
731 }

◆ isolate()

Isolate * dart::Thread::isolate ( ) const
inline

Definition at line 533 of file thread.h.

533{ return isolate_; }

◆ isolate_group()

IsolateGroup * dart::Thread::isolate_group ( ) const
inline

Definition at line 540 of file thread.h.

540{ return isolate_group_; }

◆ isolate_group_offset()

static intptr_t dart::Thread::isolate_group_offset ( )
inlinestatic

Definition at line 535 of file thread.h.

535 {
536 return OFFSET_OF(Thread, isolate_group_);
537 }

◆ isolate_offset()

static intptr_t dart::Thread::isolate_offset ( )
inlinestatic

Definition at line 534 of file thread.h.

534{ return OFFSET_OF(Thread, isolate_); }

◆ IsSafepointLevelRequested()

static bool dart::Thread::IsSafepointLevelRequested ( uword  state,
SafepointLevel  level 
)
inlinestatic

Definition at line 942 of file thread.h.

942 {
943 switch (level) {
950 default:
951 UNREACHABLE();
952 }
953 }
#define UNREACHABLE()
Definition assert.h:248

◆ IsSafepointLevelRequestedLocked()

bool dart::Thread::IsSafepointLevelRequestedLocked ( SafepointLevel  level) const
inline

Definition at line 935 of file thread.h.

935 {
936 ASSERT(thread_lock()->IsOwnedByCurrentThread());
937 if (level > current_safepoint_level()) return false;
938 const uword state = safepoint_state_.load();
939 return IsSafepointLevelRequested(state, level);
940 }
Monitor * thread_lock() const
Definition thread.h:501
static bool IsSafepointLevelRequested(uword state, SafepointLevel level)
Definition thread.h:942
SafepointLevel current_safepoint_level() const
Definition thread.h:1133

◆ IsSafepointRequested() [1/2]

bool dart::Thread::IsSafepointRequested ( ) const
inline

Definition at line 924 of file thread.h.

924 {
926 }

◆ IsSafepointRequested() [2/2]

bool dart::Thread::IsSafepointRequested ( SafepointLevel  level) const
inline

Definition at line 927 of file thread.h.

927 {
928 const uword state = safepoint_state_.load();
929 for (intptr_t i = level; i >= 0; --i) {
930 if (IsSafepointLevelRequested(state, static_cast<SafepointLevel>(i)))
931 return true;
932 }
933 return false;
934 }
SafepointLevel
Definition thread.h:289

◆ IsSafepointRequestedLocked()

bool dart::Thread::IsSafepointRequestedLocked ( SafepointLevel  level) const
inline

Definition at line 920 of file thread.h.

920 {
921 ASSERT(thread_lock()->IsOwnedByCurrentThread());
922 return IsSafepointRequested(level);
923 }

◆ IsValidHandle()

bool dart::Thread::IsValidHandle ( Dart_Handle  object) const

Definition at line 1199 of file thread.cc.

1199 {
1200 return IsValidLocalHandle(object) || IsValidZoneHandle(object) ||
1201 IsValidScopedHandle(object);
1202}
bool IsValidZoneHandle(Dart_Handle object) const
bool IsValidScopedHandle(Dart_Handle object) const
bool IsValidLocalHandle(Dart_Handle object) const
Definition thread.cc:1204

◆ IsValidLocalHandle()

bool dart::Thread::IsValidLocalHandle ( Dart_Handle  object) const

Definition at line 1204 of file thread.cc.

1204 {
1205 ApiLocalScope* scope = api_top_scope_;
1206 while (scope != nullptr) {
1207 if (scope->local_handles()->IsValidHandle(object)) {
1208 return true;
1209 }
1210 scope = scope->previous();
1211 }
1212 return false;
1213}
ApiLocalScope * previous() const

◆ marking_stack_block_offset()

static intptr_t dart::Thread::marking_stack_block_offset ( )
inlinestatic

Definition at line 674 of file thread.h.

674 {
675 return OFFSET_OF(Thread, marking_stack_block_);
676 }

◆ MarkingStackAddObject()

void dart::Thread::MarkingStackAddObject ( ObjectPtr  obj)

Definition at line 826 of file thread.cc.

826 {
827 marking_stack_block_->Push(obj);
828 if (marking_stack_block_->IsFull()) {
830 }
831}
void MarkingStackBlockProcess()
Definition thread.cc:816

◆ MarkingStackBlockProcess()

void dart::Thread::MarkingStackBlockProcess ( )

Definition at line 816 of file thread.cc.

816 {
817 MarkingStackRelease();
818 MarkingStackAcquire();
819}

◆ MayAllocateHandles()

virtual bool dart::Thread::MayAllocateHandles ( )
inlinevirtual

Implements dart::ThreadState.

Definition at line 1042 of file thread.h.

1042 {
1043 return (execution_state() == kThreadInVM) ||
1045 }
ExecutionState execution_state() const
Definition thread.h:1027

◆ next()

Thread * dart::Thread::next ( ) const
inline

Definition at line 1100 of file thread.h.

1100{ return next_; }

◆ next_task_id_offset()

static intptr_t dart::Thread::next_task_id_offset ( )
inlinestatic

Definition at line 1117 of file thread.h.

1117 {
1118 return OFFSET_OF(Thread, next_task_id_);
1119 }

◆ no_callback_scope_depth()

int32_t dart::Thread::no_callback_scope_depth ( ) const
inline

Definition at line 618 of file thread.h.

618{ return no_callback_scope_depth_; }

◆ no_safepoint_scope_depth()

int32_t dart::Thread::no_safepoint_scope_depth ( ) const
inline

Definition at line 705 of file thread.h.

705 {
706#if defined(DEBUG)
707 return no_safepoint_scope_depth_;
708#else
709 return 0;
710#endif
711 }

◆ ObjectAtOffset()

bool dart::Thread::ObjectAtOffset ( intptr_t  offset,
Object object 
)
static

Definition at line 1139 of file thread.cc.

1139 {
1141 // --disassemble-stubs runs before all the references through
1142 // thread have targets
1143 return false;
1144 }
1145
1146#define COMPUTE_OFFSET(type_name, member_name, expr, default_init_value) \
1147 if (Thread::member_name##offset() == offset) { \
1148 *object = expr; \
1149 return true; \
1150 }
1152#undef COMPUTE_OFFSET
1153 return false;
1154}
static Isolate * vm_isolate()
Definition dart.h:68
static Isolate * Current()
Definition isolate.h:939
#define COMPUTE_OFFSET(type_name, member_name, expr, default_init_value)

◆ OffsetFromThread() [1/2]

intptr_t dart::Thread::OffsetFromThread ( const Object object)
static

Definition at line 1112 of file thread.cc.

1112 {
1113 // In order to allow us to use assembler helper routines with non-[Code]
1114 // objects *before* stubs are initialized, we only loop ver the stubs if the
1115 // [object] is in fact a [Code] object.
1116 if (object.IsCode()) {
1117#define COMPUTE_OFFSET(type_name, member_name, expr, default_init_value) \
1118 ASSERT((expr)->untag()->InVMIsolateHeap()); \
1119 if (object.ptr() == expr) { \
1120 return Thread::member_name##offset(); \
1121 }
1123#undef COMPUTE_OFFSET
1124 }
1125
1126 // For non [Code] objects we check if the object equals to any of the cached
1127 // non-stub entries.
1128#define COMPUTE_OFFSET(type_name, member_name, expr, default_init_value) \
1129 if (object.ptr() == expr) { \
1130 return Thread::member_name##offset(); \
1131 }
1133#undef COMPUTE_OFFSET
1134
1135 UNREACHABLE();
1136 return -1;
1137}

◆ OffsetFromThread() [2/2]

intptr_t dart::Thread::OffsetFromThread ( const RuntimeEntry runtime_entry)
static

Definition at line 1156 of file thread.cc.

1156 {
1157#define COMPUTE_OFFSET(name) \
1158 if (runtime_entry == &k##name##RuntimeEntry) { \
1159 return Thread::name##_entry_point_offset(); \
1160 }
1162#undef COMPUTE_OFFSET
1163
1164#define COMPUTE_OFFSET(returntype, name, ...) \
1165 if (runtime_entry == &k##name##RuntimeEntry) { \
1166 return Thread::name##_entry_point_offset(); \
1167 }
1169#undef COMPUTE_OFFSET
1170
1171 UNREACHABLE();
1172 return -1;
1173}

◆ OwnsDeoptSafepoint()

bool dart::Thread::OwnsDeoptSafepoint ( ) const

Definition at line 1291 of file thread.cc.

◆ OwnsGCSafepoint()

bool dart::Thread::OwnsGCSafepoint ( ) const

Definition at line 1286 of file thread.cc.

◆ OwnsReloadSafepoint()

bool dart::Thread::OwnsReloadSafepoint ( ) const

Definition at line 1296 of file thread.cc.

◆ OwnsSafepoint()

bool dart::Thread::OwnsSafepoint ( ) const

Definition at line 1301 of file thread.cc.

1301 {
1304}
@ kNoSafepoint
Definition thread.h:300

◆ pending_deopts()

PendingDeopts & dart::Thread::pending_deopts ( )
inline

Definition at line 1131 of file thread.h.

1131{ return pending_deopts_; }

◆ PrintJSON()

void dart::Thread::PrintJSON ( JSONStream stream) const

◆ random()

Random * dart::Thread::random ( )
inline

Definition at line 1120 of file thread.h.

1120{ return &thread_random_; }

◆ random_offset()

static intptr_t dart::Thread::random_offset ( )
inlinestatic

Definition at line 1121 of file thread.h.

1121{ return OFFSET_OF(Thread, thread_random_); }

◆ ReleaseMarkingStack()

void dart::Thread::ReleaseMarkingStack ( )

◆ ReleaseStoreBuffer()

void dart::Thread::ReleaseStoreBuffer ( )

Definition at line 672 of file thread.cc.

672 {
674 if (store_buffer_block_ == nullptr || store_buffer_block_->IsEmpty()) {
675 return; // Nothing to release.
676 }
677 // Prevent scheduling another GC by ignoring the threshold.
678 StoreBufferRelease(StoreBuffer::kIgnoreThreshold);
679 // Make sure to get an *empty* block; the isolate needs all entries
680 // at GC time.
681 // TODO(koda): Replace with an epilogue (PrepareAfterGC) that acquires.
682 store_buffer_block_ = isolate_group()->store_buffer()->PopEmptyBlock();
683}
Block * PopEmptyBlock()
StoreBuffer * store_buffer() const
Definition isolate.h:504
bool IsEmpty() const

◆ RememberLiveTemporaries()

void dart::Thread::RememberLiveTemporaries ( )

Definition at line 1083 of file thread.cc.

1083 {
1084 RestoreWriteBarrierInvariant(
1085 RestoreWriteBarrierInvariantOp::kAddToRememberedSet);
1086}

◆ resume_pc()

uword dart::Thread::resume_pc ( ) const
inline

Definition at line 860 of file thread.h.

860{ return resume_pc_; }

◆ resume_pc_offset()

static uword dart::Thread::resume_pc_offset ( )
inlinestatic

Definition at line 862 of file thread.h.

862{ return OFFSET_OF(Thread, resume_pc_); }

◆ safepoint_state()

uword dart::Thread::safepoint_state ( )
inline

Definition at line 1018 of file thread.h.

1018{ return safepoint_state_; }

◆ safepoint_state_offset()

static intptr_t dart::Thread::safepoint_state_offset ( )
inlinestatic

Definition at line 458 of file thread.h.

458 {
459 return OFFSET_OF(Thread, safepoint_state_);
460 }

◆ saved_shadow_call_stack()

uword dart::Thread::saved_shadow_call_stack ( ) const
inline

Definition at line 417 of file thread.h.

417{ return saved_shadow_call_stack_; }

◆ saved_shadow_call_stack_offset()

static uword dart::Thread::saved_shadow_call_stack_offset ( )
inlinestatic

Definition at line 418 of file thread.h.

418 {
419 return OFFSET_OF(Thread, saved_shadow_call_stack_);
420 }

◆ saved_stack_limit()

uword dart::Thread::saved_stack_limit ( ) const
inline

Definition at line 409 of file thread.h.

409{ return saved_stack_limit_; }

◆ saved_stack_limit_offset()

static intptr_t dart::Thread::saved_stack_limit_offset ( )
inlinestatic

Definition at line 406 of file thread.h.

406 {
407 return OFFSET_OF(Thread, saved_stack_limit_);
408 }

◆ scheduled_dart_mutator_isolate()

Isolate * dart::Thread::scheduled_dart_mutator_isolate ( ) const
inline

Definition at line 557 of file thread.h.

557 {
558 return scheduled_dart_mutator_isolate_;
559 }

◆ ScheduleInterrupts()

void dart::Thread::ScheduleInterrupts ( uword  interrupt_bits)

Definition at line 705 of file thread.cc.

705 {
706 ASSERT((interrupt_bits & ~kInterruptsMask) == 0); // Must fit in mask.
707
708 uword old_limit = stack_limit_.load();
709 uword new_limit;
710 do {
711 if (IsInterruptLimit(old_limit)) {
712 new_limit = old_limit | interrupt_bits;
713 } else {
714 new_limit = (kInterruptStackLimit & ~kInterruptsMask) | interrupt_bits;
715 }
716 } while (!stack_limit_.compare_exchange_weak(old_limit, new_limit));
717}
static constexpr uword kInterruptStackLimit

◆ service_extension_stream_offset()

static intptr_t dart::Thread::service_extension_stream_offset ( )
inlinestatic

Definition at line 571 of file thread.h.

571 {
572 return OFFSET_OF(Thread, service_extension_stream_);
573 }

◆ set_active_exception()

void dart::Thread::set_active_exception ( const Object value)

Definition at line 222 of file thread.cc.

222 {
223 active_exception_ = value.ptr();
224}
uint8_t value

◆ set_active_stacktrace()

void dart::Thread::set_active_stacktrace ( const Object value)

Definition at line 226 of file thread.cc.

226 {
227 active_stacktrace_ = value.ptr();
228}

◆ set_api_reusable_scope()

void dart::Thread::set_api_reusable_scope ( ApiLocalScope value)
inline

Definition at line 505 of file thread.h.

505 {
506 ASSERT(value == nullptr || api_reusable_scope_ == nullptr);
507 api_reusable_scope_ = value;
508 }

◆ set_api_top_scope()

void dart::Thread::set_api_top_scope ( ApiLocalScope value)
inline

Definition at line 513 of file thread.h.

513{ api_top_scope_ = value; }

◆ set_compiler_timings()

void dart::Thread::set_compiler_timings ( CompilerTimings stats)
inline

Definition at line 614 of file thread.h.

614 {
615 compiler_timings_ = stats;
616 }
dict stats
Definition malisc.py:20

◆ set_dispatch_table_array()

void dart::Thread::set_dispatch_table_array ( const uword array)
inline

Definition at line 785 of file thread.h.

785 {
786 dispatch_table_array_ = array;
787 }

◆ set_end()

void dart::Thread::set_end ( uword  end)
inline

Definition at line 700 of file thread.h.

700{ end_ = end; }
uword end() const
Definition thread.h:697

◆ set_execution_state()

void dart::Thread::set_execution_state ( ExecutionState  state)
inline

Definition at line 1035 of file thread.h.

1035 {
1036 execution_state_ = static_cast<uword>(state);
1037 }

◆ set_global_object_pool()

void dart::Thread::set_global_object_pool ( ObjectPoolPtr  raw_value)
inline

Definition at line 780 of file thread.h.

780 {
781 global_object_pool_ = raw_value;
782 }

◆ set_hierarchy_info()

void dart::Thread::set_hierarchy_info ( HierarchyInfo value)
inline

Definition at line 593 of file thread.h.

593 {
594 ASSERT(isolate_group_ != nullptr);
595 ASSERT((hierarchy_info_ == nullptr && value != nullptr) ||
596 (hierarchy_info_ != nullptr && value == nullptr));
597 hierarchy_info_ = value;
598 }

◆ set_resume_pc()

void dart::Thread::set_resume_pc ( uword  value)
inline

Definition at line 861 of file thread.h.

861{ resume_pc_ = value; }

◆ set_sticky_error()

void dart::Thread::set_sticky_error ( const Error value)

Definition at line 234 of file thread.cc.

234 {
235 ASSERT(!value.IsNull());
236 sticky_error_ = value.ptr();
237}

◆ set_top()

void dart::Thread::set_top ( uword  top)
inline

Definition at line 699 of file thread.h.

699{ top_ = top; }
uword top() const
Definition thread.h:696

◆ set_top_exit_frame_info()

void dart::Thread::set_top_exit_frame_info ( uword  top_exit_frame_info)
inline

Definition at line 679 of file thread.h.

679 {
680 top_exit_frame_info_ = top_exit_frame_info;
681 }

◆ set_true_end()

void dart::Thread::set_true_end ( uword  true_end)
inline

Definition at line 701 of file thread.h.

701{ true_end_ = true_end; }
uword true_end() const
Definition thread.h:698

◆ set_type_usage_info()

void dart::Thread::set_type_usage_info ( TypeUsageInfo value)
inline

Definition at line 605 of file thread.h.

605 {
606 ASSERT(isolate_group_ != nullptr);
607 ASSERT((type_usage_info_ == nullptr && value != nullptr) ||
608 (type_usage_info_ != nullptr && value == nullptr));
609 type_usage_info_ = value;
610 }

◆ set_unboxed_double_runtime_arg()

void dart::Thread::set_unboxed_double_runtime_arg ( double  value)
inline

Definition at line 827 of file thread.h.

827 {
828 unboxed_runtime_arg_.double_storage[0] = value;
829 }
double double_storage[2]
Definition globals.h:151

◆ set_unboxed_int64_runtime_arg()

void dart::Thread::set_unboxed_int64_runtime_arg ( int64_t  value)
inline

Definition at line 815 of file thread.h.

815 {
816 unboxed_runtime_arg_.int64_storage[0] = value;
817 }
int64_t int64_storage[2]
Definition globals.h:149

◆ set_unboxed_int64_runtime_second_arg()

void dart::Thread::set_unboxed_int64_runtime_second_arg ( int64_t  value)
inline

Definition at line 821 of file thread.h.

821 {
822 unboxed_runtime_arg_.int64_storage[1] = value;
823 }

◆ set_unboxed_simd128_runtime_arg()

void dart::Thread::set_unboxed_simd128_runtime_arg ( simd128_value_t  value)
inline

Definition at line 833 of file thread.h.

833 {
834 unboxed_runtime_arg_ = value;
835 }

◆ set_vm_tag()

void dart::Thread::set_vm_tag ( uword  tag)
inline

Definition at line 809 of file thread.h.

809{ vm_tag_ = tag; }

◆ SetAtSafepoint()

void dart::Thread::SetAtSafepoint ( bool  value,
SafepointLevel  level 
)
inline

Definition at line 911 of file thread.h.

911 {
912 ASSERT(thread_lock()->IsOwnedByCurrentThread());
914 if (value) {
915 safepoint_state_ |= AtSafepointBits(level);
916 } else {
917 safepoint_state_ &= ~AtSafepointBits(level);
918 }
919 }

◆ SetBlockedForSafepoint()

void dart::Thread::SetBlockedForSafepoint ( bool  value)
inline

Definition at line 989 of file thread.h.

989 {
990 ASSERT(thread_lock()->IsOwnedByCurrentThread());
991 safepoint_state_ =
992 BlockedForSafepointField::update(value, safepoint_state_);
993 }
static constexpr uword update(bool value, uword original)
Definition bitfield.h:190

◆ SetBypassSafepoints()

static uword dart::Thread::SetBypassSafepoints ( bool  value,
uword  state 
)
inlinestatic

Definition at line 997 of file thread.h.

997 {
999 }

◆ SetSafepointRequested()

uword dart::Thread::SetSafepointRequested ( SafepointLevel  level,
bool  value 
)
inline

Definition at line 957 of file thread.h.

957 {
958 ASSERT(thread_lock()->IsOwnedByCurrentThread());
959
960 uword mask = 0;
961 switch (level) {
964 break;
967 break;
970 break;
971 default:
972 UNREACHABLE();
973 }
974
975 if (value) {
976 // acquire pulls from the release in TryEnterSafepoint.
977 return safepoint_state_.fetch_or(mask, std::memory_order_acquire);
978 } else {
979 // release pushes to the acquire in TryExitSafepoint.
980 return safepoint_state_.fetch_and(~mask, std::memory_order_release);
981 }
982 }

◆ SetStackLimit()

void dart::Thread::SetStackLimit ( uword  value)

Definition at line 685 of file thread.cc.

685 {
686 // The thread setting the stack limit is not necessarily the thread which
687 // the stack limit is being set on.
688 MonitorLocker ml(&thread_lock_);
689 if (!HasScheduledInterrupts()) {
690 // No interrupt pending, set stack_limit_ too.
691 stack_limit_.store(limit);
692 }
693 saved_stack_limit_ = limit;
694}
void store(T arg, std::memory_order order=std::memory_order_relaxed)
Definition atomic.h:27
bool HasScheduledInterrupts() const
Definition thread.h:496
friend class MonitorLocker
Definition thread.h:1472

◆ SetUnwindErrorInProgress()

void dart::Thread::SetUnwindErrorInProgress ( bool  value)
inline

Definition at line 1003 of file thread.h.

1003 {
1005 if (value) {
1006 safepoint_state_.fetch_or(mask);
1007 } else {
1008 safepoint_state_.fetch_and(~mask);
1009 }
1010 }

◆ stack_limit_address()

uword dart::Thread::stack_limit_address ( ) const
inline

Definition at line 398 of file thread.h.

398 {
399 return reinterpret_cast<uword>(&stack_limit_);
400 }

◆ stack_limit_offset()

static intptr_t dart::Thread::stack_limit_offset ( )
inlinestatic

Definition at line 401 of file thread.h.

401 {
402 return OFFSET_OF(Thread, stack_limit_);
403 }

◆ stack_overflow_flags_offset()

static intptr_t dart::Thread::stack_overflow_flags_offset ( )
inlinestatic

Definition at line 442 of file thread.h.

442 {
443 return OFFSET_OF(Thread, stack_overflow_flags_);
444 }

◆ stack_overflow_shared_stub_entry_point_offset()

static uword dart::Thread::stack_overflow_shared_stub_entry_point_offset ( bool  fpu_regs)
inlinestatic

Definition at line 452 of file thread.h.

452 {
453 return fpu_regs
454 ? stack_overflow_shared_with_fpu_regs_entry_point_offset()
455 : stack_overflow_shared_without_fpu_regs_entry_point_offset();
456 }

◆ StartUnwindError()

void dart::Thread::StartUnwindError ( )
inline

Definition at line 640 of file thread.h.

640 {
641 is_unwind_in_progress_ = true;
643 }
void SetUnwindErrorInProgress(bool value)
Definition thread.h:1003

◆ StealStickyError()

ErrorPtr dart::Thread::StealStickyError ( )

Definition at line 243 of file thread.cc.

243 {
244 NoSafepointScope no_safepoint;
245 ErrorPtr return_value = sticky_error_;
246 sticky_error_ = Error::null();
247 return return_value;
248}

◆ sticky_error()

ErrorPtr dart::Thread::sticky_error ( ) const

Definition at line 230 of file thread.cc.

230 {
231 return sticky_error_;
232}

◆ store_buffer_block_offset()

static intptr_t dart::Thread::store_buffer_block_offset ( )
inlinestatic

Definition at line 665 of file thread.h.

665 {
666 return OFFSET_OF(Thread, store_buffer_block_);
667 }

◆ StoreBufferAddObject()

void dart::Thread::StoreBufferAddObject ( ObjectPtr  obj)

Definition at line 791 of file thread.cc.

791 {
792 ASSERT(this == Thread::Current());
793 store_buffer_block_->Push(obj);
794 if (store_buffer_block_->IsFull()) {
796 }
797}
void StoreBufferBlockProcess(StoreBuffer::ThresholdPolicy policy)
Definition thread.cc:786

◆ StoreBufferAddObjectGC()

void dart::Thread::StoreBufferAddObjectGC ( ObjectPtr  obj)

Definition at line 799 of file thread.cc.

799 {
800 store_buffer_block_->Push(obj);
801 if (store_buffer_block_->IsFull()) {
803 }
804}

◆ StoreBufferBlockProcess()

void dart::Thread::StoreBufferBlockProcess ( StoreBuffer::ThresholdPolicy  policy)

Definition at line 786 of file thread.cc.

786 {
787 StoreBufferRelease(policy);
788 StoreBufferAcquire();
789}

◆ task_kind()

TaskKind dart::Thread::task_kind ( ) const
inline

Definition at line 478 of file thread.h.

478{ return task_kind_; }

◆ TaskKindToCString()

const char * dart::Thread::TaskKindToCString ( TaskKind  kind)
static

Definition at line 250 of file thread.cc.

250 {
251 switch (kind) {
252 case kUnknownTask:
253 return "kUnknownTask";
254 case kMutatorTask:
255 return "kMutatorTask";
256 case kCompilerTask:
257 return "kCompilerTask";
258 case kSweeperTask:
259 return "kSweeperTask";
260 case kMarkerTask:
261 return "kMarkerTask";
262 default:
263 UNREACHABLE();
264 return "";
265 }
266}

◆ thread_lock()

Monitor * dart::Thread::thread_lock ( ) const
inline

Definition at line 501 of file thread.h.

501{ return &thread_lock_; }

◆ top()

uword dart::Thread::top ( ) const
inline

Definition at line 696 of file thread.h.

696{ return top_; }

◆ top_exit_frame_info()

uword dart::Thread::top_exit_frame_info ( ) const
inline

Definition at line 678 of file thread.h.

678{ return top_exit_frame_info_; }

◆ top_exit_frame_info_offset()

static intptr_t dart::Thread::top_exit_frame_info_offset ( )
inlinestatic

Definition at line 682 of file thread.h.

682 {
683 return OFFSET_OF(Thread, top_exit_frame_info_);
684 }

◆ top_offset()

static intptr_t dart::Thread::top_offset ( )
inlinestatic

Definition at line 702 of file thread.h.

702{ return OFFSET_OF(Thread, top_); }

◆ true_end()

uword dart::Thread::true_end ( ) const
inline

Definition at line 698 of file thread.h.

698{ return true_end_; }

◆ TryEnterSafepoint()

bool dart::Thread::TryEnterSafepoint ( )
inline

Definition at line 1056 of file thread.h.

1056 {
1057 uword old_state = 0;
1058 uword new_state = AtSafepointBits(current_safepoint_level());
1059 return safepoint_state_.compare_exchange_strong(old_state, new_state,
1060 std::memory_order_release);
1061 }

◆ TryExitSafepoint()

bool dart::Thread::TryExitSafepoint ( )
inline

Definition at line 1074 of file thread.h.

1074 {
1075 uword old_state = AtSafepointBits(current_safepoint_level());
1076 uword new_state = 0;
1077 return safepoint_state_.compare_exchange_strong(old_state, new_state,
1078 std::memory_order_acquire);
1079 }

◆ tsan_utils_offset()

static intptr_t dart::Thread::tsan_utils_offset ( )
inlinestatic

Definition at line 525 of file thread.h.

525{ return OFFSET_OF(Thread, tsan_utils_); }

◆ type_usage_info()

TypeUsageInfo * dart::Thread::type_usage_info ( ) const
inline

Definition at line 600 of file thread.h.

600 {
601 ASSERT(isolate_group_ != nullptr);
602 return type_usage_info_;
603 }

◆ unboxed_double_runtime_arg()

double dart::Thread::unboxed_double_runtime_arg ( ) const
inline

Definition at line 824 of file thread.h.

824 {
825 return unboxed_runtime_arg_.double_storage[0];
826 }

◆ unboxed_int64_runtime_arg()

int64_t dart::Thread::unboxed_int64_runtime_arg ( ) const
inline

Definition at line 812 of file thread.h.

812 {
813 return unboxed_runtime_arg_.int64_storage[0];
814 }

◆ unboxed_int64_runtime_second_arg()

int64_t dart::Thread::unboxed_int64_runtime_second_arg ( ) const
inline

Definition at line 818 of file thread.h.

818 {
819 return unboxed_runtime_arg_.int64_storage[1];
820 }

◆ unboxed_runtime_arg_offset()

static intptr_t dart::Thread::unboxed_runtime_arg_offset ( )
inlinestatic

Definition at line 836 of file thread.h.

836 {
837 return OFFSET_OF(Thread, unboxed_runtime_arg_);
838 }

◆ unboxed_simd128_runtime_arg()

simd128_value_t dart::Thread::unboxed_simd128_runtime_arg ( ) const
inline

Definition at line 830 of file thread.h.

830 {
831 return unboxed_runtime_arg_;
832 }

◆ UnwindErrorInProgress()

bool dart::Thread::UnwindErrorInProgress ( ) const
inline

Definition at line 1000 of file thread.h.

1000 {
1001 return UnwindErrorInProgressField::decode(safepoint_state_);
1002 }

◆ UnwindScopes()

void dart::Thread::UnwindScopes ( uword  stack_marker)

Definition at line 1262 of file thread.cc.

1262 {
1263 // Unwind all scopes using the same stack_marker, i.e. all scopes allocated
1264 // under the same top_exit_frame_info.
1265 ApiLocalScope* scope = api_top_scope_;
1266 while (scope != nullptr && scope->stack_marker() != 0 &&
1267 scope->stack_marker() == stack_marker) {
1268 api_top_scope_ = scope->previous();
1269 delete scope;
1270 scope = api_top_scope_;
1271 }
1272}

◆ VisitObjectPointers()

void dart::Thread::VisitObjectPointers ( ObjectPointerVisitor visitor,
ValidationPolicy  validate_frames 
)

Definition at line 901 of file thread.cc.

902 {
903 ASSERT(visitor != nullptr);
904
905 if (zone() != nullptr) {
906 zone()->VisitObjectPointers(visitor);
907 }
908
909 // Visit objects in thread specific handles area.
910 reusable_handles_.VisitObjectPointers(visitor);
911
912 visitor->VisitPointer(reinterpret_cast<ObjectPtr*>(&global_object_pool_));
913 visitor->VisitPointer(reinterpret_cast<ObjectPtr*>(&active_exception_));
914 visitor->VisitPointer(reinterpret_cast<ObjectPtr*>(&active_stacktrace_));
915 visitor->VisitPointer(reinterpret_cast<ObjectPtr*>(&sticky_error_));
916
917 // Visit the api local scope as it has all the api local handles.
918 ApiLocalScope* scope = api_top_scope_;
919 while (scope != nullptr) {
920 scope->local_handles()->VisitObjectPointers(visitor);
921 scope = scope->previous();
922 }
923
924 // Only the mutator thread can run Dart code.
925 if (IsDartMutatorThread()) {
926 // The MarkTask, which calls this method, can run on a different thread. We
927 // therefore assume the mutator is at a safepoint and we can iterate its
928 // stack.
929 // TODO(vm-team): It would be beneficial to be able to ask the mutator
930 // thread whether it is in fact blocked at the moment (at a "safepoint") so
931 // we can safely iterate its stack.
932 //
933 // Unfortunately we cannot use `this->IsAtSafepoint()` here because that
934 // will return `false` even though the mutator thread is waiting for mark
935 // tasks (which iterate its stack) to finish.
936 const StackFrameIterator::CrossThreadPolicy cross_thread_policy =
938
939 // Iterate over all the stack frames and visit objects on the stack.
940 StackFrameIterator frames_iterator(top_exit_frame_info(), validation_policy,
941 this, cross_thread_policy);
942 StackFrame* frame = frames_iterator.NextFrame();
943 visitor->set_gc_root_type("frame");
944 while (frame != nullptr) {
945 frame->VisitObjectPointers(visitor);
946 frame = frames_iterator.NextFrame();
947 }
948 visitor->clear_gc_root_type();
949 } else {
950 // We are not on the mutator thread.
952 }
953}
#define RELEASE_ASSERT(cond)
Definition assert.h:327
void VisitObjectPointers(ObjectPointerVisitor *visitor)
void VisitObjectPointers(ObjectPointerVisitor *visitor)
Definition handles.cc:20
void VisitObjectPointers(ObjectPointerVisitor *visitor)
Definition zone.cc:305
double frame
Definition examples.cpp:31

◆ vm_tag()

uword dart::Thread::vm_tag ( ) const
inline

Definition at line 808 of file thread.h.

808{ return vm_tag_; }

◆ vm_tag_offset()

static intptr_t dart::Thread::vm_tag_offset ( )
inlinestatic

Definition at line 810 of file thread.h.

810{ return OFFSET_OF(Thread, vm_tag_); }

◆ write_barrier_mask()

uword dart::Thread::write_barrier_mask ( ) const
inline

Definition at line 427 of file thread.h.

427{ return write_barrier_mask_; }

◆ write_barrier_mask_offset()

static intptr_t dart::Thread::write_barrier_mask_offset ( )
inlinestatic

Definition at line 436 of file thread.h.

436 {
437 return OFFSET_OF(Thread, write_barrier_mask_);
438 }

◆ write_barrier_wrappers_thread_offset()

static intptr_t dart::Thread::write_barrier_wrappers_thread_offset ( Register  reg)
inlinestatic

Definition at line 740 of file thread.h.

740 {
741 ASSERT((kDartAvailableCpuRegs & (1 << reg)) != 0);
742 intptr_t index = 0;
743 for (intptr_t i = 0; i < kNumberOfCpuRegisters; ++i) {
744 if ((kDartAvailableCpuRegs & (1 << i)) == 0) continue;
745 if (i == reg) break;
746 ++index;
747 }
748 return OFFSET_OF(Thread, write_barrier_wrappers_entry_points_) +
749 index * sizeof(uword);
750 }
@ kNumberOfCpuRegisters
constexpr RegList kDartAvailableCpuRegs

◆ WriteBarrierWrappersOffsetForRegister()

static intptr_t dart::Thread::WriteBarrierWrappersOffsetForRegister ( Register  reg)
inlinestatic

Definition at line 752 of file thread.h.

752 {
753 intptr_t index = 0;
754 for (intptr_t i = 0; i < kNumberOfCpuRegisters; ++i) {
755 if ((kDartAvailableCpuRegs & (1 << i)) == 0) continue;
756 if (i == reg) {
757 return index * kStoreBufferWrapperSize;
758 }
759 ++index;
760 }
761 UNREACHABLE();
762 return 0;
763 }

◆ ZoneSizeInBytes()

int dart::Thread::ZoneSizeInBytes ( ) const

Definition at line 1225 of file thread.cc.

1225 {
1226 int total = 0;
1227 ApiLocalScope* scope = api_top_scope_;
1228 while (scope != nullptr) {
1229 total += scope->zone()->SizeInBytes();
1230 scope = scope->previous();
1231 }
1232 return total;
1233}
uintptr_t SizeInBytes() const
Definition zone.cc:182

Friends And Related Symbol Documentation

◆ ActiveIsolateScope

friend class ActiveIsolateScope
friend

Definition at line 1452 of file thread.h.

◆ ApiZone

friend class ApiZone
friend

Definition at line 1451 of file thread.h.

◆ compiler::target::Thread

friend class compiler::target::Thread
friend

Definition at line 1464 of file thread.h.

◆ CompilerState

friend class CompilerState
friend

Definition at line 1463 of file thread.h.

◆ CreateWithinExistingIsolateGroup

Isolate * CreateWithinExistingIsolateGroup ( IsolateGroup ,
const char *  ,
char **   
)
friend

Definition at line 1302 of file dart_api_impl.cc.

1304 {
1307
1308 auto spawning_group = group;
1309
1310 Isolate* isolate = reinterpret_cast<Isolate*>(
1311 CreateIsolate(spawning_group, /*is_new_group=*/false, name,
1312 /*isolate_data=*/nullptr, error));
1313 if (isolate == nullptr) return nullptr;
1314
1315 auto source = spawning_group->source();
1316 ASSERT(isolate->source() == source);
1317
1318 return isolate;
1319}
IsolateGroupSource * source() const
Definition isolate.h:989
friend class Isolate
Definition thread.h:1454
#define API_TIMELINE_DURATION(thread)
#define CHECK_NO_ISOLATE(isolate)
SkBitmap source
Definition examples.cpp:28
const uint8_t uint32_t uint32_t GError ** error
static Dart_Isolate CreateIsolate(IsolateGroup *group, bool is_new_group, const char *name, void *isolate_data, char **error)

◆ Dart

friend class Dart
friend

Definition at line 1467 of file thread.h.

◆ FieldTable

friend class FieldTable
friend

Definition at line 1465 of file thread.h.

◆ InterruptChecker

friend class InterruptChecker
friend

Definition at line 1453 of file thread.h.

◆ Isolate

friend class Isolate
friend

Definition at line 1454 of file thread.h.

◆ IsolateGroup

friend class IsolateGroup
friend

Definition at line 1455 of file thread.h.

◆ MonitorLocker

friend class MonitorLocker
friend

Definition at line 1472 of file thread.h.

◆ NoActiveIsolateScope

friend class NoActiveIsolateScope
friend

Definition at line 1456 of file thread.h.

◆ NoReloadScope

friend class NoReloadScope
friend

Definition at line 1457 of file thread.h.

◆ RawReloadParticipationScope

friend class RawReloadParticipationScope
friend

Definition at line 1458 of file thread.h.

◆ RestoreWriteBarrierInvariantVisitor

Definition at line 1152 of file thread.h.

◆ RuntimeCallDeoptScope

friend class RuntimeCallDeoptScope
friend

Definition at line 1466 of file thread.h.

◆ Simulator

friend class Simulator
friend

Definition at line 1459 of file thread.h.

◆ StackZone

friend class StackZone
friend

Definition at line 1460 of file thread.h.

◆ StoppedMutatorsScope

friend class StoppedMutatorsScope
friend

Definition at line 1461 of file thread.h.

◆ ThreadRegistry

friend class ThreadRegistry
friend

Definition at line 1462 of file thread.h.

◆ TransitionGeneratedToVM

friend class TransitionGeneratedToVM
friend

Definition at line 1469 of file thread.h.

◆ TransitionVMToGenerated

friend class TransitionVMToGenerated
friend

Definition at line 1471 of file thread.h.


The documentation for this class was generated from the following files: