Flutter Engine
The Flutter Engine
Public Member Functions | Static Public Member Functions | Friends | List of all members
dart::IsolateGroup Class Reference

#include <isolate.h>

Inheritance diagram for dart::IsolateGroup:
dart::IntrusiveDListEntry< IsolateGroup >

Public Member Functions

 IsolateGroup (std::shared_ptr< IsolateGroupSource > source, void *embedder_data, ObjectStore *object_store, Dart_IsolateFlags api_flags, bool is_vm_isolate)
 
 IsolateGroup (std::shared_ptr< IsolateGroupSource > source, void *embedder_data, Dart_IsolateFlags api_flags, bool is_vm_isolate)
 
 ~IsolateGroup ()
 
void RehashConstants (Become *become)
 
IsolateGroupSourcesource () const
 
std::shared_ptr< IsolateGroupSourceshareable_source () const
 
bool is_vm_isolate () const
 
void * embedder_data () const
 
bool initial_spawn_successful ()
 
void set_initial_spawn_successful ()
 
Heapheap () const
 
BackgroundCompilerbackground_compiler () const
 
intptr_t optimization_counter_threshold () const
 
GroupDebuggerdebugger () const
 
IdleTimeHandleridle_time_handler ()
 
void RegisterIsolate (Isolate *isolate)
 
void UnregisterIsolate (Isolate *isolate)
 
bool UnregisterIsolateDecrementCount ()
 
bool ContainsOnlyOneIsolate ()
 
void RunWithLockedGroup (std::function< void()> fun)
 
void ScheduleInterrupts (uword interrupt_bits)
 
ThreadRegistrythread_registry () const
 
SafepointHandlersafepoint_handler ()
 
void CreateHeap (bool is_vm_isolate, bool is_service_or_kernel_isolate)
 
void SetupImagePage (const uint8_t *snapshot_buffer, bool is_executable)
 
void Shutdown ()
 
 ISOLATE_GROUP_METRIC_LIST (ISOLATE_METRIC_ACCESSOR)
 
void UpdateLastAllocationProfileAccumulatorResetTimestamp ()
 
int64_t last_allocationprofile_accumulator_reset_timestamp () const
 
void UpdateLastAllocationProfileGCTimestamp ()
 
int64_t last_allocationprofile_gc_timestamp () const
 
DispatchTabledispatch_table () const
 
void set_dispatch_table (DispatchTable *table)
 
const uint8_t * dispatch_table_snapshot () const
 
void set_dispatch_table_snapshot (const uint8_t *snapshot)
 
intptr_t dispatch_table_snapshot_size () const
 
void set_dispatch_table_snapshot_size (intptr_t size)
 
ClassTableAllocatorclass_table_allocator ()
 
ClassPtr * cached_class_table_table ()
 
void set_cached_class_table_table (ClassPtr *cached_class_table_table)
 
void set_object_store (ObjectStore *object_store)
 
void set_obfuscation_map (const char **map)
 
const char ** obfuscation_map () const
 
Randomrandom ()
 
bool is_system_isolate_group () const
 
void FlagsCopyTo (Dart_IsolateFlags *api_flags)
 
void FlagsCopyFrom (const Dart_IsolateFlags &api_flags)
 
bool should_load_vmservice () const
 
void set_should_load_vmservice (bool value)
 
void set_asserts (bool value)
 
void set_branch_coverage (bool value)
 
void set_coverage (bool value)
 
bool HasAttemptedReload () const
 
void SetHasAttemptedReload (bool value)
 
void MaybeIncreaseReloadEveryNStackOverflowChecks ()
 
intptr_t reload_every_n_stack_overflow_checks () const
 
void set_use_osr (bool use_osr)
 
ClassTableclass_table () const
 
ClassTableheap_walk_class_table () const
 
void CloneClassTableForReload ()
 
void RestoreOriginalClassTable ()
 
void DropOriginalClassTable ()
 
StoreBufferstore_buffer () const
 
ObjectStoreobject_store () const
 
Mutexsymbols_mutex ()
 
Mutextype_canonicalization_mutex ()
 
Mutextype_arguments_canonicalization_mutex ()
 
Mutexsubtype_test_cache_mutex ()
 
Mutexmegamorphic_table_mutex ()
 
Mutextype_feedback_mutex ()
 
Mutexpatchable_call_mutex ()
 
Mutexconstant_canonicalization_mutex ()
 
Mutexkernel_data_lib_cache_mutex ()
 
Mutexkernel_data_class_cache_mutex ()
 
Mutexkernel_constants_mutex ()
 
Mutexinitializer_functions_mutex ()
 
SafepointRwLockprogram_lock ()
 
void IncreaseMutatorCount (Isolate *mutator, bool is_nested_reenter)
 
void DecreaseMutatorCount (Isolate *mutator, bool is_nested_exit)
 
intptr_t MutatorCount () const
 
bool HasTagHandler () const
 
ObjectPtr CallTagHandler (Dart_LibraryTag tag, const Object &arg1, const Object &arg2)
 
Dart_LibraryTagHandler library_tag_handler () const
 
void set_library_tag_handler (Dart_LibraryTagHandler handler)
 
Dart_DeferredLoadHandler deferred_load_handler () const
 
void set_deferred_load_handler (Dart_DeferredLoadHandler handler)
 
void ReleaseStoreBuffers ()
 
void FlushMarkingStacks ()
 
void EnableIncrementalBarrier (MarkingStack *old_marking_stack, MarkingStack *new_marking_stack, MarkingStack *deferred_marking_stack)
 
void DisableIncrementalBarrier ()
 
MarkingStackold_marking_stack () const
 
MarkingStacknew_marking_stack () const
 
MarkingStackdeferred_marking_stack () const
 
void ForEachIsolate (std::function< void(Isolate *isolate)> function, bool at_safepoint=false)
 
IsolateFirstIsolate () const
 
IsolateFirstIsolateLocked () const
 
void RunWithStoppedMutatorsCallable (Callable *single_current_mutator, Callable *otherwise, bool use_force_growth_in_otherwise=false)
 
template<typename T , typename S >
void RunWithStoppedMutators (T single_current_mutator, S otherwise, bool use_force_growth_in_otherwise=false)
 
template<typename T >
void RunWithStoppedMutators (T function, bool use_force_growth=false)
 
void PrintJSON (JSONStream *stream, bool ref=true)
 
void PrintToJSONObject (JSONObject *jsobj, bool ref)
 
void PrintMemoryUsageJSON (JSONStream *stream)
 
bool ReloadSources (JSONStream *js, bool force_reload, const char *root_script_url=nullptr, const char *packages_url=nullptr, bool dont_delete_reload_context=false)
 
bool ReloadKernel (JSONStream *js, bool force_reload, const uint8_t *kernel_buffer=nullptr, intptr_t kernel_buffer_size=0, bool dont_delete_reload_context=false)
 
void set_last_reload_timestamp (int64_t value)
 
int64_t last_reload_timestamp () const
 
IsolateGroupReloadContextreload_context ()
 
ProgramReloadContextprogram_reload_context ()
 
void DeleteReloadContext ()
 
bool CanReload ()
 
bool IsReloading () const
 
Becomebecome () const
 
void set_become (Become *become)
 
uint64_t id () const
 
int64_t UptimeMicros () const
 
ApiStateapi_state () const
 
void VisitObjectPointers (ObjectPointerVisitor *visitor, ValidationPolicy validate_frames)
 
void VisitSharedPointers (ObjectPointerVisitor *visitor)
 
void VisitStackPointers (ObjectPointerVisitor *visitor, ValidationPolicy validate_frames)
 
void VisitObjectIdRingPointers (ObjectPointerVisitor *visitor)
 
void VisitWeakPersistentHandles (HandleVisitor *visitor)
 
bool all_classes_finalized () const
 
void set_all_classes_finalized (bool value)
 
bool has_dynamically_extendable_classes () const
 
void set_has_dynamically_extendable_classes (bool value)
 
bool remapping_cids () const
 
void set_remapping_cids (bool value)
 
void RememberLiveTemporaries ()
 
void DeferredMarkLiveTemporaries ()
 
ArrayPtr saved_unlinked_calls () const
 
void set_saved_unlinked_calls (const Array &saved_unlinked_calls)
 
FieldTableinitial_field_table () const
 
std::shared_ptr< FieldTableinitial_field_table_shareable ()
 
void set_initial_field_table (std::shared_ptr< FieldTable > field_table)
 
FieldTableshared_initial_field_table () const
 
std::shared_ptr< FieldTableshared_initial_field_table_shareable ()
 
void set_shared_initial_field_table (std::shared_ptr< FieldTable > field_table)
 
FieldTableshared_field_table () const
 
std::shared_ptr< FieldTableshared_field_table_shareable ()
 
void set_shared_field_table (Thread *T, FieldTable *shared_field_table)
 
MutatorThreadPoolthread_pool ()
 
void RegisterClass (const Class &cls)
 
void RegisterSharedStaticField (const Field &field, const Object &initial_value)
 
void RegisterStaticField (const Field &field, const Object &initial_value)
 
void FreeStaticField (const Field &field)
 
IsolateEnterTemporaryIsolate ()
 
void SetNativeAssetsCallbacks (NativeAssetsApi *native_assets_api)
 
NativeAssetsApinative_assets_api ()
 
- Public Member Functions inherited from dart::IntrusiveDListEntry< IsolateGroup >
 IntrusiveDListEntry ()
 
 ~IntrusiveDListEntry ()
 

Static Public Member Functions

static intptr_t class_table_offset ()
 
static intptr_t cached_class_table_table_offset ()
 
static intptr_t object_store_offset ()
 
static void FlagsInitialize (Dart_IsolateFlags *api_flags)
 
static IsolateGroupCurrent ()
 
static void Init ()
 
static void Cleanup ()
 
static void ForEach (std::function< void(IsolateGroup *)> action)
 
static void RunWithIsolateGroup (uint64_t id, std::function< void(IsolateGroup *)> action, std::function< void()> not_found)
 
static void RegisterIsolateGroup (IsolateGroup *isolate_group)
 
static void UnregisterIsolateGroup (IsolateGroup *isolate_group)
 
static bool HasApplicationIsolateGroups ()
 
static bool HasOnlyVMIsolateGroup ()
 
static bool IsSystemIsolateGroup (const IsolateGroup *group)
 
static void ExitTemporaryIsolate ()
 

Friends

class Dart
 
class Heap
 
class StackFrame
 
class Isolate
 

Detailed Description

Definition at line 268 of file isolate.h.

Constructor & Destructor Documentation

◆ IsolateGroup() [1/2]

dart::IsolateGroup::IsolateGroup ( std::shared_ptr< IsolateGroupSource source,
void *  embedder_data,
ObjectStore object_store,
Dart_IsolateFlags  api_flags,
bool  is_vm_isolate 
)

Definition at line 325 of file isolate.cc.

