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

#include <dart.h>

Inheritance diagram for dart::Dart:
dart::AllStatic

Static Public Member Functions

static char * Init (const Dart_InitializeParams *params)
 
static char * Cleanup ()
 
static bool IsInitialized ()
 
static bool SetActiveApiCall ()
 
static void ResetActiveApiCall ()
 
static IsolateCreateIsolate (const char *name_prefix, const Dart_IsolateFlags &api_flags, IsolateGroup *isolate_group)
 
static ErrorPtr InitializeIsolateGroup (Thread *T, const uint8_t *snapshot_data, const uint8_t *snapshot_instructions, const uint8_t *kernel_buffer, intptr_t kernel_buffer_size)
 
static ErrorPtr InitIsolateGroupFromSnapshot (Thread *T, const uint8_t *snapshot_data, const uint8_t *snapshot_instructions, const uint8_t *kernel_buffer, intptr_t kernel_buffer_size)
 
static ErrorPtr InitializeIsolate (Thread *T, bool is_first_isolate_in_group, void *isolate_data)
 
static void RunShutdownCallback ()
 
static void ShutdownIsolate (Thread *T)
 
static Isolatevm_isolate ()
 
static IsolateGroupvm_isolate_group ()
 
static ThreadPoolthread_pool ()
 
static int64_t UptimeMicros ()
 
static int64_t UptimeMillis ()
 
static void set_pprof_symbol_generator (DebugInfo *value)
 
static DebugInfo * pprof_symbol_generator ()
 
static LocalHandleAllocateReadOnlyApiHandle ()
 
static bool IsReadOnlyApiHandle (Dart_Handle handle)
 
static uword AllocateReadOnlyHandle ()
 
static bool IsReadOnlyHandle (uword address)
 
static char * FeaturesString (IsolateGroup *isolate_group, bool is_vm_snapshot, Snapshot::Kind kind)
 
static Snapshot::Kind vm_snapshot_kind ()
 
static Dart_ThreadStartCallback thread_start_callback ()
 
static void set_thread_start_callback (Dart_ThreadStartCallback cback)
 
static Dart_ThreadExitCallback thread_exit_callback ()
 
static void set_thread_exit_callback (Dart_ThreadExitCallback cback)
 
static void SetFileCallbacks (Dart_FileOpenCallback file_open, Dart_FileReadCallback file_read, Dart_FileWriteCallback file_write, Dart_FileCloseCallback file_close)
 
static Dart_FileOpenCallback file_open_callback ()
 
static Dart_FileReadCallback file_read_callback ()
 
static Dart_FileWriteCallback file_write_callback ()
 
static Dart_FileCloseCallback file_close_callback ()
 
static void set_entropy_source_callback (Dart_EntropySource entropy_source)
 
static Dart_EntropySource entropy_source_callback ()
 
static void set_dwarf_stacktrace_footnote_callback (Dart_DwarfStackTraceFootnoteCallback cb)
 
static Dart_DwarfStackTraceFootnoteCallback dwarf_stacktrace_footnote_callback ()
 

Detailed Description

Definition at line 28 of file dart.h.

Member Function Documentation

◆ AllocateReadOnlyApiHandle()

LocalHandle * dart::Dart::AllocateReadOnlyApiHandle ( )
static

Definition at line 1141 of file dart.cc.

1141 {
1143 ASSERT(predefined_handles_ != nullptr);
1144 return predefined_handles_->api_handles_.AllocateHandle();
1145}
static Isolate * vm_isolate()
Definition: dart.h:68
static Isolate * Current()
Definition: isolate.h:986
LocalHandle * AllocateHandle()
#define ASSERT(E)

◆ AllocateReadOnlyHandle()

uword dart::Dart::AllocateReadOnlyHandle ( )
static

Definition at line 1131 of file dart.cc.

1131 {
1133 ASSERT(predefined_handles_ != nullptr);
1134 uword handle = predefined_handles_->handles_.AllocateScopedHandle();
1135#if defined(DEBUG)
1136 *reinterpret_cast<uword*>(handle + kOffsetOfIsZoneHandle * kWordSize) = 0;
1137#endif
1138 return handle;
1139}
uword AllocateScopedHandle()
Definition: handles.h:96
uintptr_t uword
Definition: globals.h:501
constexpr intptr_t kWordSize
Definition: globals.h:509

◆ Cleanup()

char * dart::Dart::Cleanup ( )
static

Definition at line 629 of file dart.cc.

