5#ifndef RUNTIME_VM_ISOLATE_H_
6#define RUNTIME_VM_ISOLATE_H_
8#if defined(SHOULD_NOT_INCLUDE_RUNTIME)
9#error "Should not include runtime"
45class BackgroundCompiler;
51class ExternalTypedData;
57class IsolateGroupReloadContext;
58class IsolateMessageHandler;
59class IsolateObjectStore;
60class IsolateProfilerData;
68class ObjectPointerVisitor;
70class PersistentHandle;
71class ProgramReloadContext;
73class SafepointHandler;
76class SampleBlockBuffer;
79class SerializedObjectBuffer;
136#define BOOL_ISOLATE_GROUP_FLAG_LIST(V) \
137 V(PRECOMPILER, obfuscate, Obfuscate, obfuscate, false) \
138 V(NONPRODUCT, asserts, EnableAsserts, enable_asserts, FLAG_enable_asserts) \
139 V(NONPRODUCT, use_field_guards, UseFieldGuards, use_field_guards, \
140 FLAG_use_field_guards) \
141 V(PRODUCT, should_load_vmservice_library, ShouldLoadVmService, \
142 load_vmservice_library, false) \
143 V(NONPRODUCT, use_osr, UseOsr, use_osr, FLAG_use_osr) \
144 V(NONPRODUCT, snapshot_is_dontneed_safe, SnapshotIsDontNeedSafe, \
145 snapshot_is_dontneed_safe, false) \
146 V(NONPRODUCT, branch_coverage, BranchCoverage, branch_coverage, \
147 FLAG_branch_coverage) \
148 V(NONPRODUCT, coverage, Coverage, coverage, FLAG_coverage)
152#define BOOL_ISOLATE_FLAG_LIST(V) \
153 V(NONPRODUCT, is_system_isolate, IsSystemIsolate, is_system_isolate, false) \
154 V(NONPRODUCT, is_service_isolate, IsServiceIsolate, is_service_isolate, \
156 V(NONPRODUCT, is_kernel_isolate, IsKernelIsolate, is_kernel_isolate, false)
237 Heap* heap_ =
nullptr;
238 intptr_t disabled_counter_ = 0;
239 int64_t idle_start_time_ = 0;
255 :
ThreadPool(max_pool_size), isolate_group_(isolate_group) {}
283 void ValidateClassTable();
299#if defined(DART_PRECOMPILED_RUNTIME)
302 return background_compiler_.get();
305#if !defined(DART_PRECOMPILED_RUNTIME)
310 return FLAG_optimization_counter_threshold;
337 void SetupImagePage(
const uint8_t* snapshot_buffer,
bool is_executable);
340#define ISOLATE_METRIC_ACCESSOR(type, variable, name, unit) \
341 type* Get##variable##Metric() { return &metric_##variable##_; }
343#undef ISOLATE_METRIC_ACCESSOR
347 last_allocationprofile_accumulator_reset_timestamp_ =
352 return last_allocationprofile_accumulator_reset_timestamp_;
360 return last_allocationprofile_gc_timestamp_;
366 dispatch_table_.reset(
table);
369 return dispatch_table_snapshot_;
372 dispatch_table_snapshot_ = snapshot;
375 return dispatch_table_snapshot_size_;
378 dispatch_table_snapshot_size_ =
size;
382 return &class_table_allocator_;
391 return cached_class_table_table_.
load();
420#if defined(DART_PRECOMPILER)
421#define FLAG_FOR_PRECOMPILER(from_field, from_flag) (from_field)
423#define FLAG_FOR_PRECOMPILER(from_field, from_flag) (from_flag)
427#define FLAG_FOR_NONPRODUCT(from_field, from_flag) (from_field)
429#define FLAG_FOR_NONPRODUCT(from_field, from_flag) (from_flag)
432#define FLAG_FOR_PRODUCT(from_field, from_flag) (from_field)
434#define DECLARE_GETTER(when, name, bitname, isolate_flag_name, flag_name) \
435 bool name() const { \
436 return FLAG_FOR_##when(bitname##Bit::decode(isolate_group_flags_), \
440#undef FLAG_FOR_NONPRODUCT
441#undef FLAG_FOR_PRECOMPILER
442#undef FLAG_FOR_PRODUCT
449 isolate_group_flags_ =
450 ShouldLoadVmServiceBit::update(
value, isolate_group_flags_);
454 isolate_group_flags_ =
455 EnableAssertsBit::update(
value, isolate_group_flags_);
459 isolate_group_flags_ =
460 BranchCoverageBit::update(
value, isolate_group_flags_);
464 isolate_group_flags_ = CoverageBit::update(
value, isolate_group_flags_);
468#if !defined(DART_PRECOMPILED_RUNTIME)
473 isolate_group_flags_ =
474 HasAttemptedReloadBit::update(
value, isolate_group_flags_);
478 return reload_every_n_stack_overflow_checks_;
489 isolate_group_flags_ = UseOsrBit::update(use_osr, isolate_group_flags_);
514 return &type_arguments_canonicalization_mutex_;
521 return &constant_canonicalization_mutex_;
525 return &kernel_data_class_cache_mutex_;
529#if defined(DART_PRECOMPILED_RUNTIME)
530 Mutex* unlinked_call_map_mutex() {
return &unlinked_call_map_mutex_; }
533#if !defined(DART_PRECOMPILED_RUNTIME)
541 return thread ==
nullptr ? nullptr : thread->
isolate_group();
548 return active_mutators_;
556 return library_tag_handler_;
559 library_tag_handler_ = handler;
562 return deferred_load_handler_;
565 deferred_load_handler_ = handler;
579 return deferred_marking_stack_;
591 bool at_safepoint =
false);
608 bool use_force_growth_in_otherwise =
false);
610 template <
typename T,
typename S>
613 bool use_force_growth_in_otherwise =
false) {
617 use_force_growth_in_otherwise);
620 template <
typename T>
635#if !defined(PRODUCT) && !defined(DART_PRECOMPILED_RUNTIME)
640 const char* root_script_url =
nullptr,
641 const char* packages_url =
nullptr,
642 bool dont_delete_reload_context =
false);
647 const uint8_t* kernel_buffer =
nullptr,
648 intptr_t kernel_buffer_size = 0,
649 bool dont_delete_reload_context =
false);
652 last_reload_timestamp_ =
value;
657 return group_reload_context_.get();
660 return program_reload_context_;
670#if !defined(PRODUCT) && !defined(DART_PRECOMPILED_RUNTIME)
671 return group_reload_context_ !=
nullptr;
680 uint64_t
id()
const {
return id_; }
717 isolate_group_flags_ =
718 AllClassesFinalizedBit::update(
value, isolate_group_flags_);
724 isolate_group_flags_ =
725 HasDynamicallyExtendableClassesBit::update(
value, isolate_group_flags_);
732 isolate_group_flags_ =
733 RemappingCidsBit::update(
value, isolate_group_flags_);
744 return initial_field_table_;
747 initial_field_table_ = field_table;
751 return shared_initial_field_table_.get();
754 return shared_initial_field_table_;
757 shared_initial_field_table_ = field_table;
762 return shared_field_table_;
773 const Object& initial_value);
792#define ISOLATE_GROUP_FLAG_BITS(V) \
793 V(AllClassesFinalized) \
795 V(HasAttemptedReload) \
797 V(ShouldLoadVmService) \
801 V(SnapshotIsDontNeedSafe) \
804 V(HasDynamicallyExtendableClasses)
808#define DECLARE_BIT(Name) k##Name##Bit,
813#define DECLARE_BITFIELD(Name) \
814 class Name##Bit : public BitField<uint32_t, bool, k##Name##Bit, 1> {};
816#undef DECLARE_BITFIELD
818 void set_heap(std::unique_ptr<Heap>
value);
821 ClassTable* class_table_;
822 AcqRelAtomic<ClassPtr*> cached_class_table_table_;
823 std::unique_ptr<ObjectStore> object_store_;
826 ClassTableAllocator class_table_allocator_;
827 ClassTable* heap_walk_class_table_;
829 const char** obfuscation_map_ =
nullptr;
831 bool is_vm_isolate_ =
false;
832 void* embedder_data_ =
nullptr;
834 IdleTimeHandler idle_time_handler_;
835 std::unique_ptr<MutatorThreadPool> thread_pool_;
836 std::unique_ptr<SafepointRwLock> isolates_lock_;
837 IntrusiveDList<Isolate> isolates_;
838 intptr_t isolate_count_ = 0;
839 bool initial_spawn_successful_ =
false;
842 int64_t start_time_micros_;
843 bool is_system_isolate_group_;
846#if !defined(PRODUCT) && !defined(DART_PRECOMPILED_RUNTIME)
847 int64_t last_reload_timestamp_;
848 std::shared_ptr<IsolateGroupReloadContext> group_reload_context_;
850 RelaxedAtomic<intptr_t> reload_every_n_stack_overflow_checks_;
851 ProgramReloadContext* program_reload_context_ =
nullptr;
853 Become* become_ =
nullptr;
855#define ISOLATE_METRIC_VARIABLE(type, variable, name, unit) \
856 type metric_##variable##_;
858#undef ISOLATE_METRIC_VARIABLE
862 int64_t last_allocationprofile_accumulator_reset_timestamp_ = 0;
863 int64_t last_allocationprofile_gc_timestamp_ = 0;
867 MarkingStack* old_marking_stack_ =
nullptr;
868 MarkingStack* new_marking_stack_ =
nullptr;
869 MarkingStack* deferred_marking_stack_ =
nullptr;
870 std::shared_ptr<IsolateGroupSource> source_;
871 std::unique_ptr<ApiState> api_state_;
872 std::unique_ptr<ThreadRegistry> thread_registry_;
873 std::unique_ptr<SafepointHandler> safepoint_handler_;
875 static RwLock* isolate_groups_rwlock_;
876 static IntrusiveDList<IsolateGroup>* isolate_groups_;
877 static Random* isolate_group_random_;
881 std::unique_ptr<StoreBuffer> store_buffer_;
882 std::unique_ptr<Heap> heap_;
883 std::unique_ptr<DispatchTable> dispatch_table_;
884 const uint8_t* dispatch_table_snapshot_ =
nullptr;
885 intptr_t dispatch_table_snapshot_size_ = 0;
886 ArrayPtr saved_unlinked_calls_;
887 std::shared_ptr<FieldTable> initial_field_table_;
888 std::shared_ptr<FieldTable> shared_initial_field_table_;
889 std::shared_ptr<FieldTable> shared_field_table_;
890 uint32_t isolate_group_flags_ = 0;
894 Mutex symbols_mutex_;
895 Mutex type_canonicalization_mutex_;
896 Mutex type_arguments_canonicalization_mutex_;
897 Mutex subtype_test_cache_mutex_;
898 Mutex megamorphic_table_mutex_;
899 Mutex type_feedback_mutex_;
900 Mutex patchable_call_mutex_;
901 Mutex constant_canonicalization_mutex_;
902 Mutex kernel_data_lib_cache_mutex_;
903 Mutex kernel_data_class_cache_mutex_;
904 Mutex kernel_constants_mutex_;
906#if defined(DART_PRECOMPILED_RUNTIME)
907 Mutex unlinked_call_map_mutex_;
910#if !defined(DART_PRECOMPILED_RUNTIME)
911 Mutex initializer_functions_mutex_;
915 Mutex field_list_mutex_;
917 GrowableObjectArrayPtr boxed_field_list_;
922 std::unique_ptr<SafepointRwLock> program_lock_;
925 std::unique_ptr<Monitor> active_mutators_monitor_;
926 intptr_t active_mutators_ = 0;
927 intptr_t waiting_mutators_ = 0;
928 intptr_t max_active_mutators_ = 0;
988 return thread ==
nullptr ? nullptr : thread->
isolate();
1002 delete field_table_;
1008 return isolate_object_store_.get();
1012 return message_notify_callback_.load(std::memory_order_relaxed);
1016 message_notify_callback_.store(
value, std::memory_order_release);
1020 on_shutdown_callback_ =
value;
1023 return on_shutdown_callback_;
1026 on_cleanup_callback_ =
value;
1029 return on_cleanup_callback_;
1033 bequest_ = std::move(bequest);
1043 const char*
name()
const {
return name_; }
1058 terminate_capability_ =
value;
1065 uint64_t capability);
1076 return environment_callback_;
1079 environment_callback_ =
value;
1095 bool is_runnable()
const {
return LoadIsolateFlagsBit<IsRunnableBit>(); }
1097 UpdateIsolateFlagsBit<IsRunnableBit>(
value);
1098#if !defined(PRODUCT)
1107#if !defined(PRODUCT)
1113 current_sample_block_ = block;
1119 return current_allocation_sample_block_;
1122 current_allocation_sample_block_ = block;
1126 return has_completed_blocks_.
exchange(0) != 0;
1129 return has_completed_blocks_.
exchange(1) == 0;
1139 has_resumption_breakpoints_ =
value;
1142 return has_resumption_breakpoints_;
1151 UpdateIsolateFlagsBit<ResumeRequestBit>(
true);
1164 return UpdateIsolateFlagsBit<ResumeRequestBit>(
false);
1186 bool ErrorsFatal()
const {
return LoadIsolateFlagsBit<ErrorsFatalBit>(); }
1188 UpdateIsolateFlagsBit<ErrorsFatalBit>(
value);
1201 create_group_callback_ = cb;
1204 return create_group_callback_;
1208 initialize_callback_ = cb;
1211 return initialize_callback_;
1215 shutdown_callback_ = cb;
1218 return shutdown_callback_;
1222 cleanup_callback_ = cb;
1225 return cleanup_callback_;
1229 cleanup_group_callback_ = cb;
1232 return cleanup_group_callback_;
1236 register_kernel_blob_callback_ = cb;
1239 return register_kernel_blob_callback_;
1243 unregister_kernel_blob_callback_ = cb;
1246 return unregister_kernel_blob_callback_;
1249#if !defined(PRODUCT)
1257 ASSERT(
value ==
nullptr || deopt_context_ ==
nullptr);
1258 deopt_context_ =
value;
1269 bool keep_isolate_alive);
1277 bool keep_isolate_alive);
1282 return ffi_callback_list_head_;
1286 ASSERT(defer_finalization_count_ >= 0);
1287 return defer_finalization_count_++;
1291 ASSERT(defer_finalization_count_ > 0);
1292 return defer_finalization_count_--;
1296 ASSERT(defer_finalization_count_ >= 0);
1297 return defer_finalization_count_ == 0;
1310#if !defined(PRODUCT)
1316#if !defined(PRODUCT)
1318 return LoadIsolateFlagsBit<ShouldPausePostServiceRequestBit>();
1321 UpdateIsolateFlagsBit<ShouldPausePostServiceRequestBit>(
value);
1336#if !defined(PRODUCT)
1337#define ISOLATE_METRIC_ACCESSOR(type, variable, name, unit) \
1338 type* Get##variable##Metric() { return &metric_##variable##_; }
1340#undef ISOLATE_METRIC_ACCESSOR
1345 GrowableObjectArrayPtr
tag_table()
const {
return tag_table_; }
1363 const String& method_name,
1364 const Array& parameter_keys,
1365 const Array& parameter_values,
1375#if !defined(PRODUCT)
1382 UpdateIsolateFlagsBit<IsVMIsolateBit>(
value);
1386 return LoadIsolateFlagsBit<IsServiceRegisteredBit>();
1389 UpdateIsolateFlagsBit<IsServiceRegisteredBit>(
value);
1397#if defined(DART_PRECOMPILER)
1398#define FLAG_FOR_PRECOMPILER(from_field, from_flag) (from_field)
1400#define FLAG_FOR_PRECOMPILER(from_field, from_flag) (from_flag)
1403#if !defined(PRODUCT)
1404#define FLAG_FOR_NONPRODUCT(from_field, from_flag) (from_field)
1406#define FLAG_FOR_NONPRODUCT(from_field, from_flag) (from_flag)
1409#define FLAG_FOR_PRODUCT(from_field, from_flag) (from_field)
1411#define DECLARE_GETTER(when, name, bitname, isolate_flag_name, flag_name) \
1412 bool name() const { \
1413 return FLAG_FOR_##when(LoadIsolateFlagsBit<bitname##Bit>(), flag_name); \
1416#undef FLAG_FOR_NONPRODUCT
1417#undef FLAG_FOR_PRECOMPILER
1418#undef FLAG_FOR_PRODUCT
1419#undef DECLARE_GETTER
1422 return LoadIsolateFlagsBit<HasAttemptedSteppingBit>();
1425 UpdateIsolateFlagsBit<HasAttemptedSteppingBit>(
value);
1453 return &catch_entry_moves_cache_;
1468 return std::move(regexp_backtracking_stack_cache_);
1472 regexp_backtracking_stack_cache_ = std::move(stack);
1480 return &pointers_to_verify_at_exit_;
1492 static void InitVM();
1493 static Isolate* InitIsolate(
const char* name_prefix,
1502 void RunAndCleanupFinalizersOnShutdown();
1503 void LowLevelShutdown();
1508 static void LowLevelCleanup(
Isolate* isolate);
1510 void BuildName(
const char* name_prefix);
1521 void set_user_tag(
uword tag) { user_tag_ = tag; }
1523 void set_is_system_isolate(
bool is_system_isolate) {
1524 is_system_isolate_ = is_system_isolate;
1527#if !defined(PRODUCT)
1528 GrowableObjectArrayPtr GetAndClearPendingServiceExtensionCalls();
1529 GrowableObjectArrayPtr pending_service_extension_calls()
const {
1530 return pending_service_extension_calls_;
1532 void set_pending_service_extension_calls(
const GrowableObjectArray&
value);
1533 GrowableObjectArrayPtr registered_service_extension_handlers()
const {
1534 return registered_service_extension_handlers_;
1536 void set_registered_service_extension_handlers(
1537 const GrowableObjectArray&
value);
1542 Zone* current_zone()
const {
1553 uword user_tag_ = 0;
1554 UserTagPtr current_tag_;
1555 UserTagPtr default_tag_;
1556 FieldTable* field_table_ =
nullptr;
1559 GrowableObjectArrayPtr finalizers_;
1560 bool single_step_ =
false;
1561 bool has_resumption_breakpoints_ =
false;
1562 bool is_system_isolate_ =
false;
1566 IdleTimeHandler idle_time_handler_;
1567 std::unique_ptr<IsolateObjectStore> isolate_object_store_;
1569#define ISOLATE_FLAG_BITS(V) \
1573 V(IsServiceIsolate) \
1574 V(IsKernelIsolate) \
1576 V(HasAttemptedStepping) \
1577 V(ShouldPausePostServiceRequest) \
1578 V(IsSystemIsolate) \
1579 V(IsServiceRegistered)
1583#define DECLARE_BIT(Name) k##Name##Bit,
1588#define DECLARE_BITFIELD(Name) \
1589 class Name##Bit : public BitField<uint32_t, bool, k##Name##Bit, 1> {};
1591#undef DECLARE_BITFIELD
1594 bool UpdateIsolateFlagsBit(
bool value) {
1596 std::memory_order_relaxed)
1597 : isolate_flags_.fetch_and(
1598 ~
T::encode(
true), std::memory_order_relaxed));
1601 bool LoadIsolateFlagsBit()
const {
1602 return T::decode(isolate_flags_.load(std::memory_order_relaxed));
1604 std::atomic<uint32_t> isolate_flags_;
1608#if !defined(PRODUCT)
1609 Debugger* debugger_ =
nullptr;
1612 RelaxedAtomic<SampleBlock*> current_sample_block_ =
nullptr;
1615 RelaxedAtomic<SampleBlock*> current_allocation_sample_block_ =
nullptr;
1617 RelaxedAtomic<uword> has_completed_blocks_ = {0};
1619 int64_t last_resume_timestamp_;
1621 VMTagCounters vm_tag_counters_;
1625 kPendingHandlerIndex = 0,
1626 kPendingMethodNameIndex,
1628 kPendingValuesIndex,
1629 kPendingReplyPortIndex,
1633 GrowableObjectArrayPtr pending_service_extension_calls_;
1637 kRegisteredNameIndex = 0,
1638 kRegisteredHandlerIndex,
1639 kRegisteredEntrySize
1641 GrowableObjectArrayPtr registered_service_extension_handlers_;
1644 Monitor* pause_loop_monitor_ =
nullptr;
1646#define ISOLATE_METRIC_VARIABLE(type, variable, name, unit) \
1647 type metric_##variable##_;
1649#undef ISOLATE_METRIC_VARIABLE
1652 ObjectIdRing* object_id_ring_ =
nullptr;
1656 int64_t start_time_micros_;
1657 std::atomic<Dart_MessageNotifyCallback> message_notify_callback_;
1660 char* name_ =
nullptr;
1664 Mutex origin_id_mutex_;
1665 uint64_t pause_capability_ = 0;
1666 uint64_t terminate_capability_ = 0;
1667 void* init_callback_data_ =
nullptr;
1670 Simulator* simulator_ =
nullptr;
1672 IsolateMessageHandler* message_handler_ =
nullptr;
1673 intptr_t defer_finalization_count_ = 0;
1674 DeoptContext* deopt_context_ =
nullptr;
1675 FfiCallbackMetadata::Metadata* ffi_callback_list_head_ =
nullptr;
1676 intptr_t ffi_callback_keep_alive_counter_ = 0;
1678 GrowableObjectArrayPtr tag_table_;
1680 ErrorPtr sticky_error_;
1682 std::unique_ptr<Bequest> bequest_;
1687 Monitor spawn_count_monitor_;
1688 intptr_t spawn_count_ = 0;
1693 DispatchTable* dispatch_table_ =
nullptr;
1696 std::unique_ptr<WeakTable> forward_table_new_;
1697 std::unique_ptr<WeakTable> forward_table_old_;
1702 bool accepts_messages_ =
false;
1704 std::unique_ptr<VirtualMemory> regexp_backtracking_stack_cache_ =
nullptr;
1706 intptr_t wake_pause_event_handler_count_;
1709 intptr_t open_ports_ = 0;
1712 intptr_t open_ports_keepalive_ = 0;
1722#if !defined(PRODUCT)
1723 static void WakePauseEventHandler(
Dart_Isolate isolate);
1727 static bool TryMarkIsolateReady(Isolate* isolate);
1728 static void UnMarkIsolateReady(Isolate* isolate);
1729 static void MaybeNotifyVMShutdown();
1730 bool AcceptsMessagesLocked() {
1732 return accepts_messages_;
1736 static Monitor* isolate_creation_monitor_;
1737 static bool creation_enabled_;
1739 ArrayPtr loaded_prefixes_set_storage_;
1741 MallocGrowableArray<ObjectPtr> pointers_to_verify_at_exit_;
1743#define REUSABLE_FRIEND_DECLARATION(name) \
1744 friend class Reusable##name##HandleScope;
1746#undef REUSABLE_FRIEND_DECLARATION
1769 : new_isolate_(new_isolate), saved_isolate_(
Isolate::Current()) {
1770 if (new_isolate_ ==
nullptr) {
1775 if (saved_isolate_ != new_isolate_) {
1784 if (new_isolate_ ==
nullptr) {
1789 if (saved_isolate_ != new_isolate_) {
1790 ASSERT(saved_isolate_ ==
nullptr);
1807 : isolate_group_(isolate_group) {
1833 outer_ = thread_->no_active_isolate_scope_;
1834 saved_isolate_ = thread_->isolate_;
1836 thread_->no_active_isolate_scope_ =
this;
1837 thread_->isolate_ =
nullptr;
1840 ASSERT(thread_->isolate_ ==
nullptr);
1841 thread_->isolate_ = saved_isolate_;
1842 thread_->no_active_isolate_scope_ = outer_;
1857 thread->no_active_isolate_scope_->saved_isolate_) {}
1862 thread_->isolate_ = isolate;
1865 ASSERT(thread_->isolate_ !=
nullptr);
1866 thread_->isolate_ =
nullptr;
static void encode(uint8_t output[16], const uint32_t input[4])
#define RELEASE_ASSERT(cond)
T load(std::memory_order order=std::memory_order_acquire) const
void store(T arg, std::memory_order order=std::memory_order_release)
ActiveIsolateScope(Thread *thread, Isolate *isolate)
ActiveIsolateScope(Thread *thread)
Thread * scheduled_mutator_thread_
PersistentHandle * TakeHandle()
Bequest(PersistentHandle *handle, Dart_Port beneficiary)
PersistentHandle * handle()
DisableIdleTimerScope(IdleTimeHandler *handler)
EnterIsolateGroupScope(IsolateGroup *isolate_group)
~EnterIsolateGroupScope()
void InitializeWithHeap(Heap *heap)
bool ShouldNotifyIdle(int64_t *expiry)
bool ShouldCheckForIdle()
void NotifyIdleUsingDefaultDeadline()
void UpdateStartIdleTime()
void NotifyIdle(int64_t deadline)
const uint8_t * script_kernel_buffer
const uint8_t * kernel_buffer
intptr_t script_kernel_size
const intptr_t kernel_buffer_size
IsolateGroupSource(const char *script_uri, const char *name, const uint8_t *snapshot_data, const uint8_t *snapshot_instructions, const uint8_t *kernel_buffer, intptr_t kernel_buffer_size, Dart_IsolateFlags flags)
const uint8_t * snapshot_instructions
const uint8_t * snapshot_data
void add_loaded_blob(Zone *zone_, const ExternalTypedData &external_typed_data)
void IncreaseMutatorCount(Isolate *mutator, bool is_nested_reenter)
GroupDebugger * debugger() const
void RunWithLockedGroup(std::function< void()> fun)
int64_t UptimeMicros() const
void RestoreOriginalClassTable()
void set_use_osr(bool use_osr)
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)
bool has_dynamically_extendable_classes() const
StoreBuffer * store_buffer() const
bool remapping_cids() const
void UnregisterIsolate(Isolate *isolate)
Mutex * kernel_data_class_cache_mutex()
void ForEachIsolate(std::function< void(Isolate *isolate)> function, bool at_safepoint=false)
void set_cached_class_table_table(ClassPtr *cached_class_table_table)
bool UnregisterIsolateDecrementCount()
void DeleteReloadContext()
void VisitStackPointers(ObjectPointerVisitor *visitor, ValidationPolicy validate_frames)
MutatorThreadPool * thread_pool()
bool should_load_vmservice() const
static bool IsSystemIsolateGroup(const IsolateGroup *group)
void ScheduleInterrupts(uword interrupt_bits)
intptr_t optimization_counter_threshold() const
void RegisterClass(const Class &cls)
const char ** obfuscation_map() const
ClassTableAllocator * class_table_allocator()
bool all_classes_finalized() const
void * embedder_data() const
void RehashConstants(Become *become)
void FlagsCopyFrom(const Dart_IsolateFlags &api_flags)
void DropOriginalClassTable()
MarkingStack * deferred_marking_stack() const
void set_should_load_vmservice(bool value)
void set_all_classes_finalized(bool value)
bool initial_spawn_successful()
void set_dispatch_table_snapshot(const uint8_t *snapshot)
bool ContainsOnlyOneIsolate()
void FreeStaticField(const Field &field)
ObjectStore * object_store() const
SafepointRwLock * program_lock()
ClassPtr * cached_class_table_table()
void DisableIncrementalBarrier()
void CloneClassTableForReload()
static IsolateGroup * Current()
std::shared_ptr< IsolateGroupSource > shareable_source() const
Dart_LibraryTagHandler library_tag_handler() const
void RegisterStaticField(const Field &field, const Object &initial_value)
void set_has_dynamically_extendable_classes(bool value)
ClassTable * class_table() const
void set_last_reload_timestamp(int64_t value)
static intptr_t class_table_offset()
static bool HasOnlyVMIsolateGroup()
bool is_system_isolate_group() const
void DecreaseMutatorCount(Isolate *mutator, bool is_nested_exit)
void set_initial_field_table(std::shared_ptr< FieldTable > field_table)
Mutex * type_arguments_canonicalization_mutex()
void VisitObjectIdRingPointers(ObjectPointerVisitor *visitor)
IsolateGroupReloadContext * reload_context()
void set_object_store(ObjectStore *object_store)
void SetNativeAssetsCallbacks(NativeAssetsApi *native_assets_api)
Mutex * initializer_functions_mutex()
ApiState * api_state() const
void RegisterSharedStaticField(const Field &field, const Object &initial_value)
FieldTable * initial_field_table() const
intptr_t reload_every_n_stack_overflow_checks() const
void VisitObjectPointers(ObjectPointerVisitor *visitor, ValidationPolicy validate_frames)
void set_library_tag_handler(Dart_LibraryTagHandler handler)
IsolateGroupSource * source() const
bool ReloadSources(JSONStream *js, bool force_reload, const char *root_script_url=nullptr, const char *packages_url=nullptr, bool dont_delete_reload_context=false)
void set_saved_unlinked_calls(const Array &saved_unlinked_calls)
void SetHasAttemptedReload(bool value)
void SetupImagePage(const uint8_t *snapshot_buffer, bool is_executable)
int64_t last_allocationprofile_gc_timestamp() const
ClassTable * heap_walk_class_table() const
Mutex * kernel_constants_mutex()
ArrayPtr saved_unlinked_calls() const
void set_remapping_cids(bool value)
void RunWithStoppedMutators(T single_current_mutator, S otherwise, bool use_force_growth_in_otherwise=false)
Mutex * type_feedback_mutex()
Isolate * FirstIsolateLocked() const
void PrintJSON(JSONStream *stream, bool ref=true)
std::shared_ptr< FieldTable > shared_field_table_shareable()
Mutex * type_canonicalization_mutex()
NativeAssetsApi * native_assets_api()
void ReleaseStoreBuffers()
void set_obfuscation_map(const char **map)
static void ExitTemporaryIsolate()
void RememberLiveTemporaries()
void FlagsCopyTo(Dart_IsolateFlags *api_flags)
MarkingStack * old_marking_stack() const
void RunWithStoppedMutatorsCallable(Callable *single_current_mutator, Callable *otherwise, bool use_force_growth_in_otherwise=false)
SafepointHandler * safepoint_handler()
void set_initial_spawn_successful()
Mutex * patchable_call_mutex()
intptr_t MutatorCount() const
void set_become(Become *become)
std::shared_ptr< FieldTable > initial_field_table_shareable()
void VisitWeakPersistentHandles(HandleVisitor *visitor)
static void RunWithIsolateGroup(uint64_t id, std::function< void(IsolateGroup *)> action, std::function< void()> not_found)
void set_shared_initial_field_table(std::shared_ptr< FieldTable > field_table)
void set_dispatch_table_snapshot_size(intptr_t size)
void DeferredMarkLiveTemporaries()
Mutex * constant_canonicalization_mutex()
void RegisterIsolate(Isolate *isolate)
int64_t last_reload_timestamp() const
Mutex * kernel_data_lib_cache_mutex()
void MaybeIncreaseReloadEveryNStackOverflowChecks()
void set_branch_coverage(bool value)
intptr_t dispatch_table_snapshot_size() const
FieldTable * shared_initial_field_table() const
DispatchTable * dispatch_table() const
ISOLATE_GROUP_METRIC_LIST(ISOLATE_METRIC_ACCESSOR)
BackgroundCompiler * background_compiler() const
void UpdateLastAllocationProfileAccumulatorResetTimestamp()
static void RegisterIsolateGroup(IsolateGroup *isolate_group)
void set_coverage(bool value)
ThreadRegistry * thread_registry() const
Isolate * FirstIsolate() const
ObjectPtr CallTagHandler(Dart_LibraryTag tag, const Object &arg1, const Object &arg2)
Mutex * megamorphic_table_mutex()
static intptr_t cached_class_table_table_offset()
IdleTimeHandler * idle_time_handler()
bool HasAttemptedReload() const
bool is_vm_isolate() const
Isolate * EnterTemporaryIsolate()
static bool HasApplicationIsolateGroups()
Dart_DeferredLoadHandler deferred_load_handler() const
void PrintToJSONObject(JSONObject *jsobj, bool ref)
static void ForEach(std::function< void(IsolateGroup *)> action)
void set_shared_field_table(Thread *T, FieldTable *shared_field_table)
FieldTable * shared_field_table() const
void FlushMarkingStacks()
const uint8_t * dispatch_table_snapshot() const
void RunWithStoppedMutators(T function, bool use_force_growth=false)
MarkingStack * new_marking_stack() const
Mutex * subtype_test_cache_mutex()
int64_t last_allocationprofile_accumulator_reset_timestamp() const
void EnableIncrementalBarrier(MarkingStack *old_marking_stack, MarkingStack *new_marking_stack, MarkingStack *deferred_marking_stack)
ProgramReloadContext * program_reload_context()
void VisitSharedPointers(ObjectPointerVisitor *visitor)
std::shared_ptr< FieldTable > shared_initial_field_table_shareable()
static void FlagsInitialize(Dart_IsolateFlags *api_flags)
void set_deferred_load_handler(Dart_DeferredLoadHandler handler)
void set_asserts(bool value)
void CreateHeap(bool is_vm_isolate, bool is_service_or_kernel_isolate)
IsolateGroup(std::shared_ptr< IsolateGroupSource > source, void *embedder_data, ObjectStore *object_store, Dart_IsolateFlags api_flags, bool is_vm_isolate)
void UpdateLastAllocationProfileGCTimestamp()
static intptr_t object_store_offset()
static void UnregisterIsolateGroup(IsolateGroup *isolate_group)
bool HasTagHandler() const
void PrintMemoryUsageJSON(JSONStream *stream)
void set_dispatch_table(DispatchTable *table)
virtual void VisitIsolate(Isolate *isolate)=0
virtual ~IsolateVisitor()
bool IsSystemIsolate(Isolate *isolate) const
static intptr_t user_tag_offset()
void set_forward_table_old(WeakTable *table)
ReceivePortPtr CreateReceivePort(const String &debug_name)
IsolateGroupSource * source() const
void set_should_pause_post_service_request(bool value)
bool AddResumeCapability(const Capability &capability)
intptr_t BlockClassFinalization()
Thread * scheduled_mutator_thread() const
void AddExitListener(const SendPort &listener, const Instance &response)
bool GetAndClearResumeRequest()
void AddErrorListener(const SendPort &listener)
FfiCallbackMetadata::Trampoline CreateAsyncFfiCallback(Zone *zone, const Function &send_function, Dart_Port send_port)
bool TrySetHasCompletedBlocks()
Dart_EnvironmentCallback environment_callback() const
ErrorPtr sticky_error() const
UserTagPtr current_tag() const
Simulator * simulator() const
int64_t last_resume_timestamp() const
FfiCallbackMetadata::Metadata * ffi_callback_list_head()
void set_deopt_context(DeoptContext *value)
static bool IsSystemIsolate(const Isolate *isolate)
FieldTable * field_table() const
static void DisableIsolateCreation()
void ScheduleInterrupts(uword interrupt_bits)
void RememberLiveTemporaries()
@ kDrainServiceExtensionsMsg
ObjectIdRing * object_id_ring() const
static Isolate * Current()
static bool IsVMInternalIsolate(const Isolate *isolate)
void set_on_shutdown_callback(Dart_IsolateShutdownCallback value)
void DeferredMarkLiveTemporaries()
static void KillIfExists(Isolate *isolate, LibMsgId msg_id)
void set_has_resumption_breakpoints(bool value)
static bool IsolateCreationEnabled()
IsolateObjectStore * isolate_object_store() const
void FlagsCopyTo(Dart_IsolateFlags *api_flags) const
bool TakeHasCompletedBlocks()
static intptr_t single_step_offset()
VMTagCounters * vm_tag_counters()
static void KillAllSystemIsolates(LibMsgId msg_id)
static void VisitIsolates(IsolateVisitor *visitor)
Debugger * debugger() const
bool VerifyPauseCapability(const Object &capability) const
ISOLATE_METRIC_LIST(ISOLATE_METRIC_ACCESSOR)
void DeleteFfiCallback(FfiCallbackMetadata::Trampoline callback)
UserTagPtr default_tag() const
MallocGrowableArray< ObjectPtr > * pointers_to_verify_at_exit()
void NotifyExitListeners()
bool IsPrefixLoaded(const LibraryPrefix &prefix) const
void DecrementSpawnCount()
bool RemoveResumeCapability(const Capability &capability)
SafepointHandler * safepoint_handler() const
void PrintJSON(JSONStream *stream, bool ref=true)
bool has_attempted_stepping() const
bool ResumeRequest() const
void SetErrorsFatal(bool value)
MessageHandler * message_handler() const
void set_field_table(Thread *T, FieldTable *field_table)
ObjectPtr CallDeferredLoadHandler(intptr_t id)
intptr_t UnblockClassFinalization()
void PrintPauseEventJSON(JSONStream *stream)
static Dart_IsolateShutdownCallback ShutdownCallback()
bool is_vm_isolate() const
void SetReceivePortKeepAliveState(const ReceivePort &receive_port, bool keep_isolate_alive)
FfiCallbackMetadata::Trampoline CreateIsolateLocalFfiCallback(Zone *zone, const Function &trampoline, const Closure &target, bool keep_isolate_alive)
void SetPrefixIsLoaded(const LibraryPrefix &prefix)
void RegisterServiceExtensionHandler(const String &name, const Instance &closure)
static void FlagsInitialize(Dart_IsolateFlags *api_flags)
void PrintMemoryUsageJSON(JSONStream *stream)
static void SetShutdownCallback(Dart_IsolateShutdownCallback cb)
static void KillAllIsolates(LibMsgId msg_id)
static intptr_t finalizers_offset()
void set_on_cleanup_callback(Dart_IsolateCleanupCallback value)
static std::unique_ptr< char[]> LookupIsolateNameByPort(Dart_Port port)
bool HasPendingMessages()
static intptr_t IsolateListLength()
void set_current_sample_block(SampleBlock *block)
void * init_callback_data() const
uint64_t terminate_capability() const
ThreadRegistry * thread_registry() const
void set_terminate_capability(uint64_t value)
static intptr_t default_tag_offset()
void set_is_runnable(bool value)
void CloseReceivePort(const ReceivePort &receive_port)
void set_last_resume_timestamp()
bool HasDeferredLoadHandler() const
const char * MakeRunnable()
Dart_IsolateShutdownCallback on_shutdown_callback()
GrowableObjectArrayPtr tag_table() const
void set_simulator(Simulator *value)
void SendInternalLibMessage(LibMsgId msg_id, uint64_t capability)
bool VerifyTerminateCapability(const Object &capability) const
void WaitForOutstandingSpawns()
void set_forward_table_new(WeakTable *table)
int64_t UptimeMicros() const
void UpdateNativeCallableKeepIsolateAliveCounter(intptr_t delta)
ObjectIdRing * EnsureObjectIdRing()
static Dart_IsolateCleanupCallback CleanupCallback()
ErrorPtr InvokePendingServiceExtensionCalls()
friend class HeapSnapshotWriter
void MakeRunnableLocked()
SampleBlock * current_sample_block() const
void set_environment_callback(Dart_EnvironmentCallback value)
DART_WARN_UNUSED_RESULT ErrorPtr StealStickyError()
void set_main_port(Dart_Port port)
ErrorPtr PausePostRequest()
bool should_pause_post_service_request() const
static void EnableIsolateCreation()
void AppendServiceExtensionCall(const Instance &closure, const String &method_name, const Array ¶meter_keys, const Array ¶meter_values, const Instance &reply_port, const Instance &id)
HandlerInfoCache * handler_info_cache()
IsolateGroup * group() const
static void SetCleanupCallback(Dart_IsolateCleanupCallback cb)
static intptr_t current_tag_offset()
static void SetInitializeCallback_(Dart_InitializeIsolateCallback cb)
static Dart_IsolateGroupCreateCallback CreateGroupCallback()
void CacheRegexpBacktrackStack(std::unique_ptr< VirtualMemory > stack)
WeakTable * forward_table_old()
void set_current_tag(const UserTag &tag)
bool IsDeoptimizing() const
void set_has_attempted_stepping(bool value)
void set_init_callback_data(void *value)
Dart_MessageNotifyCallback message_notify_callback() const
InstancePtr LookupServiceExtensionHandler(const String &name)
CatchEntryMovesCache * catch_entry_moves_cache()
bool is_service_registered() const
void set_name(const char *name)
static Dart_IsolateGroupCleanupCallback GroupCleanupCallback()
static void SetGroupCleanupCallback(Dart_IsolateGroupCleanupCallback cb)
std::unique_ptr< VirtualMemory > TakeRegexpBacktrackStack()
WeakTable * forward_table_new()
void FlagsCopyFrom(const Dart_IsolateFlags &api_flags)
void set_finalizers(const GrowableObjectArray &value)
void RemoveExitListener(const SendPort &listener)
uint64_t pause_capability() const
static Isolate * LookupIsolateByPort(Dart_Port port)
static Dart_UnregisterKernelBlobCallback UnregisterKernelBlobCallback()
bool NotifyErrorListeners(const char *msg, const char *stacktrace)
bool AllowClassFinalization()
void init_loaded_prefixes_set_storage()
void set_current_allocation_sample_block(SampleBlock *block)
friend Isolate * CreateWithinExistingIsolateGroup(IsolateGroup *g, const char *n, char **e)
void set_is_service_registered(bool value)
void set_tag_table(const GrowableObjectArray &value)
static Dart_InitializeIsolateCallback InitializeCallback()
static void SetRegisterKernelBlobCallback(Dart_RegisterKernelBlobCallback cb)
static void SetCreateGroupCallback(Dart_IsolateGroupCreateCallback cb)
Dart_IsolateCleanupCallback on_cleanup_callback()
friend class IsolateGroup
DeoptContext * deopt_context() const
Thread * mutator_thread() const
static intptr_t has_resumption_breakpoints_offset()
void set_single_step(bool value)
void set_default_tag(const UserTag &tag)
SampleBlock * current_allocation_sample_block() const
void IncrementSpawnCount()
void set_origin_id(Dart_Port id)
static Dart_RegisterKernelBlobCallback RegisterKernelBlobCallback()
void RemoveErrorListener(const SendPort &listener)
void ProcessFreeSampleBlocks(Thread *thread)
void set_message_notify_callback(Dart_MessageNotifyCallback value)
void set_pause_capability(uint64_t value)
Dart_Port main_port() const
static void SetUnregisterKernelBlobCallback(Dart_UnregisterKernelBlobCallback cb)
bool has_resumption_breakpoints() const
void set_is_vm_isolate(bool value)
void SetStickyError(ErrorPtr sticky_error)
const char * name() const
bool HasOpenNativeCallables()
void bequeath(std::unique_ptr< Bequest > bequest)
LambdaCallable(T &lambda)
bool IsOwnedByCurrentThread() const
MutatorThreadPool(IsolateGroup *isolate_group, intptr_t max_pool_size)
virtual ~MutatorThreadPool()
virtual void OnEnterIdleLocked(MonitorLocker *ml)
NoActiveIsolateScope(Thread *thread)
static int64_t GetCurrentTimeMillis()
T exchange(T arg, std::memory_order order=std::memory_order_relaxed)
ThreadState * thread() const
StartIsolateScope(Isolate *new_isolate)
static Thread * Current()
static void ExitIsolateGroupAsHelper(bool bypass_safepoint)
Isolate * isolate() const
IsolateGroup * isolate_group() const
static void EnterIsolate(Isolate *isolate)
static void ExitIsolate(bool isolate_shutdown=false)
static bool EnterIsolateGroupAsHelper(IsolateGroup *isolate_group, TaskKind kind, bool bypass_safepoint)
void(* Dart_UnregisterKernelBlobCallback)(const char *kernel_blob_uri)
Dart_Handle(* Dart_EnvironmentCallback)(Dart_Handle name)
Dart_Isolate(* Dart_IsolateGroupCreateCallback)(const char *script_uri, const char *main, const char *package_root, const char *package_config, Dart_IsolateFlags *flags, void *isolate_data, char **error)
void(* Dart_IsolateCleanupCallback)(void *isolate_group_data, void *isolate_data)
void(* Dart_MessageNotifyCallback)(Dart_Isolate destination_isolate)
const char *(* Dart_RegisterKernelBlobCallback)(const uint8_t *kernel_buffer, intptr_t kernel_buffer_size)
#define DART_WARN_UNUSED_RESULT
struct _Dart_Isolate * Dart_Isolate
bool(* Dart_InitializeIsolateCallback)(void **child_isolate_data, char **error)
void(* Dart_IsolateGroupCleanupCallback)(void *isolate_group_data)
void(* Dart_IsolateShutdownCallback)(void *isolate_group_data, void *isolate_data)
Dart_Handle(* Dart_LibraryTagHandler)(Dart_LibraryTag tag, Dart_Handle library_or_package_map_url, Dart_Handle url)
Dart_Handle(* Dart_DeferredLoadHandler)(intptr_t loading_unit_id)
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
constexpr intptr_t kDefaultOptimizationCounterThreshold
Dart_NativeFunction function
#define ISOLATE_METRIC_VARIABLE(type, variable, name, unit)
#define DECLARE_BIT(Name)
#define BOOL_ISOLATE_FLAG_LIST(V)
#define ISOLATE_METRIC_ACCESSOR(type, variable, name, unit)
#define BOOL_ISOLATE_GROUP_FLAG_LIST(V)
#define ISOLATE_GROUP_FLAG_BITS(V)
#define DECLARE_GETTER(when, name, bitname, isolate_flag_name, flag_name)
#define DECLARE_BITFIELD(Name)
#define REUSABLE_FRIEND_DECLARATION(name)
#define ISOLATE_FLAG_BITS(V)
void Log(const char *format,...) SK_PRINTF_LIKE(1
static void Shutdown(Dart_NativeArguments args)
FixedCache< intptr_t, ExceptionHandlerInfo, 16 > HandlerInfoCache
FixedCache< intptr_t, CatchEntryMovesRefPtr, 16 > CatchEntryMovesCache
constexpr intptr_t kWordSize
COMPILE_ASSERT(kUnreachableReference==WeakTable::kNoValue)
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 defaults to or::depending on whether ipv6 is specified vm service port
std::function< void(const T &message, const MessageReply< T > &reply)> MessageHandler
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
std::function< void()> closure
SI auto map(std::index_sequence< I... >, Fn &&fn, const Args &... args) -> skvx::Vec< sizeof...(I), decltype(fn(args[0]...))>
static DecodeResult decode(std::string path)
#define REUSABLE_HANDLE_LIST(V)
#define NOT_IN_PRECOMPILED(code)
#define NOT_IN_PRODUCT(code)
#define OFFSET_OF(type, field)