330 : class_table_(nullptr),
331 cached_class_table_table_(nullptr),
332 object_store_(object_store),
333 class_table_allocator_(),
334 is_vm_isolate_(is_vm_isolate),
335 embedder_data_(embedder_data),
336 thread_pool_(),
337 isolates_lock_(new SafepointRwLock()),
338 isolates_(),
339 start_time_micros_(OS::GetCurrentMonotonicMicros()),
340 is_system_isolate_group_(source->flags.is_system_isolate),
341 random_(),
342#if !defined(PRODUCT) && !defined(DART_PRECOMPILED_RUNTIME)
343 last_reload_timestamp_(OS::GetCurrentTimeMillis()),
344 reload_every_n_stack_overflow_checks_(FLAG_reload_every),
345#endif
346 source_(std::move(source)),
347 api_state_(new ApiState()),
348 thread_registry_(new ThreadRegistry()),
349 safepoint_handler_(new SafepointHandler(this)),
350 store_buffer_(new StoreBuffer()),
351 heap_(nullptr),
352 saved_unlinked_calls_(Array::null()),
353 initial_field_table_(new FieldTable(/*isolate=*/nullptr)),
354 shared_initial_field_table_(new FieldTable(/*isolate=*/nullptr,
355 /*isolate_group=*/nullptr)),
356 shared_field_table_(new FieldTable(/*isolate=*/nullptr, this)),
357#if !defined(DART_PRECOMPILED_RUNTIME)
358 background_compiler_(new BackgroundCompiler(this)),
359#endif
360 symbols_mutex_(NOT_IN_PRODUCT("IsolateGroup::symbols_mutex_")),
361 type_canonicalization_mutex_(
362 NOT_IN_PRODUCT("IsolateGroup::type_canonicalization_mutex_")),
363 type_arguments_canonicalization_mutex_(NOT_IN_PRODUCT(
364 "IsolateGroup::type_arguments_canonicalization_mutex_")),
365 subtype_test_cache_mutex_(
366 NOT_IN_PRODUCT("IsolateGroup::subtype_test_cache_mutex_")),
367 megamorphic_table_mutex_(
368 NOT_IN_PRODUCT("IsolateGroup::megamorphic_table_mutex_")),
369 type_feedback_mutex_(
370 NOT_IN_PRODUCT("IsolateGroup::type_feedback_mutex_")),
371 patchable_call_mutex_(
372 NOT_IN_PRODUCT("IsolateGroup::patchable_call_mutex_")),
373 constant_canonicalization_mutex_(
374 NOT_IN_PRODUCT("IsolateGroup::constant_canonicalization_mutex_")),
375 kernel_data_lib_cache_mutex_(
376 NOT_IN_PRODUCT("IsolateGroup::kernel_data_lib_cache_mutex_")),
377 kernel_data_class_cache_mutex_(
378 NOT_IN_PRODUCT("IsolateGroup::kernel_data_class_cache_mutex_")),
379 kernel_constants_mutex_(
380 NOT_IN_PRODUCT("IsolateGroup::kernel_constants_mutex_")),
381 field_list_mutex_(NOT_IN_PRODUCT("Isolate::field_list_mutex_")),
382 boxed_field_list_(GrowableObjectArray::null()),
383 program_lock_(new SafepointRwLock()),
384 active_mutators_monitor_(new Monitor()),
385 max_active_mutators_(Scavenger::MaxMutatorThreadCount())
386#if !defined(PRODUCT)
387 ,
388 debugger_(new GroupDebugger(this))
389#endif
390{
391 FlagsCopyFrom(api_flags);
392 if (!is_vm_isolate) {
393 thread_pool_.reset(
394 new MutatorThreadPool(this, FLAG_disable_thread_pool_limit
395 ? 0
397 }
398 {
399 WriteRwLocker wl(ThreadState::Current(), isolate_groups_rwlock_);
400 // Keep isolate IDs less than 2^53 so web clients of the service
401 // protocol can process it properly.
402 //
403 // See https://github.com/dart-lang/sdk/issues/53081.
404 id_ = isolate_group_random_->NextJSInt();
405 }
406 heap_walk_class_table_ = class_table_ =
407 new ClassTable(&class_table_allocator_);
408 cached_class_table_table_.store(class_table_->table());
409 memset(&native_assets_api_, 0, sizeof(NativeAssetsApi));
410}
void store(T arg, std::memory_order order=std::memory_order_release)
Definition: atomic.h:104
Dart_IsolateFlags flags
Definition: isolate.h:197
void * embedder_data() const
Definition: isolate.h:291
void FlagsCopyFrom(const Dart_IsolateFlags &api_flags)
Definition: isolate.cc:1622
ObjectStore * object_store() const
Definition: isolate.h:510
IsolateGroupSource * source() const
Definition: isolate.h:286
bool is_vm_isolate() const
Definition: isolate.h:290
static int64_t GetCurrentTimeMillis()
static int64_t GetCurrentMonotonicMicros()
static ObjectPtr null()
Definition: object.h:433
uint64_t NextJSInt()
Definition: random.h:37
static intptr_t MaxMutatorThreadCount()
Definition: scavenger.h:228
static ThreadState * Current()
Definition: thread_state.h:27
bool is_system_isolate
Definition: dart_api.h:592

◆ IsolateGroup() [2/2]

dart::IsolateGroup::IsolateGroup ( std::shared_ptr< IsolateGroupSource source,
void *  embedder_data,
Dart_IsolateFlags  api_flags,
bool  is_vm_isolate 
)

Definition at line 412 of file isolate.cc.

418 new ObjectStore(),
419 api_flags,
421 if (object_store() != nullptr) {
423 }
424}
IsolateGroup(std::shared_ptr< IsolateGroupSource > source, void *embedder_data, ObjectStore *object_store, Dart_IsolateFlags api_flags, bool is_vm_isolate)
Definition: isolate.cc:325

◆ ~IsolateGroup()

dart::IsolateGroup::~IsolateGroup ( )

Definition at line 426 of file isolate.cc.

426 {
427 // Ensure we destroy the heap before the other members.
428 heap_ = nullptr;
429 ASSERT(old_marking_stack_ == nullptr);
430 ASSERT(new_marking_stack_ == nullptr);
431 ASSERT(deferred_marking_stack_ == nullptr);
432
433 if (obfuscation_map_ != nullptr) {
434 for (intptr_t i = 0; obfuscation_map_[i] != nullptr; i++) {
435 delete[] obfuscation_map_[i];
436 }
437 delete[] obfuscation_map_;
438 }
439
440 class_table_allocator_.Free(class_table_);
441 if (heap_walk_class_table_ != class_table_) {
442 class_table_allocator_.Free(heap_walk_class_table_);
443 }
444
445#if !defined(PRODUCT)
446 delete debugger_;
447 debugger_ = nullptr;
448#endif
449}
void Free(ClassTable *table)
Definition: class_table.cc:395
#define ASSERT(E)

Member Function Documentation

◆ all_classes_finalized()

bool dart::IsolateGroup::all_classes_finalized ( ) const
inline

Definition at line 713 of file isolate.h.

713 {
714 return AllClassesFinalizedBit::decode(isolate_group_flags_);
715 }
static DecodeResult decode(std::string path)
Definition: png_codec.cpp:124

◆ api_state()

ApiState * dart::IsolateGroup::api_state ( ) const
inline

Definition at line 700 of file isolate.h.

700{ return api_state_.get(); }

◆ background_compiler()

BackgroundCompiler * dart::IsolateGroup::background_compiler ( ) const
inline

Definition at line 298 of file isolate.h.

298 {
299#if defined(DART_PRECOMPILED_RUNTIME)
300 return nullptr;
301#else
302 return background_compiler_.get();
303#endif
304 }

◆ become()

Become * dart::IsolateGroup::become ( ) const
inline

Definition at line 677 of file isolate.h.

677{ return become_; }

◆ cached_class_table_table()

ClassPtr * dart::IsolateGroup::cached_class_table_table ( )
inline

Definition at line 390 of file isolate.h.

390 {
391 return cached_class_table_table_.load();
392 }
T load(std::memory_order order=std::memory_order_acquire) const
Definition: atomic.h:101

◆ cached_class_table_table_offset()

static intptr_t dart::IsolateGroup::cached_class_table_table_offset ( )
inlinestatic

Definition at line 396 of file isolate.h.

396 {
397 COMPILE_ASSERT(sizeof(IsolateGroup::cached_class_table_table_) ==
398 kWordSize);
399 return OFFSET_OF(IsolateGroup, cached_class_table_table_);
400 }
constexpr intptr_t kWordSize
Definition: globals.h:509
COMPILE_ASSERT(kUnreachableReference==WeakTable::kNoValue)
#define OFFSET_OF(type, field)
Definition: globals.h:138

◆ CallTagHandler()

ObjectPtr dart::IsolateGroup::CallTagHandler ( Dart_LibraryTag  tag,
const Object arg1,
const Object arg2 
)

Definition at line 1925 of file isolate.cc.

1927 {
1928 Thread* thread = Thread::Current();
1929 Api::Scope api_scope(thread);
1930 Dart_Handle api_arg1 = Api::NewHandle(thread, arg1.ptr());
1931 Dart_Handle api_arg2 = Api::NewHandle(thread, arg2.ptr());
1932 Dart_Handle api_result;
1933 {
1934 TransitionVMToNative transition(thread);
1936 api_result = library_tag_handler()(tag, api_arg1, api_arg2);
1937 }
1938 return Api::UnwrapHandle(api_result);
1939}
static Dart_Handle NewHandle(Thread *thread, ObjectPtr raw)
static ObjectPtr UnwrapHandle(Dart_Handle object)
Dart_LibraryTagHandler library_tag_handler() const
Definition: isolate.h:555
bool HasTagHandler() const
Definition: isolate.h:551
static Thread * Current()
Definition: thread.h:362
struct _Dart_Handle * Dart_Handle
Definition: dart_api.h:258

◆ CanReload()

bool dart::IsolateGroup::CanReload ( )

Definition at line 2042 of file isolate.cc.

2042 {
2043 // We only call this method on the mutator thread. Normally the caller is
2044 // inside of the "reloadSources" service OOB message handler. Though
2045 // we also use it in the slow path of StackOverflowCheck in the artificial
2046 // --hot-reload-test-mode like flags.
2047 //
2048 // During reload itself we don't process OOB messages and don't execute Dart
2049 // code, so the caller should implicitly have a guarantee we're not reloading
2050 // already.
2051 RELEASE_ASSERT(!Thread::Current()->OwnsReloadSafepoint());
2052
2053 // We only allow reload to take place from the point on where the first
2054 // isolate within an isolate group has setup it's root library. From that
2055 // point on it's safe to perform hot-reload.
2056 auto thread = Thread::Current();
2057 if (object_store()->root_library() == Library::null()) {
2058 return false;
2059 }
2060
2061 // We only care about the current thread's [NoReloadScope]. If we're inside
2062 // one we cannot reload right now. Though if another isolate's mutator
2063 // thread is inside such a scope, the multi-isolate reload will simply wait
2064 // until it's out of that scope again.
2065 if (thread->no_reload_scope_depth_ != 0) {
2066 return false;
2067 }
2068
2069 return !IsolateGroup::IsSystemIsolateGroup(this) &&
2071}
#define RELEASE_ASSERT(cond)
Definition: assert.h:327
static bool IsSystemIsolateGroup(const IsolateGroup *group)
Definition: isolate.cc:3605
bool HasStackHeadroom()
Definition: os_thread.h:132
static OSThread * Current()
Definition: os_thread.h:179
constexpr intptr_t KB
Definition: globals.h:528

◆ class_table()

ClassTable * dart::IsolateGroup::class_table ( ) const
inline

Definition at line 496 of file isolate.h.

496{ return class_table_; }

◆ class_table_allocator()

ClassTableAllocator * dart::IsolateGroup::class_table_allocator ( )
inline

Definition at line 381 of file isolate.h.

381 {
382 return &class_table_allocator_;
383 }

◆ class_table_offset()

static intptr_t dart::IsolateGroup::class_table_offset ( )
inlinestatic

Definition at line 385 of file isolate.h.

385 {
386 COMPILE_ASSERT(sizeof(IsolateGroup::class_table_) == kWordSize);
387 return OFFSET_OF(IsolateGroup, class_table_);
388 }

◆ Cleanup()

void dart::IsolateGroup::Cleanup ( )
static

Definition at line 742 of file isolate.cc.

742 {
743 delete isolate_group_random_;
744 isolate_group_random_ = nullptr;
745 delete isolate_groups_rwlock_;
746 isolate_groups_rwlock_ = nullptr;
747 ASSERT(isolate_groups_->IsEmpty());
748 delete isolate_groups_;
749 isolate_groups_ = nullptr;
750}

◆ CloneClassTableForReload()

void dart::IsolateGroup::CloneClassTableForReload ( )

Definition at line 3817 of file isolate.cc.

3817 {
3818 RELEASE_ASSERT(class_table_ == heap_walk_class_table_);
3819 class_table_ = class_table_->Clone();
3821}
ClassTable * Clone() const
Definition: class_table.h:360
void set_cached_class_table_table(ClassPtr *cached_class_table_table)
Definition: isolate.h:393

◆ constant_canonicalization_mutex()

Mutex * dart::IsolateGroup::constant_canonicalization_mutex ( )
inline

Definition at line 520 of file isolate.h.

520 {
521 return &constant_canonicalization_mutex_;
522 }

◆ ContainsOnlyOneIsolate()

bool dart::IsolateGroup::ContainsOnlyOneIsolate ( )

Definition at line 458 of file isolate.cc.

458 {
459 SafepointReadRwLocker ml(Thread::Current(), isolates_lock_.get());
460 // We do allow 0 here as well, because the background compiler might call
461 // this method while the mutator thread is in shutdown procedure and
462 // unregistered itself already.
463 return isolate_count_ == 0 || isolate_count_ == 1;
464}

◆ CreateHeap()

void dart::IsolateGroup::CreateHeap ( bool  is_vm_isolate,
bool  is_service_or_kernel_isolate 
)

Definition at line 482 of file isolate.cc.

483 {
486 ? 0 // New gen size 0; VM isolate should only allocate in old.
487 : FLAG_new_gen_semi_max_size * MBInWords,
488 (is_service_or_kernel_isolate ? kDefaultMaxOldGenHeapSize
489 : FLAG_old_gen_heap_size) *
490 MBInWords);
491
492#define ISOLATE_GROUP_METRIC_CONSTRUCTORS(type, variable, name, unit) \
493 metric_##variable##_.InitInstance(this, name, nullptr, Metric::unit);
495#undef ISOLATE_GROUP_METRIC_CONSTRUCTORS
496}
static void Init(IsolateGroup *isolate_group, bool is_vm_isolate, intptr_t max_new_gen_words, intptr_t max_old_gen_words)
Definition: heap.cc:704
ISOLATE_GROUP_METRIC_LIST(ISOLATE_METRIC_ACCESSOR)
constexpr intptr_t MBInWords
Definition: globals.h:537
const intptr_t kDefaultMaxOldGenHeapSize
Definition: globals.h:62
#define ISOLATE_GROUP_METRIC_CONSTRUCTORS(type, variable, name, unit)