629 {
630 ASSERT(Isolate::Current() == nullptr);
632 return Utils::StrDup("VM already terminated.");
633 }
634 ASSERT(vm_isolate_ != nullptr);
635
636 if (FLAG_trace_shutdown) {
637 OS::PrintErr("[+%" Pd64 "ms] SHUTDOWN: Starting shutdown\n",
638 UptimeMillis());
639 }
640
641#if !defined(PRODUCT)
642 if (FLAG_trace_shutdown) {
643 OS::PrintErr("[+%" Pd64 "ms] SHUTDOWN: Shutting down profiling\n",
644 UptimeMillis());
645 }
647#endif // !defined(PRODUCT)
648
650
651 // Disable the creation of new isolates.
652 if (FLAG_trace_shutdown) {
653 OS::PrintErr("[+%" Pd64 "ms] SHUTDOWN: Disabling isolate creation\n",
654 UptimeMillis());
655 }
657
658 // Send the OOB Kill message to all remaining application isolates.
659 if (FLAG_trace_shutdown) {
660 OS::PrintErr("[+%" Pd64 "ms] SHUTDOWN: Killing all app isolates\n",
661 UptimeMillis());
662 }
664
665 // Wait for all isolates, but the service and the vm isolate to shut down.
666 // Only do that if there is a service isolate running.
668 if (FLAG_trace_shutdown) {
669 OS::PrintErr("[+%" Pd64 "ms] SHUTDOWN: Shutting down app isolates\n",
670 UptimeMillis());
671 }
672 WaitForApplicationIsolateShutdown();
673 if (FLAG_trace_shutdown) {
674 OS::PrintErr("[+%" Pd64 "ms] SHUTDOWN: Done shutting down app isolates\n",
675 UptimeMillis());
676 }
677 }
678
680
681 // Shutdown the kernel isolate.
682 if (FLAG_trace_shutdown) {
683 OS::PrintErr("[+%" Pd64 "ms] SHUTDOWN: Shutting down kernel isolate\n",
684 UptimeMillis());
685 }
687
688 // Shutdown the service isolate.
689 if (FLAG_trace_shutdown) {
690 OS::PrintErr("[+%" Pd64 "ms] SHUTDOWN: Shutting down service isolate\n",
691 UptimeMillis());
692 }
694
695 // Wait for the remaining isolate (service/kernel isolate) to shutdown
696 // before shutting down the thread pool.
697 WaitForIsolateShutdown();
698
699 // Shutdown the thread pool. On return, all thread pool threads have exited.
700 if (FLAG_trace_shutdown) {
701 OS::PrintErr("[+%" Pd64 "ms] SHUTDOWN: Deleting thread pool\n",
702 UptimeMillis());
703 }
705 thread_pool_->Shutdown();
706 delete thread_pool_;
707 thread_pool_ = nullptr;
708 if (FLAG_trace_shutdown) {
709 OS::PrintErr("[+%" Pd64 "ms] SHUTDOWN: Done deleting thread pool\n",
710 UptimeMillis());
711 }
712
713 Api::Cleanup();
714 delete predefined_handles_;
715 predefined_handles_ = nullptr;
716
717 // Set the VM isolate as current isolate.
718 if (FLAG_trace_shutdown) {
719 OS::PrintErr("[+%" Pd64 "ms] SHUTDOWN: Cleaning up vm isolate\n",
720 UptimeMillis());
721 }
722
723 // If Dart_Cleanup() is called on a thread which hasn't invoked any Dart API
724 // functions before, entering the "vm-isolate" will cause lazy creation of a
725 // OSThread (which is attached to the current thread via TLS).
726 //
727 // If we run in PRODUCT mode this lazy creation of OSThread can happen here,
728 // which is why disabling the OSThread creation has to come after entering the
729 // "vm-isolate".
730 Thread::EnterIsolate(vm_isolate_);
731
732 // Disable creation of any new OSThread structures which means no more new
733 // threads can do an EnterIsolate. This must come after isolate shutdown
734 // because new threads may need to be spawned to shutdown the isolates.
735 // This must come after deletion of the thread pool to avoid a race in which
736 // a thread spawned by the thread pool does not exit through the thread
737 // pool, messing up its bookkeeping.
738 if (FLAG_trace_shutdown) {
739 OS::PrintErr("[+%" Pd64 "ms] SHUTDOWN: Disabling OS Thread creation\n",
740 UptimeMillis());
741 }
743
745 vm_isolate_ = nullptr;
761#if defined(SUPPORT_TIMELINE)
762 if (FLAG_trace_shutdown) {
763 OS::PrintErr("[+%" Pd64 "ms] SHUTDOWN: Shutting down timeline\n",
764 UptimeMillis());
765 }
767#endif
770 // Delete the current thread's TLS and set it's TLS to null.
771 // If it is the last thread then the destructor would call
772 // OSThread::Cleanup.
773 OSThread* os_thread = OSThread::Current();
774 OSThread::SetCurrent(nullptr);
775 delete os_thread;
776 if (FLAG_trace_shutdown) {
777 OS::PrintErr("[+%" Pd64 "ms] SHUTDOWN: Deleted os_thread\n",
778 UptimeMillis());
779 }
780
781 if (FLAG_trace_shutdown) {
782 OS::PrintErr("[+%" Pd64 "ms] SHUTDOWN: Deleting code observers\n",
783 UptimeMillis());
784 }
786 OS::Cleanup();
787 if (FLAG_trace_shutdown) {
788 OS::PrintErr("[+%" Pd64 "ms] SHUTDOWN: Done\n", UptimeMillis());
789 }
791#if !defined(PRODUCT) && !defined(DART_PRECOMPILED_RUNTIME)
793 Service::SetEmbedderStreamCallbacks(nullptr, nullptr);
794#endif // !defined(PRODUCT) && !defined(DART_PRECOMPILED_RUNTIME)
796 return nullptr;
797}
static void Cleanup()
static void Cleanup()
static bool SetCleaningup()
Definition: dart.cc:126
static void SetUnInitialized()
Definition: dart.cc:131
static void ShutdownIsolate(Thread *T)
Definition: dart.cc:1123
static int64_t UptimeMillis()
Definition: dart.h:76
static void Cleanup()
static void Cleanup()
Definition: object.cc:17259
static void SetFileModifiedCallback(Dart_FileModifiedCallback callback)
static void Cleanup()
Definition: isolate.cc:742
static void DisableIsolateCreation()
Definition: isolate.cc:3590
@ kInternalKillMsg
Definition: isolate.h:973
static void KillAllSystemIsolates(LibMsgId msg_id)
Definition: isolate.cc:3701
static void KillAllIsolates(LibMsgId msg_id)
Definition: isolate.cc:3696
static intptr_t IsolateListLength()
Definition: isolate.cc:3541
static bool IsRunning()
static void Shutdown()
static void SetCurrent(OSThread *current)
Definition: os_thread.h:186
static OSThread * Current()
Definition: os_thread.h:179
static void DisableOSThreadCreation()
Definition: os_thread.cc:247
static void static void PrintErr(const char *format,...) PRINTF_ATTRIBUTE(1
static void Cleanup()
static void Cleanup()
Definition: object.cc:1364
static void Cleanup()
static void Cleanup()
Definition: page.cc:45
static void Cleanup()
Definition: port.cc:261
static void Cleanup()
Definition: profiler.cc:605
static void Cleanup()
Definition: random.cc:88
static void SetEmbedderStreamCallbacks(Dart_ServiceStreamListenCallback listen_callback, Dart_ServiceStreamCancelCallback cancel_callback)
Definition: service.cc:1434
static void Cleanup()
Definition: service.cc:119
static void Cleanup()
Definition: stub_code.cc:124
static void Cleanup()
Definition: cpu_arm.h:71
static Thread * Current()
Definition: thread.h:362
static void EnterIsolate(Isolate *isolate)
Definition: thread.cc:371
static void Cleanup()
Definition: tags.cc:191
static char * StrDup(const char *s)
static void Cleanup()
static void Cleanup()
Definition: zone.cc:63
NOT_IN_PRODUCT(LibraryPtr ReloadTestScript(const char *script))
#define Pd64
Definition: globals.h:416

◆ CreateIsolate()

Isolate * dart::Dart::CreateIsolate ( const char *  name_prefix,
const Dart_IsolateFlags api_flags,
IsolateGroup isolate_group 
)
static

Definition at line 811 of file dart.cc.

813 {
814 // Create a new isolate.
815 Isolate* isolate =
816 Isolate::InitIsolate(name_prefix, isolate_group, api_flags);
817 return isolate;
818}

◆ dwarf_stacktrace_footnote_callback()

static Dart_DwarfStackTraceFootnoteCallback dart::Dart::dwarf_stacktrace_footnote_callback ( )
inlinestatic

Definition at line 145 of file dart.h.

145 {
146 return dwarf_stacktrace_footnote_callback_;
147 }

◆ entropy_source_callback()

static Dart_EntropySource dart::Dart::entropy_source_callback ( )
inlinestatic

Definition at line 135 of file dart.h.

135 {
136 return entropy_source_callback_;
137 }

◆ FeaturesString()

char * dart::Dart::FeaturesString ( IsolateGroup isolate_group,
bool  is_vm_snapshot,
Snapshot::Kind  kind 
)
static

Definition at line 1004 of file dart.cc.

1006 {
1007 TextBuffer buffer(64);
1008
1009// Different fields are included for DEBUG/RELEASE/PRODUCT.
1010#if defined(DEBUG)
1011 buffer.AddString("debug");
1012#elif defined(PRODUCT)
1013 buffer.AddString("product");
1014#else
1015 buffer.AddString("release");
1016#endif
1017
1018#define ADD_FLAG(name, value) \
1019 do { \
1020 buffer.AddString(value ? (" " #name) : (" no-" #name)); \
1021 } while (0);
1022#define ADD_P(name, T, DV, C) ADD_FLAG(name, FLAG_##name)
1023#define ADD_R(name, PV, T, DV, C) ADD_FLAG(name, FLAG_##name)
1024#define ADD_C(name, PCV, PV, T, DV, C) ADD_FLAG(name, FLAG_##name)
1025#define ADD_D(name, T, DV, C) ADD_FLAG(name, FLAG_##name)
1026
1027#define ADD_ISOLATE_GROUP_FLAG(name, isolate_flag, flag) \
1028 do { \
1029 const bool value = \
1030 isolate_group != nullptr ? isolate_group->name() : flag; \
1031 ADD_FLAG(name, value); \
1032 } while (0);
1033
1034 if (Snapshot::IncludesCode(kind)) {
1036
1037 ADD_FLAG(tsan, FLAG_target_thread_sanitizer)
1039
1040 if (kind == Snapshot::kFullJIT) {
1041 // Enabling assertions affects deopt ids.
1042 //
1043 // This flag is only used at compile time for AOT, so it's only relevant
1044 // when running JIT snapshots. We can omit this flag for AOT snapshots so
1045 // feature verification won't fail if --enable-snapshots isn't provided
1046 // at runtime.
1047 ADD_ISOLATE_GROUP_FLAG(asserts, enable_asserts, FLAG_enable_asserts);
1048 ADD_ISOLATE_GROUP_FLAG(use_field_guards, use_field_guards,
1049 FLAG_use_field_guards);
1050 ADD_ISOLATE_GROUP_FLAG(use_osr, use_osr, FLAG_use_osr);
1051 ADD_ISOLATE_GROUP_FLAG(branch_coverage, branch_coverage,
1052 FLAG_branch_coverage);
1053 ADD_ISOLATE_GROUP_FLAG(coverage, coverage, FLAG_coverage);
1054 }
1055
1056 // Generated code must match the host architecture and ABI. We check the
1057 // strong condition of matching on operating system so that
1058 // Platform.isAndroid etc can be compile-time constants.
1059#if defined(TARGET_ARCH_IA32)
1060 buffer.AddString(" ia32");
1061#elif defined(TARGET_ARCH_X64)
1062 buffer.AddString(" x64");
1063#elif defined(TARGET_ARCH_ARM)
1064 buffer.AddString(" arm");
1065#elif defined(TARGET_ARCH_ARM64)
1066 buffer.AddString(" arm64");
1067#elif defined(TARGET_ARCH_RISCV32)
1068 buffer.AddString(" riscv32");
1069#elif defined(TARGET_ARCH_RISCV64)
1070 buffer.AddString(" riscv64");
1071#else
1072#error What architecture?
1073#endif
1074
1075#if defined(DART_TARGET_OS_ANDROID)
1076 buffer.AddString(" android");
1077#elif defined(DART_TARGET_OS_FUCHSIA)
1078 buffer.AddString(" fuchsia");
1079#elif defined(DART_TARGET_OS_MACOS)
1080#if defined(DART_TARGET_OS_MACOS_IOS)
1081 buffer.AddString(" ios");
1082#else
1083 buffer.AddString(" macos");
1084#endif
1085#elif defined(DART_TARGET_OS_LINUX)
1086 buffer.AddString(" linux");
1087#elif defined(DART_TARGET_OS_WINDOWS)
1088 buffer.AddString(" windows");
1089#else
1090#error What operating system?
1091#endif
1092
1093#if defined(DART_COMPRESSED_POINTERS)
1094 buffer.AddString(" compressed-pointers");
1095#else
1096 buffer.AddString(" no-compressed-pointers");
1097#endif
1098 }
1099
1100#undef ADD_ISOLATE_FLAG
1101#undef ADD_D
1102#undef ADD_C
1103#undef ADD_R
1104#undef ADD_P
1105#undef ADD_FLAG
1106
1107 return buffer.Steal();
1108}
static bool IncludesCode(Kind kind)
Definition: snapshot.h:67
#define ADD_ISOLATE_GROUP_FLAG(name, isolate_flag, flag)
#define ADD_P(name, T, DV, C)
#define ADD_D(name, T, DV, C)
#define ADD_FLAG(name, value)
#define ADD_R(name, PV, T, DV, C)
#define ADD_C(name, PCV, PV, T, DV, C)
#define VM_GLOBAL_FLAG_LIST(P, R, C, D)
Definition: flag_list.h:58
constexpr bool FLAG_target_memory_sanitizer
Definition: flags.h:174
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 A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace buffer
Definition: switches.h:126

◆ file_close_callback()

static Dart_FileCloseCallback dart::Dart::file_close_callback ( )
inlinestatic

Definition at line 128 of file dart.h.

128 {
129 return file_close_callback_;
130 }

◆ file_open_callback()

static Dart_FileOpenCallback dart::Dart::file_open_callback ( )
inlinestatic

Definition at line 119 of file dart.h.

119 {
120 return file_open_callback_;
121 }

◆ file_read_callback()

static Dart_FileReadCallback dart::Dart::file_read_callback ( )
inlinestatic

Definition at line 122 of file dart.h.

122 {
123 return file_read_callback_;
124 }

◆ file_write_callback()

static Dart_FileWriteCallback dart::Dart::file_write_callback ( )
inlinestatic

Definition at line 125 of file dart.h.

125 {
126 return file_write_callback_;
127 }

◆ Init()

char * dart::Dart::Init ( const Dart_InitializeParams params)
static

Definition at line 526 of file dart.cc.

526 {
528 return Utils::StrDup(
529 "Bad VM initialization state, "
530 "already initialized or "
531 "multiple threads initializing the VM.");
532 }
533 char* retval = DartInit(params);
534 if (retval != nullptr) {
536 return retval;
537 }
539 return nullptr;
540}
static bool SetInitializing()
Definition: dart.cc:104
static void ResetInitializing()
Definition: dart.cc:110
static void SetInitialized()
Definition: dart.cc:117
const EmbeddedViewParams * params

◆ InitializeIsolate()

ErrorPtr dart::Dart::InitializeIsolate ( Thread T,
bool  is_first_isolate_in_group,
void *  isolate_data 
)
static

Definition at line 950 of file dart.cc.

952 {
953 auto I = T->isolate();
954 auto IG = T->isolate_group();
955 auto Z = T->zone();
956
957 // If a static field gets registered in [IsolateGroup::RegisterStaticField]:
958 //
959 // * before this block it will ignore this isolate. The [Clone] of the
960 // initial field table will pick up the new value.
961 // * after this block it will add the new static field to this isolate.
962 {
963 SafepointReadRwLocker reader(T, IG->program_lock());
964 I->set_field_table(T, IG->initial_field_table()->Clone(I));
965 I->field_table()->MarkReadyToUse();
966 }
967
968 const auto& out_of_memory =
969 Object::Handle(IG->object_store()->out_of_memory());
970 const auto& error = Error::Handle(
971 Z, I->isolate_object_store()->PreallocateObjects(out_of_memory));
972 if (!error.IsNull()) {
973 return error.ptr();
974 }
975
976 I->set_init_callback_data(isolate_data);
977
978#if !defined(PRODUCT)
981 } else {
982 I->message_handler()->set_should_pause_on_start(
983 FLAG_pause_isolates_on_start);
984 I->message_handler()->set_should_pause_on_exit(FLAG_pause_isolates_on_exit);
985 }
986#endif // !defined(PRODUCT)
987
989#if !defined(PRODUCT)
990 I->debugger()->NotifyIsolateCreated();
991#endif
992
993 // Create tag table.
995 // Set up default UserTag.
996 const UserTag& default_tag = UserTag::Handle(UserTag::DefaultTag());
997 I->set_current_tag(default_tag);
998
999 I->init_loaded_prefixes_set_storage();
1000
1001 return Error::null();
1002}
#define IG
#define Z
static GrowableObjectArrayPtr New(Heap::Space space=Heap::kNew)
Definition: object.h:11144
static bool IsSystemIsolate(const Isolate *isolate)
Definition: isolate.h:1445
static ObjectPtr null()
Definition: object.h:433
static Object & Handle()
Definition: object.h:407
static bool SendIsolateStartupMessage()
static void MaybeMakeServiceIsolate(Isolate *isolate)
static UserTagPtr DefaultTag()
Definition: object.cc:26974
const uint8_t uint32_t uint32_t GError ** error
#define T
Definition: precompiler.cc:65
Definition: SkMD5.cpp:134

◆ InitializeIsolateGroup()

ErrorPtr dart::Dart::InitializeIsolateGroup ( Thread T,
const uint8_t *  snapshot_data,
const uint8_t *  snapshot_instructions,
const uint8_t *  kernel_buffer,
intptr_t  kernel_buffer_size 
)
static

Definition at line 908 of file dart.cc.

912 {
913 auto& error = Error::Handle(
914 InitIsolateGroupFromSnapshot(T, snapshot_data, snapshot_instructions,
915 kernel_buffer, kernel_buffer_size));
916 if (!error.IsNull()) {
917 return error.ptr();
918 }
919
921
922 auto IG = T->isolate_group();
923 {
924 SafepointReadRwLocker reader(T, IG->program_lock());
925 IG->set_shared_field_table(T, IG->shared_initial_field_table()->Clone(
926 /*for_isolate=*/nullptr,
927 /*for_isolate_group=*/IG));
928 }
929 DEBUG_ONLY(IG->heap()->Verify("InitializeIsolate", kForbidMarked));
930
931#if !defined(DART_PRECOMPILED_RUNTIME)
933#endif
934
935 if (snapshot_data == nullptr || kernel_buffer != nullptr) {
936 auto object_store = IG->object_store();
937 error ^= object_store->PreallocateObjects();
938 if (!error.IsNull()) {
939 return error.ptr();
940 }
941 }
942
943 if (FLAG_print_class_table) {
944 IG->class_table()->Print();
945 }
946
947 return Error::null();
948}
static ErrorPtr InitIsolateGroupFromSnapshot(Thread *T, const uint8_t *snapshot_data, const uint8_t *snapshot_instructions, const uint8_t *kernel_buffer, intptr_t kernel_buffer_size)
Definition: dart.cc:820
static void VerifyBuiltinVtables()
Definition: object.cc:1634
static void FinalizeBuiltinClasses(Thread *thread)
Definition: dart.cc:896
@ kForbidMarked
Definition: verifier.h:21
#define DEBUG_ONLY(code)
Definition: globals.h:141

◆ InitIsolateGroupFromSnapshot()

ErrorPtr dart::Dart::InitIsolateGroupFromSnapshot ( Thread T,
const uint8_t *  snapshot_data,
const uint8_t *  snapshot_instructions,
const uint8_t *  kernel_buffer,
intptr_t  kernel_buffer_size 
)
static

Definition at line 820 of file dart.cc.

825 {
826 auto IG = T->isolate_group();
827 Error& error = Error::Handle(T->zone());
828 error = Object::Init(IG, kernel_buffer, kernel_buffer_size);
829 if (!error.IsNull()) {
830 return error.ptr();
831 }
832 if (snapshot_data != nullptr && kernel_buffer == nullptr) {
833 // Read the snapshot and setup the initial state.
834#if defined(SUPPORT_TIMELINE)
835 TimelineBeginEndScope tbes(T, Timeline::GetIsolateStream(),
836 "ReadProgramSnapshot");
837#endif // defined(SUPPORT_TIMELINE)
838 const Snapshot* snapshot = Snapshot::SetupFromBuffer(snapshot_data);
839 if (snapshot == nullptr) {
840 const String& message = String::Handle(String::New("Invalid snapshot"));
841 return ApiError::New(message);
842 }
843 if (!IsSnapshotCompatible(vm_snapshot_kind_, snapshot->kind())) {
845 "Incompatible snapshot kinds: vm '%s', isolate '%s'",
846 Snapshot::KindToCString(vm_snapshot_kind_),
847 Snapshot::KindToCString(snapshot->kind())));
848 return ApiError::New(message);
849 }
850 if (FLAG_trace_isolates) {
851 OS::PrintErr("Size of isolate snapshot = %" Pd "\n", snapshot->length());
852 }
853 FullSnapshotReader reader(snapshot, snapshot_instructions, T);
854 const Error& error = Error::Handle(reader.ReadProgramSnapshot());
855 if (!error.IsNull()) {
856 return error.ptr();
857 }
858
859 T->SetupDartMutatorStateDependingOnSnapshot(IG);
860
861#if defined(SUPPORT_TIMELINE)
862 if (tbes.enabled()) {
863 tbes.SetNumArguments(2);
864 tbes.FormatArgument(0, "snapshotSize", "%" Pd, snapshot->length());
865 tbes.FormatArgument(1, "heapSize", "%" Pd,
866 IG->heap()->UsedInWords(Heap::kOld) * kWordSize);
867 }
868#endif // defined(SUPPORT_TIMELINE)
869 if (FLAG_trace_isolates) {
870 IG->heap()->PrintSizes();
872 }
873 } else {
874 if ((vm_snapshot_kind_ != Snapshot::kNone) && kernel_buffer == nullptr) {
875 const String& message =
876 String::Handle(String::New("Missing isolate snapshot"));
877 return ApiError::New(message);
878 }
879 }
880#if !defined(PRODUCT) || defined(FORCE_INCLUDE_SAMPLING_HEAP_PROFILER)
881 IG->class_table()->PopulateUserVisibleNames();
882#endif
883
884 return Error::null();
885}
@ kOld
Definition: heap.h:39
static void PrintSizes(Thread *thread)
static void Init(IsolateGroup *isolate_group)
Definition: object.cc:721
static const Snapshot * SetupFromBuffer(const void *raw_memory)
Definition: snapshot.cc:30
static const char * KindToCString(Kind kind)
Definition: snapshot.cc:12
static StringPtr NewFormatted(const char *format,...) PRINTF_ATTRIBUTE(1
Definition: object.cc:24004
static StringPtr New(const char *cstr, Heap::Space space=Heap::kNew)
Definition: object.cc:23698
Win32Message message
static bool IsSnapshotCompatible(Snapshot::Kind vm_kind, Snapshot::Kind isolate_kind)
Definition: snapshot.h:108
#define Pd
Definition: globals.h:408

◆ IsInitialized()

bool dart::Dart::IsInitialized ( )
static

Definition at line 799 of file dart.cc.

799 {
801}
static bool IsInitialized()
Definition: dart.cc:124

◆ IsReadOnlyApiHandle()

bool dart::Dart::IsReadOnlyApiHandle ( Dart_Handle  handle)
static

Definition at line 1152 of file dart.cc.

1152 {
1153 ASSERT(predefined_handles_ != nullptr);
1154 return predefined_handles_->api_handles_.IsValidHandle(handle);
1155}
bool IsValidHandle(Dart_Handle object) const

◆ IsReadOnlyHandle()

bool dart::Dart::IsReadOnlyHandle ( uword  address)
static

Definition at line 1147 of file dart.cc.

1147 {
1148 ASSERT(predefined_handles_ != nullptr);
1149 return predefined_handles_->handles_.IsValidScopedHandle(address);
1150}
bool IsValidScopedHandle(uword handle) const
Definition: handles_impl.h:175

◆ pprof_symbol_generator()

static DebugInfo * dart::Dart::pprof_symbol_generator ( )
inlinestatic

Definition at line 83 of file dart.h.

83{ return pprof_symbol_generator_; }

◆ ResetActiveApiCall()

void dart::Dart::ResetActiveApiCall ( )
static

Definition at line 807 of file dart.cc.

◆ RunShutdownCallback()

void dart::Dart::RunShutdownCallback ( )
static

Definition at line 1110 of file dart.cc.

1110 {
1111 Thread* thread = Thread::Current();
1112 ASSERT(thread->execution_state() == Thread::kThreadInVM);
1113 Isolate* isolate = thread->isolate();
1114 void* isolate_group_data = isolate->group()->embedder_data();
1115 void* isolate_data = isolate->init_callback_data();
1116 Dart_IsolateShutdownCallback callback = isolate->on_shutdown_callback();
1117 if (callback != nullptr) {
1118 TransitionVMToNative transition(thread);
1119 (callback)(isolate_group_data, isolate_data);
1120 }
1121}
void(* Dart_IsolateShutdownCallback)(void *isolate_group_data, void *isolate_data)
Definition: dart_api.h:711
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback

◆ set_dwarf_stacktrace_footnote_callback()

static void dart::Dart::set_dwarf_stacktrace_footnote_callback ( Dart_DwarfStackTraceFootnoteCallback  cb)
inlinestatic

Definition at line 139 of file dart.h.

140 {
141 dwarf_stacktrace_footnote_callback_ = cb;
142 }

◆ set_entropy_source_callback()

static void dart::Dart::set_entropy_source_callback ( Dart_EntropySource  entropy_source)
inlinestatic

Definition at line 132 of file dart.h.

132 {
133 entropy_source_callback_ = entropy_source;
134 }

◆ set_pprof_symbol_generator()

static void dart::Dart::set_pprof_symbol_generator ( DebugInfo *  value)
inlinestatic

Definition at line 80 of file dart.h.

80 {
81 pprof_symbol_generator_ = value;
82 }
uint8_t value

◆ set_thread_exit_callback()

static void dart::Dart::set_thread_exit_callback ( Dart_ThreadExitCallback  cback)
inlinestatic

Definition at line 106 of file dart.h.

106 {
107 thread_exit_callback_ = cback;
108 }

◆ set_thread_start_callback()

static void dart::Dart::set_thread_start_callback ( Dart_ThreadStartCallback  cback)
inlinestatic

Definition at line 100 of file dart.h.

100 {
101 thread_start_callback_ = cback;
102 }

◆ SetActiveApiCall()

bool dart::Dart::SetActiveApiCall ( )
static

Definition at line 803 of file dart.cc.

803 {
805}
static bool SetInUse()
Definition: dart.cc:140

◆ SetFileCallbacks()

static void dart::Dart::SetFileCallbacks ( Dart_FileOpenCallback  file_open,
Dart_FileReadCallback  file_read,
Dart_FileWriteCallback  file_write,
Dart_FileCloseCallback  file_close 
)
inlinestatic

Definition at line 109 of file dart.h.

112 {
113 file_open_callback_ = file_open;
114 file_read_callback_ = file_read;
115 file_write_callback_ = file_write;
116 file_close_callback_ = file_close;
117 }

◆ ShutdownIsolate()

void dart::Dart::ShutdownIsolate ( Thread T)
static

Definition at line 1123 of file dart.cc.

1123 {
1124 T->isolate()->Shutdown();
1125}

◆ thread_exit_callback()

static Dart_ThreadExitCallback dart::Dart::thread_exit_callback ( )
inlinestatic

Definition at line 103 of file dart.h.

103 {
104 return thread_exit_callback_;
105 }

◆ thread_pool()

static ThreadPool * dart::Dart::thread_pool ( )
inlinestatic

Definition at line 73 of file dart.h.

73{ return thread_pool_; }

◆ thread_start_callback()

static Dart_ThreadStartCallback dart::Dart::thread_start_callback ( )
inlinestatic

Definition at line 97 of file dart.h.

97 {
98 return thread_start_callback_;
99 }

◆ UptimeMicros()

int64_t dart::Dart::UptimeMicros ( )
static

Definition at line 1127 of file dart.cc.

1127 {
1128 return OS::GetCurrentMonotonicMicros() - Dart::start_time_micros_;
1129}
static int64_t GetCurrentMonotonicMicros()

◆ UptimeMillis()

static int64_t dart::Dart::UptimeMillis ( )
inlinestatic

Definition at line 76 of file dart.h.

76 {
78 }
static int64_t UptimeMicros()
Definition: dart.cc:1127
constexpr intptr_t kMicrosecondsPerMillisecond
Definition: globals.h:561

◆ vm_isolate()

static Isolate * dart::Dart::vm_isolate ( )
inlinestatic

Definition at line 68 of file dart.h.

68{ return vm_isolate_; }

◆ vm_isolate_group()

static IsolateGroup * dart::Dart::vm_isolate_group ( )
inlinestatic

Definition at line 69 of file dart.h.

69 {
70 if (vm_isolate_ == nullptr) return nullptr;
71 return vm_isolate_->group();
72 }
IsolateGroup * group() const
Definition: isolate.h:1037

◆ vm_snapshot_kind()

static Snapshot::Kind dart::Dart::vm_snapshot_kind ( )
inlinestatic

Definition at line 95 of file dart.h.

95{ return vm_snapshot_kind_; }

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