◆ Current()

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

Definition at line 539 of file isolate.h.

539 {
540 Thread* thread = Thread::Current();
541 return thread == nullptr ? nullptr : thread->isolate_group();
542 }

◆ debugger()

GroupDebugger * dart::IsolateGroup::debugger ( ) const
inline

Definition at line 315 of file isolate.h.

315{ return debugger_; }

◆ DecreaseMutatorCount()

void dart::IsolateGroup::DecreaseMutatorCount ( Isolate mutator,
bool  is_nested_exit 
)

Definition at line 618 of file isolate.cc.

618 {
619 ASSERT(mutator->group() == this);
620
621 // If the mutator thread has an active stack and runs on our thread pool we
622 // will mark the worker as blocked, thereby possibly spawning a new worker for
623 // pending tasks (if there are any).
624 if (is_nested_exit) {
625 ASSERT(mutator->mutator_thread() != nullptr);
627 }
628
629 {
630 // NOTE: This is performance critical code, we should avoid monitors and use
631 // std::atomics in the fast case (where active_mutators <
632 // max_active_mutators) and only use monitors in the uncommon case.
633 MonitorLocker ml(active_mutators_monitor_.get());
634 ASSERT(active_mutators_ <= max_active_mutators_);
635 active_mutators_--;
636 if (waiting_mutators_ > 0) {
637 ml.Notify();
638 }
639 }
640}
MutatorThreadPool * thread_pool()
Definition: isolate.h:769
void MarkCurrentWorkerAsBlocked()
Definition: thread_pool.cc:105

◆ deferred_load_handler()

Dart_DeferredLoadHandler dart::IsolateGroup::deferred_load_handler ( ) const
inline

Definition at line 561 of file isolate.h.

561 {
562 return deferred_load_handler_;
563 }

◆ deferred_marking_stack()

MarkingStack * dart::IsolateGroup::deferred_marking_stack ( ) const
inline

Definition at line 578 of file isolate.h.

578 {
579 return deferred_marking_stack_;
580 }

◆ DeferredMarkLiveTemporaries()

void dart::IsolateGroup::DeferredMarkLiveTemporaries ( )

Definition at line 3002 of file isolate.cc.

3002 {
3004 [&](Isolate* isolate) { isolate->DeferredMarkLiveTemporaries(); },
3005 /*at_safepoint=*/true);
3006}
void ForEachIsolate(std::function< void(Isolate *isolate)> function, bool at_safepoint=false)
Definition: isolate.cc:2841
friend class Isolate
Definition: isolate.h:790

◆ DeleteReloadContext()

void dart::IsolateGroup::DeleteReloadContext ( )

Definition at line 2131 of file isolate.cc.

2131 {
2132 GcSafepointOperationScope safepoint_scope(Thread::Current());
2133 group_reload_context_.reset();
2134
2135 delete program_reload_context_;
2136 program_reload_context_ = nullptr;
2137}

◆ DisableIncrementalBarrier()

void dart::IsolateGroup::DisableIncrementalBarrier ( )

Definition at line 2831 of file isolate.cc.

2831 {
2833 ASSERT(old_marking_stack_ != nullptr);
2834 old_marking_stack_ = nullptr;
2835 ASSERT(new_marking_stack_ != nullptr);
2836 new_marking_stack_ = nullptr;
2837 ASSERT(deferred_marking_stack_ != nullptr);
2838 deferred_marking_stack_ = nullptr;
2839}
ThreadRegistry * thread_registry() const
Definition: isolate.h:333

◆ dispatch_table()

DispatchTable * dart::IsolateGroup::dispatch_table ( ) const
inline

Definition at line 364 of file isolate.h.

364{ return dispatch_table_.get(); }

◆ dispatch_table_snapshot()

const uint8_t * dart::IsolateGroup::dispatch_table_snapshot ( ) const
inline

Definition at line 368 of file isolate.h.

368 {
369 return dispatch_table_snapshot_;
370 }

◆ dispatch_table_snapshot_size()

intptr_t dart::IsolateGroup::dispatch_table_snapshot_size ( ) const
inline

Definition at line 374 of file isolate.h.

374 {
375 return dispatch_table_snapshot_size_;
376 }

◆ DropOriginalClassTable()

void dart::IsolateGroup::DropOriginalClassTable ( )

Definition at line 3830 of file isolate.cc.

3830 {
3831 RELEASE_ASSERT(class_table_ != heap_walk_class_table_);
3832 class_table_allocator_.Free(heap_walk_class_table_);
3833 heap_walk_class_table_ = class_table_;
3834 set_cached_class_table_table(class_table_->table());
3835}

◆ embedder_data()

void * dart::IsolateGroup::embedder_data ( ) const
inline

Definition at line 291 of file isolate.h.

291{ return embedder_data_; }

◆ EnableIncrementalBarrier()

void dart::IsolateGroup::EnableIncrementalBarrier ( MarkingStack old_marking_stack,
MarkingStack new_marking_stack,
MarkingStack deferred_marking_stack 
)

Definition at line 2817 of file isolate.cc.

2820 {
2821 ASSERT(old_marking_stack_ == nullptr);
2822 old_marking_stack_ = old_marking_stack;
2823 ASSERT(new_marking_stack_ == nullptr);
2824 new_marking_stack_ = new_marking_stack;
2825 ASSERT(deferred_marking_stack_ == nullptr);
2826 deferred_marking_stack_ = deferred_marking_stack;
2828 ASSERT(Thread::Current()->is_marking());
2829}
MarkingStack * deferred_marking_stack() const
Definition: isolate.h:578
MarkingStack * old_marking_stack() const
Definition: isolate.h:576
MarkingStack * new_marking_stack() const
Definition: isolate.h:577

◆ EnterTemporaryIsolate()

Isolate * dart::IsolateGroup::EnterTemporaryIsolate ( )

Definition at line 871 of file isolate.cc.

871 {
874 Isolate* const isolate = Isolate::InitIsolate("temp", this, flags);
875 ASSERT(isolate != nullptr);
876 ASSERT(Isolate::Current() == isolate);
877 return isolate;
878}
static Isolate * Current()
Definition: isolate.h:986
static void FlagsInitialize(Dart_IsolateFlags *api_flags)
Definition: isolate.cc:1648
FlutterSemanticsFlag flags

◆ ExitTemporaryIsolate()

void dart::IsolateGroup::ExitTemporaryIsolate ( )
static

Definition at line 880 of file isolate.cc.

880 {
881 Thread* thread = Thread::Current();
882 ASSERT(thread != nullptr);
883 thread->set_execution_state(Thread::kThreadInVM);
884 Dart::ShutdownIsolate(thread);
885}
static void ShutdownIsolate(Thread *T)
Definition: dart.cc:1123

◆ FirstIsolate()

Isolate * dart::IsolateGroup::FirstIsolate ( ) const

Definition at line 2869 of file isolate.cc.

2869 {
2870 SafepointReadRwLocker ml(Thread::Current(), isolates_lock_.get());
2871 return FirstIsolateLocked();
2872}
Isolate * FirstIsolateLocked() const
Definition: isolate.cc:2874

◆ FirstIsolateLocked()

Isolate * dart::IsolateGroup::FirstIsolateLocked ( ) const

Definition at line 2874 of file isolate.cc.

2874 {
2875 return isolates_.IsEmpty() ? nullptr : isolates_.First();
2876}

◆ FlagsCopyFrom()

void dart::IsolateGroup::FlagsCopyFrom ( const Dart_IsolateFlags api_flags)

Definition at line 1622 of file isolate.cc.

1622 {
1623#if defined(DART_PRECOMPILER)
1624#define FLAG_FOR_PRECOMPILER(action) action
1625#else
1626#define FLAG_FOR_PRECOMPILER(action)
1627#endif
1628
1629#if !defined(PRODUCT)
1630#define FLAG_FOR_NONPRODUCT(action) action
1631#else
1632#define FLAG_FOR_NONPRODUCT(action)
1633#endif
1634
1635#define FLAG_FOR_PRODUCT(action) action
1636
1637#define SET_FROM_FLAG(when, name, bitname, isolate_flag, flag) \
1638 FLAG_FOR_##when(isolate_group_flags_ = bitname##Bit::update( \
1639 api_flags.isolate_flag, isolate_group_flags_));
1640
1642#undef FLAG_FOR_NONPRODUCT
1643#undef FLAG_FOR_PRECOMPILER
1644#undef FLAG_FOR_PRODUCT
1645#undef SET_FROM_FLAG
1646}
#define BOOL_ISOLATE_GROUP_FLAG_LIST(V)
Definition: isolate.h:136
#define SET_FROM_FLAG(when, name, bitname, isolate_flag, flag)

◆ FlagsCopyTo()

void dart::IsolateGroup::FlagsCopyTo ( Dart_IsolateFlags api_flags)

Definition at line 1611 of file isolate.cc.

1611 {
1613#define INIT_FROM_FIELD(when, name, bitname, isolate_flag, flag) \
1614 api_flags->isolate_flag = name();
1616#undef INIT_FROM_FIELD
1617 api_flags->is_service_isolate = false;
1618 api_flags->is_kernel_isolate = false;
1619 api_flags->null_safety = true;
1620}
#define DART_FLAGS_CURRENT_VERSION
Definition: dart_api.h:582
bool is_service_isolate
Definition: dart_api.h:593
int32_t version
Definition: dart_api.h:585
bool is_kernel_isolate
Definition: dart_api.h:594
#define INIT_FROM_FIELD(when, name, bitname, isolate_flag, flag)

◆ FlagsInitialize()

void dart::IsolateGroup::FlagsInitialize ( Dart_IsolateFlags api_flags)
static

Definition at line 1600 of file isolate.cc.

1600 {
1602#define INIT_FROM_FLAG(when, name, bitname, isolate_flag, flag) \
1603 api_flags->isolate_flag = flag;
1605#undef INIT_FROM_FLAG
1606 api_flags->is_service_isolate = false;
1607 api_flags->is_kernel_isolate = false;
1608 api_flags->null_safety = true;
1609}
#define INIT_FROM_FLAG(when, name, bitname, isolate_flag, flag)

◆ FlushMarkingStacks()

void dart::IsolateGroup::FlushMarkingStacks ( )

Definition at line 2780 of file isolate.cc.

2780 {
2782}

◆ ForEach()

void dart::IsolateGroup::ForEach ( std::function< void(IsolateGroup *)>  action)
static

Definition at line 683 of file isolate.cc.

683 {
684 ReadRwLocker wl(Thread::Current(), isolate_groups_rwlock_);
685 for (auto isolate_group : *isolate_groups_) {
686 action(isolate_group);
687 }
688}

◆ ForEachIsolate()

void dart::IsolateGroup::ForEachIsolate ( std::function< void(Isolate *isolate)>  function,
bool  at_safepoint = false 
)

Definition at line 2841 of file isolate.cc.

2843 {
2844 auto thread = Thread::Current();
2845 if (at_safepoint) {
2846 ASSERT(thread->OwnsSafepoint() ||
2847 (thread->task_kind() == Thread::kMutatorTask) ||
2848 (thread->task_kind() == Thread::kMarkerTask) ||
2849 (thread->task_kind() == Thread::kCompactorTask) ||
2850 (thread->task_kind() == Thread::kScavengerTask) ||
2851 (thread->task_kind() == Thread::kIncrementalCompactorTask));
2852 for (Isolate* isolate : isolates_) {
2853 function(isolate);
2854 }
2855 return;
2856 }
2857 if (thread != nullptr && thread->OwnsSafepoint()) {
2858 for (Isolate* isolate : isolates_) {
2859 function(isolate);
2860 }
2861 return;
2862 }
2863 SafepointReadRwLocker ml(thread, isolates_lock_.get());
2864 for (Isolate* isolate : isolates_) {
2865 function(isolate);
2866 }
2867}
@ kScavengerTask
Definition: thread.h:352
@ kMutatorTask
Definition: thread.h:347
@ kMarkerTask
Definition: thread.h:349
@ kIncrementalCompactorTask
Definition: thread.h:354
@ kCompactorTask
Definition: thread.h:351
Dart_NativeFunction function
Definition: fuchsia.cc:51

◆ FreeStaticField()

void dart::IsolateGroup::FreeStaticField ( const Field field)

Definition at line 848 of file isolate.cc.

848 {
849#if !defined(PRODUCT) && !defined(DART_PRECOMPILED_RUNTIME)
850 // This can only be called during hot-reload.
851 ASSERT(program_reload_context() != nullptr);
852#endif
853
854 const intptr_t field_id = field.field_id();
855 if (field.is_shared()) {
856 shared_field_table()->Free(field_id);
857 } else {
858 initial_field_table()->Free(field_id);
859 ForEachIsolate([&](Isolate* isolate) {
860 auto field_table = isolate->field_table();
861 // The isolate might've just been created and is now participating in
862 // the reload request inside `IsolateGroup::RegisterIsolate()`.
863 // At that point it doesn't have the field table setup yet.
864 if (field_table->IsReadyToUse()) {
865 field_table->Free(field_id);
866 }
867 });
868 }
869}
void Free(intptr_t index)
Definition: field_table.cc:86
FieldTable * initial_field_table() const
Definition: isolate.h:742
FieldTable * shared_field_table() const
Definition: isolate.h:760
ProgramReloadContext * program_reload_context()
Definition: isolate.h:659

◆ has_dynamically_extendable_classes()

bool dart::IsolateGroup::has_dynamically_extendable_classes ( ) const
inline

Definition at line 720 of file isolate.h.

720 {
721 return HasDynamicallyExtendableClassesBit::decode(isolate_group_flags_);
722 }

◆ HasApplicationIsolateGroups()

bool dart::IsolateGroup::HasApplicationIsolateGroups ( )
static

Definition at line 714 of file isolate.cc.

714 {
715 ReadRwLocker wl(ThreadState::Current(), isolate_groups_rwlock_);
716 for (auto group : *isolate_groups_) {
718 return true;
719 }
720 }
721 return false;
722}

◆ HasAttemptedReload()

bool dart::IsolateGroup::HasAttemptedReload ( ) const
inline

Definition at line 469 of file isolate.h.

469 {
470 return HasAttemptedReloadBit::decode(isolate_group_flags_);
471 }

◆ HasOnlyVMIsolateGroup()

bool dart::IsolateGroup::HasOnlyVMIsolateGroup ( )
static

Definition at line 724 of file isolate.cc.

724 {
725 ReadRwLocker wl(ThreadState::Current(), isolate_groups_rwlock_);
726 for (auto group : *isolate_groups_) {
727 if (!group->is_vm_isolate()) {
728 return false;
729 }
730 }
731 return true;
732}

◆ HasTagHandler()

bool dart::IsolateGroup::HasTagHandler ( ) const
inline

Definition at line 551 of file isolate.h.

551{ return library_tag_handler() != nullptr; }

◆ heap()

Heap * dart::IsolateGroup::heap ( ) const
inline

Definition at line 296 of file isolate.h.

296{ return heap_.get(); }

◆ heap_walk_class_table()

ClassTable * dart::IsolateGroup::heap_walk_class_table ( ) const
inline

Definition at line 503 of file isolate.h.

503{ return heap_walk_class_table_; }

◆ id()

uint64_t dart::IsolateGroup::id ( ) const
inline

Definition at line 680 of file isolate.h.

680{ return id_; }

◆ idle_time_handler()

IdleTimeHandler * dart::IsolateGroup::idle_time_handler ( )
inline

Definition at line 318 of file isolate.h.

318{ return &idle_time_handler_; }

◆ IncreaseMutatorCount()

void dart::IsolateGroup::IncreaseMutatorCount ( Isolate mutator,
bool  is_nested_reenter 
)

Definition at line 590 of file isolate.cc.

591 {
592 ASSERT(mutator->group() == this);
593
594 // If the mutator was temporarily blocked on a worker thread, we have to
595 // unblock the worker thread again.
596 if (is_nested_reenter) {
597 ASSERT(mutator->mutator_thread() != nullptr);
599 }
600
601 // Prevent too many mutators from entering the isolate group to avoid
602 // pathological behavior where many threads are fighting for obtaining TLABs.
603 {
604 // NOTE: This is performance critical code, we should avoid monitors and use
605 // std::atomics in the fast case (where active_mutators <
606 // max_active_mutators) and only use monitors in the uncommon case.
607 MonitorLocker ml(active_mutators_monitor_.get());
608 ASSERT(active_mutators_ <= max_active_mutators_);
609 while (active_mutators_ == max_active_mutators_) {
610 waiting_mutators_++;
611 ml.Wait();
612 waiting_mutators_--;
613 }
614 active_mutators_++;
615 }
616}
void MarkCurrentWorkerAsUnBlocked()
Definition: thread_pool.cc:131

◆ Init()

void dart::IsolateGroup::Init ( )
static

Definition at line 734 of file isolate.cc.

734 {
735 ASSERT(isolate_groups_rwlock_ == nullptr);
736 isolate_groups_rwlock_ = new RwLock();
737 ASSERT(isolate_groups_ == nullptr);
738 isolate_groups_ = new IntrusiveDList<IsolateGroup>();
739 isolate_group_random_ = new Random();
740}

◆ initial_field_table()

FieldTable * dart::IsolateGroup::initial_field_table ( ) const
inline

Definition at line 742 of file isolate.h.

742{ return initial_field_table_.get(); }

◆ initial_field_table_shareable()

std::shared_ptr< FieldTable > dart::IsolateGroup::initial_field_table_shareable ( )
inline

Definition at line 743 of file isolate.h.

743 {
744 return initial_field_table_;
745 }

◆ initial_spawn_successful()

bool dart::IsolateGroup::initial_spawn_successful ( )
inline

Definition at line 293 of file isolate.h.

293{ return initial_spawn_successful_; }

◆ initializer_functions_mutex()

Mutex * dart::IsolateGroup::initializer_functions_mutex ( )
inline

Definition at line 534 of file isolate.h.

534{ return &initializer_functions_mutex_; }

◆ is_system_isolate_group()

bool dart::IsolateGroup::is_system_isolate_group ( ) const
inline

Definition at line 413 of file isolate.h.

413{ return is_system_isolate_group_; }

◆ is_vm_isolate()

bool dart::IsolateGroup::is_vm_isolate ( ) const
inline

Definition at line 290 of file isolate.h.

290{ return is_vm_isolate_; }

◆ ISOLATE_GROUP_METRIC_LIST()

dart::IsolateGroup::ISOLATE_GROUP_METRIC_LIST ( ISOLATE_METRIC_ACCESSOR  )

◆ IsReloading()

bool dart::IsolateGroup::IsReloading ( ) const
inline

Definition at line 669 of file isolate.h.

669 {
670#if !defined(PRODUCT) && !defined(DART_PRECOMPILED_RUNTIME)
671 return group_reload_context_ != nullptr;
672#else
673 return false;
674#endif
675 }

◆ IsSystemIsolateGroup()

bool dart::IsolateGroup::IsSystemIsolateGroup ( const IsolateGroup group)
static

Definition at line 3605 of file isolate.cc.

3605 {
3606 return group->source()->flags.is_system_isolate;
3607}

◆ kernel_constants_mutex()

Mutex * dart::IsolateGroup::kernel_constants_mutex ( )
inline

Definition at line 527 of file isolate.h.

527{ return &kernel_constants_mutex_; }

◆ kernel_data_class_cache_mutex()

Mutex * dart::IsolateGroup::kernel_data_class_cache_mutex ( )
inline

Definition at line 524 of file isolate.h.

524 {
525 return &kernel_data_class_cache_mutex_;
526 }

◆ kernel_data_lib_cache_mutex()

Mutex * dart::IsolateGroup::kernel_data_lib_cache_mutex ( )
inline

Definition at line 523 of file isolate.h.

523{ return &kernel_data_lib_cache_mutex_; }

◆ last_allocationprofile_accumulator_reset_timestamp()

int64_t dart::IsolateGroup::last_allocationprofile_accumulator_reset_timestamp ( ) const
inline

Definition at line 351 of file isolate.h.

351 {
352 return last_allocationprofile_accumulator_reset_timestamp_;
353 }

◆ last_allocationprofile_gc_timestamp()

int64_t dart::IsolateGroup::last_allocationprofile_gc_timestamp ( ) const
inline

Definition at line 359 of file isolate.h.

359 {
360 return last_allocationprofile_gc_timestamp_;
361 }

◆ last_reload_timestamp()

int64_t dart::IsolateGroup::last_reload_timestamp ( ) const
inline

Definition at line 654 of file isolate.h.

654{ return last_reload_timestamp_; }

◆ library_tag_handler()

Dart_LibraryTagHandler dart::IsolateGroup::library_tag_handler ( ) const
inline

Definition at line 555 of file isolate.h.

555 {
556 return library_tag_handler_;
557 }

◆ MaybeIncreaseReloadEveryNStackOverflowChecks()

void dart::IsolateGroup::MaybeIncreaseReloadEveryNStackOverflowChecks ( )

Definition at line 2532 of file isolate.cc.

2532 {
2533 if (FLAG_reload_every_back_off) {
2534 if (reload_every_n_stack_overflow_checks_ < 5000) {
2535 reload_every_n_stack_overflow_checks_ += 99;
2536 } else {
2537 const auto old_value = reload_every_n_stack_overflow_checks_;
2538 reload_every_n_stack_overflow_checks_ = old_value * old_value;
2539 }
2540 // Cap the value.
2541 if (reload_every_n_stack_overflow_checks_ > 1000000) {
2542 reload_every_n_stack_overflow_checks_ = 1000000;
2543 }
2544 }
2545}

◆ megamorphic_table_mutex()

Mutex * dart::IsolateGroup::megamorphic_table_mutex ( )
inline

Definition at line 517 of file isolate.h.

517{ return &megamorphic_table_mutex_; }

◆ MutatorCount()

intptr_t dart::IsolateGroup::MutatorCount ( ) const
inline

Definition at line 546 of file isolate.h.

546 {
547 MonitorLocker ml(active_mutators_monitor_.get());
548 return active_mutators_;
549 }

◆ native_assets_api()

NativeAssetsApi * dart::IsolateGroup::native_assets_api ( )
inline

Definition at line 783 of file isolate.h.

783{ return &native_assets_api_; }

◆ new_marking_stack()

MarkingStack * dart::IsolateGroup::new_marking_stack ( ) const
inline

Definition at line 577 of file isolate.h.

577{ return new_marking_stack_; }

◆ obfuscation_map()

const char ** dart::IsolateGroup::obfuscation_map ( ) const
inline

Definition at line 409 of file isolate.h.

409{ return obfuscation_map_; }

◆ object_store()

ObjectStore * dart::IsolateGroup::object_store ( ) const
inline

Definition at line 510 of file isolate.h.

510{ return object_store_.get(); }

◆ object_store_offset()

static intptr_t dart::IsolateGroup::object_store_offset ( )
inlinestatic

Definition at line 403 of file isolate.h.

403 {
404 COMPILE_ASSERT(sizeof(IsolateGroup::object_store_) == kWordSize);
405 return OFFSET_OF(IsolateGroup, object_store_);
406 }

◆ old_marking_stack()

MarkingStack * dart::IsolateGroup::old_marking_stack ( ) const
inline

Definition at line 576 of file isolate.h.

576{ return old_marking_stack_; }

◆ optimization_counter_threshold()

intptr_t dart::IsolateGroup::optimization_counter_threshold ( ) const
inline

Definition at line 306 of file isolate.h.

306 {
307 if (IsSystemIsolateGroup(this)) {
309 }
310 return FLAG_optimization_counter_threshold;
311 }
constexpr intptr_t kDefaultOptimizationCounterThreshold
Definition: flag_list.h:23

◆ patchable_call_mutex()

Mutex * dart::IsolateGroup::patchable_call_mutex ( )
inline

Definition at line 519 of file isolate.h.

519{ return &patchable_call_mutex_; }

◆ PrintJSON()

void dart::IsolateGroup::PrintJSON ( JSONStream stream,
bool  ref = true 
)

Definition at line 643 of file isolate.cc.

643 {
644 JSONObject jsobj(stream);
645 PrintToJSONObject(&jsobj, ref);
646}
void PrintToJSONObject(JSONObject *jsobj, bool ref)
Definition: isolate.cc:648

◆ PrintMemoryUsageJSON()

void dart::IsolateGroup::PrintMemoryUsageJSON ( JSONStream stream)

Definition at line 668 of file isolate.cc.

668 {
669 int64_t used = heap()->TotalUsedInWords();
670 int64_t capacity = heap()->TotalCapacityInWords();
671 int64_t external_used = heap()->TotalExternalInWords();
672
673 JSONObject jsobj(stream);
674 // This is the same "MemoryUsage" that the isolate-specific "getMemoryUsage"
675 // rpc method returns.
676 jsobj.AddProperty("type", "MemoryUsage");
677 jsobj.AddProperty64("heapUsage", used * kWordSize);
678 jsobj.AddProperty64("heapCapacity", capacity * kWordSize);
679 jsobj.AddProperty64("externalUsage", external_used * kWordSize);
680}
intptr_t TotalExternalInWords() const
Definition: heap.cc:824
intptr_t TotalCapacityInWords() const
Definition: heap.cc:820
intptr_t TotalUsedInWords() const
Definition: heap.cc:816
Heap * heap() const
Definition: isolate.h:296

◆ PrintToJSONObject()

void dart::IsolateGroup::PrintToJSONObject ( JSONObject jsobj,
bool  ref 
)

Definition at line 648 of file isolate.cc.

648 {
649 jsobj->AddProperty("type", (ref ? "@IsolateGroup" : "IsolateGroup"));
650 jsobj->AddServiceId(ISOLATE_GROUP_SERVICE_ID_FORMAT_STRING, id());
651
652 jsobj->AddProperty("name", source()->script_uri);
653 jsobj->AddPropertyF("number", "%" Pu64 "", id());
654 jsobj->AddProperty("isSystemIsolateGroup", is_system_isolate_group());
655 if (ref) {
656 return;
657 }
658
659 {
660 JSONArray isolate_array(jsobj, "isolates");
661 for (auto it = isolates_.Begin(); it != isolates_.End(); ++it) {
662 Isolate* isolate = *it;
663 isolate_array.AddValue(isolate, /*ref=*/true);
664 }
665 }
666}
bool is_system_isolate_group() const
Definition: isolate.h:413
#define Pu64
Definition: globals.h:417
#define ISOLATE_GROUP_SERVICE_ID_FORMAT_STRING
Definition: service.h:50

◆ program_lock()

SafepointRwLock * dart::IsolateGroup::program_lock ( )
inline

Definition at line 537 of file isolate.h.

537{ return program_lock_.get(); }

◆ program_reload_context()

ProgramReloadContext * dart::IsolateGroup::program_reload_context ( )
inline

Definition at line 659 of file isolate.h.

659 {
660 return program_reload_context_;
661 }

◆ random()

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

Definition at line 411 of file isolate.h.

411{ return &random_; }

◆ RegisterClass()

void dart::IsolateGroup::RegisterClass ( const Class cls)

Definition at line 769 of file isolate.cc.

769 {
770#if !defined(PRODUCT) && !defined(DART_PRECOMPILED_RUNTIME)
771 if (IsReloading()) {
772 program_reload_context()->RegisterClass(cls);
773 return;
774 }
775#endif // !defined(PRODUCT) && !defined(DART_PRECOMPILED_RUNTIME)
776 if (cls.IsTopLevel()) {
778 } else {
779 class_table()->Register(cls);
780 }
781}
void Register(const Class &cls)
Definition: class_table.cc:65
void RegisterTopLevel(const Class &cls)
Definition: class_table.cc:92
ClassTable * class_table() const
Definition: isolate.h:496
bool IsReloading() const
Definition: isolate.h:669

◆ RegisterIsolate()

void dart::IsolateGroup::RegisterIsolate ( Isolate isolate)

Definition at line 451 of file isolate.cc.

451 {
452 SafepointWriteRwLocker ml(Thread::Current(), isolates_lock_.get());
453 ASSERT(isolates_lock_->IsCurrentThreadWriter());
454 isolates_.Append(isolate);
455 isolate_count_++;
456}

◆ RegisterIsolateGroup()

void dart::IsolateGroup::RegisterIsolateGroup ( IsolateGroup isolate_group)
static

Definition at line 704 of file isolate.cc.

704 {
705 WriteRwLocker wl(ThreadState::Current(), isolate_groups_rwlock_);
706 isolate_groups_->Append(isolate_group);
707}

◆ RegisterSharedStaticField()

void dart::IsolateGroup::RegisterSharedStaticField ( const Field field,
const Object initial_value 
)

Definition at line 789 of file isolate.cc.

790 {
791 const bool need_to_grow_backing_store =
793 const intptr_t field_id = field.field_id();
794 shared_initial_field_table()->SetAt(field_id, initial_value.ptr());
795
796 if (need_to_grow_backing_store) {
797 // We have to stop other isolates from accessing shared isolate group
798 // field state, since we'll have to grow the backing store.
799 GcSafepointOperationScope scope(Thread::Current());
800 const bool need_to_grow_other_backing_store =
801 shared_field_table()->Register(field, field_id);
802 ASSERT(need_to_grow_other_backing_store);
803 } else {
804 const bool need_to_grow_other_backing_store =
805 shared_field_table()->Register(field, field_id);
806 ASSERT(!need_to_grow_other_backing_store);
807 }
808 shared_field_table()->SetAt(field_id, initial_value.ptr());
809}
bool Register(const Field &field, intptr_t expected_field_id=-1)
Definition: field_table.cc:55
void SetAt(intptr_t index, ObjectPtr raw_instance, bool concurrent_use=false)
Definition: field_table.h:76
FieldTable * shared_initial_field_table() const
Definition: isolate.h:750

◆ RegisterStaticField()

void dart::IsolateGroup::RegisterStaticField ( const Field field,
const Object initial_value 
)

Definition at line 811 of file isolate.cc.

812 {
813 ASSERT(program_lock()->IsCurrentThreadWriter());
814
815 ASSERT(field.is_static());
816 if (field.is_shared()) {
817 RegisterSharedStaticField(field, initial_value);
818 return;
819 }
820 const bool need_to_grow_backing_store =
822 const intptr_t field_id = field.field_id();
823 initial_field_table()->SetAt(field_id, initial_value.ptr());
824
825 SafepointReadRwLocker ml(Thread::Current(), isolates_lock_.get());
826 if (need_to_grow_backing_store) {
827 // We have to stop other isolates from accessing their field state, since
828 // we'll have to grow the backing store.
829 GcSafepointOperationScope scope(Thread::Current());
830 for (auto isolate : isolates_) {
831 auto field_table = isolate->field_table();
832 if (field_table->IsReadyToUse()) {
833 field_table->Register(field, field_id);
834 field_table->SetAt(field_id, initial_value.ptr());
835 }
836 }
837 } else {
838 for (auto isolate : isolates_) {
839 auto field_table = isolate->field_table();
840 if (field_table->IsReadyToUse()) {
841 field_table->Register(field, field_id);
842 field_table->SetAt(field_id, initial_value.ptr());
843 }
844 }
845 }
846}
SafepointRwLock * program_lock()
Definition: isolate.h:537
void RegisterSharedStaticField(const Field &field, const Object &initial_value)
Definition: isolate.cc:789

◆ RehashConstants()

void dart::IsolateGroup::RehashConstants ( Become become)

Definition at line 887 of file isolate.cc.

887 {
888 // Even though no individual constant contains a cycle, there can be "cycles"
889 // between the canonical tables if some const instances of A have fields that
890 // are const instance of B and vice versa. So set all the old tables to the
891 // side and clear all the tables attached to the classes before rehashing
892 // instead of resetting and rehash one class at a time.
893
894 Thread* thread = Thread::Current();
895 StackZone stack_zone(thread);
896 Zone* zone = stack_zone.GetZone();
897
898 intptr_t num_cids = class_table()->NumCids();
899 Array** old_constant_tables = zone->Alloc<Array*>(num_cids);
900 for (intptr_t i = 0; i < num_cids; i++) {
901 old_constant_tables[i] = nullptr;
902 }
903
904 Class& cls = Class::Handle(zone);
905 for (intptr_t cid = kInstanceCid; cid < num_cids; cid++) {
906 if (!class_table()->IsValidIndex(cid) ||
907 !class_table()->HasValidClassAt(cid)) {
908 continue;
909 }
910 if ((cid == kTypeArgumentsCid) || IsStringClassId(cid)) {
911 // TypeArguments and Symbols have special tables for canonical objects
912 // that aren't based on address.
913 continue;
914 }
915 if ((cid == kMintCid) || (cid == kDoubleCid)) {
916 // Constants stored as a plain list or in a hashset with a stable
917 // hashcode, which only depends on the actual value of the constant.
918 continue;
919 }
920
921 cls = class_table()->At(cid);
922 if (cls.constants() == Array::null()) continue;
923 old_constant_tables[cid] = &Array::Handle(zone, cls.constants());
924 cls.set_constants(Object::null_array());
925 }
926
927 // Clear invalid hashes.
929
930 Instance& constant = Instance::Handle(zone);
931 Field& field = Field::Handle(zone);
932 String& name = String::Handle(zone);
933 Array& new_values = Array::Handle(zone);
934 Instance& old_value = Instance::Handle(zone);
935 Instance& new_value = Instance::Handle(zone);
936 Instance& deleted = Instance::Handle(zone);
937
938 if (become != nullptr) {
939 for (intptr_t cid = kInstanceCid; cid < num_cids; cid++) {
940 Array* old_constants = old_constant_tables[cid];
941 if (old_constants == nullptr) continue;
942
943 cls = class_table()->At(cid);
944 CanonicalInstancesSet set(zone, old_constants->ptr());
945 CanonicalInstancesSet::Iterator it(&set);
946 while (it.MoveNext()) {
947 constant ^= set.GetKey(it.Current());
948 ASSERT(!constant.IsNull());
949 ASSERT(!constant.InVMIsolateHeap());
950 constant.ClearCanonical();
951 }
952 set.Release();
953 }
954 }
955
956 for (intptr_t cid = kInstanceCid; cid < num_cids; cid++) {
957 Array* old_constants = old_constant_tables[cid];
958 if (old_constants == nullptr) continue;
959
960 cls = class_table()->At(cid);
961 CanonicalInstancesSet set(zone, old_constants->ptr());
962 CanonicalInstancesSet::Iterator it(&set);
963
964 if (cls.is_enum_class() && (become != nullptr)) {
965 field = cls.LookupStaticField(Symbols::_DeletedEnumSentinel());
966 deleted ^= field.StaticConstFieldValue();
967 if (deleted.IsNull()) {
968 deleted = Instance::New(cls, Heap::kOld);
969 field = object_store()->enum_name_field();
970 name = cls.ScrubbedName();
971 name = Symbols::FromConcat(thread, Symbols::_DeletedEnumPrefix(), name);
972 deleted.SetField(field, name);
973 field = object_store()->enum_index_field();
974 new_value = Smi::New(-1);
975 deleted.SetField(field, new_value);
976 field = cls.LookupStaticField(Symbols::_DeletedEnumSentinel());
977 // The static const field contains `Object::null()` instead of
978 // `Object::sentinel()` - so it's not considered an initializing store.
979 field.SetStaticConstFieldValue(deleted,
980 /*assert_initializing_store*/ false);
981 }
982
983 field = cls.LookupField(Symbols::Values());
984 new_values ^= field.StaticConstFieldValue();
985
986 field = object_store()->enum_name_field();
987 while (it.MoveNext()) {
988 old_value ^= set.GetKey(it.Current());
989 ASSERT(old_value.GetClassId() == cid);
990 bool found = false;
991 for (intptr_t j = 0; j < new_values.Length(); j++) {
992 new_value ^= new_values.At(j);
993 ASSERT(new_value.GetClassId() == cid);
994 if (old_value.GetField(field) == new_value.GetField(field)) {
995 found = true;
996 break;
997 }
998 }
999 if (!found) {
1000 new_value = deleted.ptr();
1001 }
1002
1003 if (old_value.ptr() != new_value.ptr()) {
1004 become->Add(old_value, new_value);
1005 }
1006 if (new_value.IsCanonical()) {
1007 cls.InsertCanonicalConstant(zone, new_value);
1008 }
1009 }
1010 } else {
1011 while (it.MoveNext()) {
1012 old_value ^= set.GetKey(it.Current());
1013 ASSERT(!old_value.IsNull());
1014
1015 if (become == nullptr) {
1016 ASSERT(old_value.IsCanonical());
1017 cls.InsertCanonicalConstant(zone, old_value);
1018 } else {
1019 new_value = old_value.Canonicalize(thread);
1020 if (old_value.ptr() != new_value.ptr()) {
1021 become->Add(old_value, new_value);
1022 }
1023 }
1024 }
1025 }
1026 set.Release();
1027 }
1028
1029 // Save memory.
1031}
void Add(const Object &before, const Object &after)
Definition: become.cc:231
ClassPtr At(intptr_t cid) const
Definition: class_table.h:362
intptr_t NumCids() const
Definition: class_table.h:447
@ kOld
Definition: heap.h:39
void ResetCanonicalHashTable()
Definition: heap.cc:894
static InstancePtr New(const Class &cls, Heap::Space space=Heap::kNew)
Definition: object.cc:20935
Become * become() const
Definition: isolate.h:677
static Object & Handle()
Definition: object.h:407
static SmiPtr New(intptr_t value)
Definition: object.h:10006
static StringPtr FromConcat(Thread *thread, const String &str1, const String &str2)
Definition: symbols.cc:235
const char *const name
UnorderedHashSet< CanonicalInstanceTraits > CanonicalInstancesSet
const intptr_t cid
bool IsStringClassId(intptr_t index)
Definition: class_id.h:350
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not set
Definition: switches.h:76

◆ ReleaseStoreBuffers()

void dart::IsolateGroup::ReleaseStoreBuffers ( )

Definition at line 2776 of file isolate.cc.

2776 {
2778}

◆ reload_context()

IsolateGroupReloadContext * dart::IsolateGroup::reload_context ( )
inline

Definition at line 656 of file isolate.h.

656 {
657 return group_reload_context_.get();
658 }

◆ reload_every_n_stack_overflow_checks()

intptr_t dart::IsolateGroup::reload_every_n_stack_overflow_checks ( ) const
inline

Definition at line 477 of file isolate.h.

477 {
478 return reload_every_n_stack_overflow_checks_;
479 }

◆ ReloadKernel()

bool dart::IsolateGroup::ReloadKernel ( JSONStream js,
bool  force_reload,
const uint8_t *  kernel_buffer = nullptr,
intptr_t  kernel_buffer_size = 0,
bool  dont_delete_reload_context = false 
)

Definition at line 2102 of file isolate.cc.

2106 {
2107 ASSERT(!IsReloading());
2108
2109 // Ensure all isolates inside the isolate group are paused at a place where we
2110 // can safely do a reload.
2112
2114 std::shared_ptr<IsolateGroupReloadContext> group_reload_context(
2115 new IsolateGroupReloadContext(this, class_table, js));
2116 group_reload_context_ = group_reload_context;
2117
2119 program_reload_context_ =
2120 new ProgramReloadContext(group_reload_context_, this);
2121 const bool success = group_reload_context_->Reload(
2122 force_reload,
2123 /*root_script_url=*/nullptr,
2124 /*packages_url=*/nullptr, kernel_buffer, kernel_buffer_size);
2125 if (!dont_delete_reload_context) {
2127 }
2128 return success;
2129}
void DeleteReloadContext()
Definition: isolate.cc:2131
static IsolateGroup * Current()
Definition: isolate.h:539
void SetHasAttemptedReload(bool value)
Definition: isolate.h:472
#define RELOAD_OPERATION_SCOPE(thread_expr)

◆ ReloadSources()

bool dart::IsolateGroup::ReloadSources ( JSONStream js,
bool  force_reload,
const char *  root_script_url = nullptr,
const char *  packages_url = nullptr,
bool  dont_delete_reload_context = false 
)

Definition at line 2073 of file isolate.cc.

2077 {
2078 ASSERT(!IsReloading());
2079
2080 // Ensure all isolates inside the isolate group are paused at a place where we
2081 // can safely do a reload.
2083
2085 std::shared_ptr<IsolateGroupReloadContext> group_reload_context(
2086 new IsolateGroupReloadContext(this, class_table, js));
2087 group_reload_context_ = group_reload_context;
2088
2090 program_reload_context_ =
2091 new ProgramReloadContext(group_reload_context_, this);
2092 const bool success =
2093 group_reload_context_->Reload(force_reload, root_script_url, packages_url,
2094 /*kernel_buffer=*/nullptr,
2095 /*kernel_buffer_size=*/0);
2096 if (!dont_delete_reload_context) {
2098 }
2099 return success;
2100}

◆ remapping_cids()

bool dart::IsolateGroup::remapping_cids ( ) const
inline

Definition at line 728 of file isolate.h.

728 {
729 return RemappingCidsBit::decode(isolate_group_flags_);
730 }

◆ RememberLiveTemporaries()

void dart::IsolateGroup::RememberLiveTemporaries ( )

Definition at line 3008 of file isolate.cc.

3008 {
3009 ForEachIsolate([&](Isolate* isolate) { isolate->RememberLiveTemporaries(); },
3010 /*at_safepoint=*/true);
3011}

◆ RestoreOriginalClassTable()

void dart::IsolateGroup::RestoreOriginalClassTable ( )

Definition at line 3823 of file isolate.cc.

3823 {
3824 RELEASE_ASSERT(class_table_ != heap_walk_class_table_);
3825 class_table_allocator_.Free(class_table_);
3826 class_table_ = heap_walk_class_table_;
3827 set_cached_class_table_table(class_table_->table());
3828}

◆ RunWithIsolateGroup()

void dart::IsolateGroup::RunWithIsolateGroup ( uint64_t  id,
std::function< void(IsolateGroup *)>  action,
std::function< void()>  not_found 
)
static

Definition at line 690 of file isolate.cc.

693 {
694 ReadRwLocker wl(Thread::Current(), isolate_groups_rwlock_);
695 for (auto isolate_group : *isolate_groups_) {
696 if (isolate_group->id() == id) {
697 action(isolate_group);
698 return;
699 }
700 }
701 not_found();
702}

◆ RunWithLockedGroup()

void dart::IsolateGroup::RunWithLockedGroup ( std::function< void()>  fun)

Definition at line 466 of file isolate.cc.

466 {
467 SafepointWriteRwLocker ml(Thread::Current(), isolates_lock_.get());
468 fun();
469}

◆ RunWithStoppedMutators() [1/2]

template<typename T >
void dart::IsolateGroup::RunWithStoppedMutators ( T  function,
bool  use_force_growth = false 
)
inline

Definition at line 621 of file isolate.h.

621 {
622 LambdaCallable<T> callable(function);
623 RunWithStoppedMutatorsCallable(&callable, &callable, use_force_growth);
624 }
void RunWithStoppedMutatorsCallable(Callable *single_current_mutator, Callable *otherwise, bool use_force_growth_in_otherwise=false)
Definition: isolate.cc:2878

◆ RunWithStoppedMutators() [2/2]

template<typename T , typename S >
void dart::IsolateGroup::RunWithStoppedMutators ( T  single_current_mutator,
S  otherwise,
bool  use_force_growth_in_otherwise = false 
)
inline

Definition at line 611 of file isolate.h.

613 {
614 LambdaCallable<T> single_callable(single_current_mutator);
615 LambdaCallable<S> otherwise_callable(otherwise);
616 RunWithStoppedMutatorsCallable(&single_callable, &otherwise_callable,
617 use_force_growth_in_otherwise);
618 }

◆ RunWithStoppedMutatorsCallable()

void dart::IsolateGroup::RunWithStoppedMutatorsCallable ( Callable single_current_mutator,
Callable otherwise,
bool  use_force_growth_in_otherwise = false 
)

Definition at line 2878 of file isolate.cc.

2881 {
2882 auto thread = Thread::Current();
2883 StoppedMutatorsScope stopped_mutators_scope(thread);
2884
2885 if (thread->OwnsSafepoint()) {
2886 RELEASE_ASSERT(thread->OwnsSafepoint());
2887 single_current_mutator->Call();
2888 return;
2889 }
2890
2891 {
2892 SafepointReadRwLocker ml(thread, isolates_lock_.get());
2893 if (thread->IsDartMutatorThread() && ContainsOnlyOneIsolate()) {
2894 single_current_mutator->Call();
2895 return;
2896 }
2897 }
2898
2899 // We use the more strict safepoint operation scope here (which ensures that
2900 // all other threads, including auxiliary threads are at a safepoint), even
2901 // though we only need to ensure that the mutator threads are stopped.
2902 if (use_force_growth_in_otherwise) {
2903 ForceGrowthSafepointOperationScope safepoint_scope(
2905 otherwise->Call();
2906 } else {
2907 DeoptSafepointOperationScope safepoint_scope(thread);
2908 otherwise->Call();
2909 }
2910}
bool ContainsOnlyOneIsolate()
Definition: isolate.cc:458
@ kGCAndDeopt
Definition: thread.h:293

◆ safepoint_handler()

SafepointHandler * dart::IsolateGroup::safepoint_handler ( )
inline

Definition at line 334 of file isolate.h.

334{ return safepoint_handler_.get(); }

◆ saved_unlinked_calls()

ArrayPtr dart::IsolateGroup::saved_unlinked_calls ( ) const
inline

Definition at line 739 of file isolate.h.

739{ return saved_unlinked_calls_; }

◆ ScheduleInterrupts()

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

Definition at line 1960 of file isolate.cc.

1960 {
1961 SafepointReadRwLocker ml(Thread::Current(), isolates_lock_.get());
1962 for (Isolate* isolate : isolates_) {
1963 isolate->ScheduleInterrupts(interrupt_bits);
1964 }
1965}

◆ set_all_classes_finalized()

void dart::IsolateGroup::set_all_classes_finalized ( bool  value)
inline

Definition at line 716 of file isolate.h.

716 {
717 isolate_group_flags_ =
718 AllClassesFinalizedBit::update(value, isolate_group_flags_);
719 }
uint8_t value

◆ set_asserts()

void dart::IsolateGroup::set_asserts ( bool  value)
inline

Definition at line 453 of file isolate.h.

453 {
454 isolate_group_flags_ =
455 EnableAssertsBit::update(value, isolate_group_flags_);
456 }

◆ set_become()

void dart::IsolateGroup::set_become ( Become become)
inline

Definition at line 678 of file isolate.h.

678{ become_ = become; }

◆ set_branch_coverage()

void dart::IsolateGroup::set_branch_coverage ( bool  value)
inline

Definition at line 458 of file isolate.h.

458 {
459 isolate_group_flags_ =
460 BranchCoverageBit::update(value, isolate_group_flags_);
461 }

◆ set_cached_class_table_table()

void dart::IsolateGroup::set_cached_class_table_table ( ClassPtr *  cached_class_table_table)
inline

Definition at line 393 of file isolate.h.

393 {
394 cached_class_table_table_.store(cached_class_table_table);
395 }
ClassPtr * cached_class_table_table()
Definition: isolate.h:390

◆ set_coverage()

void dart::IsolateGroup::set_coverage ( bool  value)
inline

Definition at line 463 of file isolate.h.

463 {
464 isolate_group_flags_ = CoverageBit::update(value, isolate_group_flags_);
465 }

◆ set_deferred_load_handler()

void dart::IsolateGroup::set_deferred_load_handler ( Dart_DeferredLoadHandler  handler)
inline

Definition at line 564 of file isolate.h.

564 {
565 deferred_load_handler_ = handler;
566 }

◆ set_dispatch_table()

void dart::IsolateGroup::set_dispatch_table ( DispatchTable table)
inline

Definition at line 365 of file isolate.h.

365 {
366 dispatch_table_.reset(table);
367 }
SI F table(const skcms_Curve *curve, F v)

◆ set_dispatch_table_snapshot()

void dart::IsolateGroup::set_dispatch_table_snapshot ( const uint8_t *  snapshot)
inline

Definition at line 371 of file isolate.h.

371 {
372 dispatch_table_snapshot_ = snapshot;
373 }

◆ set_dispatch_table_snapshot_size()

void dart::IsolateGroup::set_dispatch_table_snapshot_size ( intptr_t  size)
inline

Definition at line 377 of file isolate.h.

377 {
378 dispatch_table_snapshot_size_ = size;
379 }
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition: switches.h:259

◆ set_has_dynamically_extendable_classes()

void dart::IsolateGroup::set_has_dynamically_extendable_classes ( bool  value)
inline

Definition at line 723 of file isolate.h.

723 {
724 isolate_group_flags_ =
725 HasDynamicallyExtendableClassesBit::update(value, isolate_group_flags_);
726 }

◆ set_initial_field_table()

void dart::IsolateGroup::set_initial_field_table ( std::shared_ptr< FieldTable field_table)
inline

Definition at line 746 of file isolate.h.

746 {
747 initial_field_table_ = field_table;
748 }

◆ set_initial_spawn_successful()

void dart::IsolateGroup::set_initial_spawn_successful ( )
inline

Definition at line 294 of file isolate.h.

294{ initial_spawn_successful_ = true; }

◆ set_last_reload_timestamp()

void dart::IsolateGroup::set_last_reload_timestamp ( int64_t  value)
inline

Definition at line 651 of file isolate.h.

651 {
652 last_reload_timestamp_ = value;
653 }

◆ set_library_tag_handler()

void dart::IsolateGroup::set_library_tag_handler ( Dart_LibraryTagHandler  handler)
inline

Definition at line 558 of file isolate.h.

558 {
559 library_tag_handler_ = handler;
560 }

◆ set_obfuscation_map()

void dart::IsolateGroup::set_obfuscation_map ( const char **  map)
inline

Definition at line 408 of file isolate.h.

408{ obfuscation_map_ = map; }
SI auto map(std::index_sequence< I... >, Fn &&fn, const Args &... args) -> skvx::Vec< sizeof...(I), decltype(fn(args[0]...))>
Definition: SkVx.h:680

◆ set_object_store()

void dart::IsolateGroup::set_object_store ( ObjectStore object_store)

Definition at line 1072 of file isolate.cc.

1072 {
1073 object_store_.reset(object_store);
1074}

◆ set_remapping_cids()

void dart::IsolateGroup::set_remapping_cids ( bool  value)
inline

Definition at line 731 of file isolate.h.

731 {
732 isolate_group_flags_ =
733 RemappingCidsBit::update(value, isolate_group_flags_);
734 }

◆ set_saved_unlinked_calls()

void dart::IsolateGroup::set_saved_unlinked_calls ( const Array saved_unlinked_calls)

Definition at line 586 of file isolate.cc.

586 {
587 saved_unlinked_calls_ = saved_unlinked_calls.ptr();
588}
ArrayPtr saved_unlinked_calls() const
Definition: isolate.h:739

◆ set_shared_field_table()

void dart::IsolateGroup::set_shared_field_table ( Thread T,
FieldTable shared_field_table 
)
inline

Definition at line 764 of file isolate.h.

764 {
765 shared_field_table_.reset(shared_field_table);
766 T->shared_field_table_values_ = shared_field_table->table();
767 }
ObjectPtr * table()
Definition: field_table.h:43
#define T
Definition: precompiler.cc:65

◆ set_shared_initial_field_table()

void dart::IsolateGroup::set_shared_initial_field_table ( std::shared_ptr< FieldTable field_table)
inline

Definition at line 756 of file isolate.h.

756 {
757 shared_initial_field_table_ = field_table;
758 }

◆ set_should_load_vmservice()

void dart::IsolateGroup::set_should_load_vmservice ( bool  value)
inline

Definition at line 448 of file isolate.h.

448 {
449 isolate_group_flags_ =
450 ShouldLoadVmServiceBit::update(value, isolate_group_flags_);
451 }

◆ set_use_osr()

void dart::IsolateGroup::set_use_osr ( bool  use_osr)
inline

Definition at line 488 of file isolate.h.

488 {
489 isolate_group_flags_ = UseOsrBit::update(use_osr, isolate_group_flags_);
490 }

◆ SetHasAttemptedReload()

void dart::IsolateGroup::SetHasAttemptedReload ( bool  value)
inline

Definition at line 472 of file isolate.h.

472 {
473 isolate_group_flags_ =
474 HasAttemptedReloadBit::update(value, isolate_group_flags_);
475 }

◆ SetNativeAssetsCallbacks()

void dart::IsolateGroup::SetNativeAssetsCallbacks ( NativeAssetsApi native_assets_api)
inline

Definition at line 780 of file isolate.h.

780 {
781 native_assets_api_ = *native_assets_api;
782 }
NativeAssetsApi * native_assets_api()
Definition: isolate.h:783

◆ SetupImagePage()

void dart::IsolateGroup::SetupImagePage ( const uint8_t *  snapshot_buffer,
bool  is_executable 
)

Definition at line 1953 of file isolate.cc.

1954 {
1955 Image image(image_buffer);
1956 heap()->SetupImagePage(image.object_start(), image.object_size(),
1957 is_executable);
1958}
void SetupImagePage(void *pointer, uword size, bool is_executable)
Definition: heap.h:276
sk_sp< const SkImage > image
Definition: SkRecords.h:269
CanvasImage Image
Definition: dart_ui.cc:55

◆ shareable_source()

std::shared_ptr< IsolateGroupSource > dart::IsolateGroup::shareable_source ( ) const
inline

Definition at line 287 of file isolate.h.

287 {
288 return source_;
289 }

◆ shared_field_table()

FieldTable * dart::IsolateGroup::shared_field_table ( ) const
inline

Definition at line 760 of file isolate.h.

760{ return shared_field_table_.get(); }

◆ shared_field_table_shareable()

std::shared_ptr< FieldTable > dart::IsolateGroup::shared_field_table_shareable ( )
inline

Definition at line 761 of file isolate.h.

761 {
762 return shared_field_table_;
763 }

◆ shared_initial_field_table()

FieldTable * dart::IsolateGroup::shared_initial_field_table ( ) const
inline

Definition at line 750 of file isolate.h.

750 {
751 return shared_initial_field_table_.get();
752 }

◆ shared_initial_field_table_shareable()

std::shared_ptr< FieldTable > dart::IsolateGroup::shared_initial_field_table_shareable ( )
inline

Definition at line 753 of file isolate.h.

753 {
754 return shared_initial_field_table_;
755 }

◆ should_load_vmservice()

bool dart::IsolateGroup::should_load_vmservice ( ) const
inline

Definition at line 445 of file isolate.h.

445 {
446 return ShouldLoadVmServiceBit::decode(isolate_group_flags_);
447 }

◆ Shutdown()

void dart::IsolateGroup::Shutdown ( )

Definition at line 498 of file isolate.cc.

498 {
499 char* name = nullptr;
500 // We retrieve the flag value once to avoid the compiler complaining about the
501 // possibly uninitialized value of name, as the compiler is unaware that when
502 // the flag variable is non-const, it is set once during VM initialization and
503 // never changed after, and that modification never runs concurrently with
504 // this method.
505 const bool trace_shutdown = FLAG_trace_shutdown;
506
507 if (trace_shutdown) {
509 OS::PrintErr("[+%" Pd64 "ms] SHUTDOWN: Shutdown starting for group %s\n",
511 }
512 // Ensure to join all threads before waiting for pending GC tasks (the thread
513 // pool can trigger idle notification, which can start new GC tasks).
514 //
515 // (The vm-isolate doesn't have a thread pool.)
516 if (!is_vm_isolate_) {
517 ASSERT(thread_pool_ != nullptr);
518 thread_pool_->Shutdown();
519 thread_pool_.reset();
520 }
521
522 // Needs to happen before starting to destroy the heap so helper tasks like
523 // the SampleBlockProcessor don't try to enter the group during this
524 // tear-down.
526
527 // Wait for any pending GC tasks.
528 if (heap_ != nullptr) {
529 // Wait for any concurrent GC tasks to finish before shutting down.
530 // TODO(rmacnak): Interrupt tasks for faster shutdown.
531 PageSpace* old_space = heap_->old_space();
532 MonitorLocker ml(old_space->tasks_lock());
533 while (old_space->tasks() > 0) {
534 ml.Wait();
535 }
536 // Needs to happen before ~PageSpace so TLS and the thread registry are
537 // still valid.
538 old_space->AbandonMarkingForShutdown();
539 }
540
541 // If the creation of the isolate group (or the first isolate within the
542 // isolate group) failed, we do not invoke the cleanup callback (the
543 // embedder is responsible for handling the creation error).
544 if (initial_spawn_successful_ && !is_vm_isolate_) {
545 auto group_shutdown_callback = Isolate::GroupCleanupCallback();
546 if (group_shutdown_callback != nullptr) {
547 group_shutdown_callback(embedder_data());
548 }
549 }
550
551 delete this;
552
553 // After this isolate group has died we might need to notify a pending
554 // `Dart_Cleanup()` call.
555 {
556 if (trace_shutdown) {
557 OS::PrintErr("[+%" Pd64
558 "ms] SHUTDOWN: Notifying "
559 "isolate group shutdown (%s)\n",
561 }
562 MonitorLocker ml(Isolate::isolate_creation_monitor_);
563 if (!Isolate::creation_enabled_ &&
565 ml.Notify();
566 }
567 if (trace_shutdown) {
568 OS::PrintErr("[+%" Pd64
569 "ms] SHUTDOWN: Done Notifying "
570 "isolate group shutdown (%s)\n",
572 }
573 }
574 if (trace_shutdown) {
575 OS::PrintErr("[+%" Pd64 "ms] SHUTDOWN: Done shutdown for group %s\n",
577 free(name);
578 }
579}
static int64_t UptimeMillis()
Definition: dart.h:76
static bool HasApplicationIsolateGroups()
Definition: isolate.cc:714
static void UnregisterIsolateGroup(IsolateGroup *isolate_group)
Definition: isolate.cc:709
static Dart_IsolateGroupCleanupCallback GroupCleanupCallback()
Definition: isolate.h:1231
static void static void PrintErr(const char *format,...) PRINTF_ATTRIBUTE(1
static char * StrDup(const char *s)
#define Pd64
Definition: globals.h:416

◆ source()

IsolateGroupSource * dart::IsolateGroup::source ( ) const
inline

Definition at line 286 of file isolate.h.

286{ return source_.get(); }

◆ store_buffer()

StoreBuffer * dart::IsolateGroup::store_buffer ( ) const
inline

Definition at line 509 of file isolate.h.

509{ return store_buffer_.get(); }

◆ subtype_test_cache_mutex()

Mutex * dart::IsolateGroup::subtype_test_cache_mutex ( )
inline

Definition at line 516 of file isolate.h.

516{ return &subtype_test_cache_mutex_; }

◆ symbols_mutex()

Mutex * dart::IsolateGroup::symbols_mutex ( )
inline

Definition at line 511 of file isolate.h.

511{ return &symbols_mutex_; }

◆ thread_pool()

MutatorThreadPool * dart::IsolateGroup::thread_pool ( )
inline

Definition at line 769 of file isolate.h.

769{ return thread_pool_.get(); }

◆ thread_registry()

ThreadRegistry * dart::IsolateGroup::thread_registry ( ) const
inline

Definition at line 333 of file isolate.h.

333{ return thread_registry_.get(); }

◆ type_arguments_canonicalization_mutex()

Mutex * dart::IsolateGroup::type_arguments_canonicalization_mutex ( )
inline

Definition at line 513 of file isolate.h.

513 {
514 return &type_arguments_canonicalization_mutex_;
515 }

◆ type_canonicalization_mutex()

Mutex * dart::IsolateGroup::type_canonicalization_mutex ( )
inline

Definition at line 512 of file isolate.h.

512{ return &type_canonicalization_mutex_; }

◆ type_feedback_mutex()

Mutex * dart::IsolateGroup::type_feedback_mutex ( )
inline

Definition at line 518 of file isolate.h.

518{ return &type_feedback_mutex_; }

◆ UnregisterIsolate()

void dart::IsolateGroup::UnregisterIsolate ( Isolate isolate)

Definition at line 471 of file isolate.cc.

471 {
472 SafepointWriteRwLocker ml(Thread::Current(), isolates_lock_.get());
473 isolates_.Remove(isolate);
474}

◆ UnregisterIsolateDecrementCount()

bool dart::IsolateGroup::UnregisterIsolateDecrementCount ( )

Definition at line 476 of file isolate.cc.

476 {
477 SafepointWriteRwLocker ml(Thread::Current(), isolates_lock_.get());
478 isolate_count_--;
479 return isolate_count_ == 0;
480}

◆ UnregisterIsolateGroup()

void dart::IsolateGroup::UnregisterIsolateGroup ( IsolateGroup isolate_group)
static

Definition at line 709 of file isolate.cc.

709 {
710 WriteRwLocker wl(ThreadState::Current(), isolate_groups_rwlock_);
711 isolate_groups_->Remove(isolate_group);
712}

◆ UpdateLastAllocationProfileAccumulatorResetTimestamp()

void dart::IsolateGroup::UpdateLastAllocationProfileAccumulatorResetTimestamp ( )
inline

Definition at line 346 of file isolate.h.

346 {
347 last_allocationprofile_accumulator_reset_timestamp_ =
349 }

◆ UpdateLastAllocationProfileGCTimestamp()

void dart::IsolateGroup::UpdateLastAllocationProfileGCTimestamp ( )
inline

Definition at line 355 of file isolate.h.

355 {
356 last_allocationprofile_gc_timestamp_ = OS::GetCurrentTimeMillis();
357 }

◆ UptimeMicros()

int64_t dart::IsolateGroup::UptimeMicros ( ) const

Definition at line 1982 of file isolate.cc.

1982 {
1983 return OS::GetCurrentMonotonicMicros() - start_time_micros_;
1984}

◆ VisitObjectIdRingPointers()

void dart::IsolateGroup::VisitObjectIdRingPointers ( ObjectPointerVisitor visitor)

Definition at line 2987 of file isolate.cc.

2987 {
2988#if !defined(PRODUCT)
2989 for (Isolate* isolate : isolates_) {
2990 ObjectIdRing* ring = isolate->object_id_ring();
2991 if (ring != nullptr) {
2992 ring->VisitPointers(visitor);
2993 }
2994 }
2995#endif // !defined(PRODUCT)
2996}

◆ VisitObjectPointers()

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

Definition at line 2912 of file isolate.cc.

2913 {
2914 VisitSharedPointers(visitor);
2915 for (Isolate* isolate : isolates_) {
2916 isolate->VisitObjectPointers(visitor, validate_frames);
2917 }
2918 VisitStackPointers(visitor, validate_frames);
2919}
void VisitStackPointers(ObjectPointerVisitor *visitor, ValidationPolicy validate_frames)
Definition: isolate.cc:2970
void VisitSharedPointers(ObjectPointerVisitor *visitor)
Definition: isolate.cc:2921

◆ VisitSharedPointers()

void dart::IsolateGroup::VisitSharedPointers ( ObjectPointerVisitor visitor)

Definition at line 2921 of file isolate.cc.

2921 {
2922 // Visit objects in the class table.
2923 class_table()->VisitObjectPointers(visitor);
2926 }
2928 // Visit objects in the object store.
2929 if (object_store() != nullptr) {
2931 }
2932 visitor->VisitPointer(reinterpret_cast<ObjectPtr*>(&saved_unlinked_calls_));
2936
2937 // Visit the boxed_field_list_.
2938 // 'boxed_field_list_' access via mutator and background compilation threads
2939 // is guarded with a monitor. This means that we can visit it only
2940 // when at safepoint or the field_list_mutex_ lock has been taken.
2941 visitor->VisitPointer(reinterpret_cast<ObjectPtr*>(&boxed_field_list_));
2942
2943 NOT_IN_PRECOMPILED(background_compiler()->VisitPointers(visitor));
2944
2945#if !defined(PRODUCT)
2946 if (debugger() != nullptr) {
2947 debugger()->VisitObjectPointers(visitor);
2948 }
2949#endif
2950
2951#if !defined(PRODUCT) && !defined(DART_PRECOMPILED_RUNTIME)
2952 // Visit objects that are being used for isolate reload.
2953 if (program_reload_context() != nullptr) {
2954 program_reload_context()->VisitObjectPointers(visitor);
2955 program_reload_context()->group_reload_context()->VisitObjectPointers(
2956 visitor);
2957 }
2958#endif // !defined(PRODUCT) && !defined(DART_PRECOMPILED_RUNTIME)
2959
2960 if (source()->loaded_blobs_ != nullptr) {
2961 visitor->VisitPointer(
2962 reinterpret_cast<ObjectPtr*>(&(source()->loaded_blobs_)));
2963 }
2964
2965 if (become() != nullptr) {
2966 become()->VisitObjectPointers(visitor);
2967 }
2968}
void VisitObjectPointersUnlocked(ObjectPointerVisitor *visitor)
void VisitObjectPointers(ObjectPointerVisitor *visitor)
Definition: become.cc:236
void VisitObjectPointers(ObjectPointerVisitor *visitor)
Definition: class_table.cc:127
void VisitObjectPointers(ObjectPointerVisitor *visitor)
Definition: field_table.cc:157
void VisitObjectPointers(ObjectPointerVisitor *visitor)
Definition: debugger.cc:3028
GroupDebugger * debugger() const
Definition: isolate.h:315
ApiState * api_state() const
Definition: isolate.h:700
ClassTable * heap_walk_class_table() const
Definition: isolate.h:503
BackgroundCompiler * background_compiler() const
Definition: isolate.h:298
void VisitObjectPointers(ObjectPointerVisitor *visitor)
IsolateGroupReloadContext * group_reload_context()

◆ VisitStackPointers()

void dart::IsolateGroup::VisitStackPointers ( ObjectPointerVisitor visitor,
ValidationPolicy  validate_frames 
)

Definition at line 2970 of file isolate.cc.

2971 {
2972 visitor->set_gc_root_type("stack");
2973
2974 // Visit objects in all threads (e.g. Dart stack, handles in zones), except
2975 // for the mutator threads themselves.
2976 thread_registry()->VisitObjectPointers(this, visitor, validate_frames);
2977
2978 for (Isolate* isolate : isolates_) {
2979 // Visit mutator thread, even if the isolate isn't entered/scheduled
2980 // (there might be live API handles to visit).
2981 isolate->VisitStackPointers(visitor, validate_frames);
2982 }
2983
2984 visitor->clear_gc_root_type();
2985}
void VisitObjectPointers(IsolateGroup *isolate_group_of_interest, ObjectPointerVisitor *visitor, ValidationPolicy validate_frames)

◆ VisitWeakPersistentHandles()

void dart::IsolateGroup::VisitWeakPersistentHandles ( HandleVisitor visitor)

Definition at line 2998 of file isolate.cc.

2998 {
3000}
void VisitWeakHandlesUnlocked(HandleVisitor *visitor)

Friends And Related Function Documentation

◆ Dart

friend class Dart
friend

Definition at line 786 of file isolate.h.

◆ Heap

friend class Heap
friend

Definition at line 787 of file isolate.h.

◆ Isolate

friend class Isolate
friend

Definition at line 790 of file isolate.h.

◆ StackFrame

friend class StackFrame
friend

Definition at line 788 of file isolate.h.


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