Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
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 1133 of file dart.cc.

1133 {
1135 ASSERT(predefined_handles_ != nullptr);
1136 return predefined_handles_->api_handles_.AllocateHandle();
1137}
static Isolate * vm_isolate()
Definition dart.h:68
static Isolate * Current()
Definition isolate.h:939
LocalHandle * AllocateHandle()
#define ASSERT(E)

◆ AllocateReadOnlyHandle()

uword dart::Dart::AllocateReadOnlyHandle ( )
static

Definition at line 1123 of file dart.cc.

1123 {
1125 ASSERT(predefined_handles_ != nullptr);
1126 uword handle = predefined_handles_->handles_.AllocateScopedHandle();
1127#if defined(DEBUG)
1128 *reinterpret_cast<uword*>(handle + kOffsetOfIsZoneHandle * kWordSize) = 0;
1129#endif
1130 return handle;
1131}
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 }
766 Timeline::Cleanup();
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:1115
static int64_t UptimeMillis()
Definition dart.h:76
static void Cleanup()
Definition flags.cc:185
static void Cleanup()
Definition object.cc:17306
static void SetFileModifiedCallback(Dart_FileModifiedCallback callback)
static void Cleanup()
Definition isolate.cc:736
static void DisableIsolateCreation()
Definition isolate.cc:3544
static void KillAllSystemIsolates(LibMsgId msg_id)
Definition isolate.cc:3655
static void KillAllIsolates(LibMsgId msg_id)
Definition isolate.cc:3650
static intptr_t IsolateListLength()
Definition isolate.cc:3495
static bool IsRunning()
static void SetCurrent(OSThread *current)
Definition os_thread.h:182
static OSThread * Current()
Definition os_thread.h:175
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()
Definition page.cc:45
static void Cleanup()
Definition port.cc:261
static void Cleanup()
Definition profiler.cc:599
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:361
static void EnterIsolate(Isolate *isolate)
Definition thread.cc:366
static void Cleanup()
Definition tags.cc:191
static char * StrDup(const char *s)
static void Cleanup()
static void Cleanup()
Definition zone.cc:63
#define Pd64
Definition globals.h:416
#define NOT_IN_PRODUCT(code)
Definition globals.h:84

◆ 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 998 of file dart.cc.

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

◆ 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 944 of file dart.cc.

946 {
947 auto I = T->isolate();
948 auto IG = T->isolate_group();
949 auto Z = T->zone();
950
951 // If a static field gets registered in [IsolateGroup::RegisterStaticField]:
952 //
953 // * before this block it will ignore this isolate. The [Clone] of the
954 // initial field table will pick up the new value.
955 // * after this block it will add the new static field to this isolate.
956 {
957 SafepointReadRwLocker reader(T, IG->program_lock());
958 I->set_field_table(T, IG->initial_field_table()->Clone(I));
959 I->field_table()->MarkReadyToUse();
960 }
961
962 const auto& out_of_memory =
963 Object::Handle(IG->object_store()->out_of_memory());
964 const auto& error = Error::Handle(
965 Z, I->isolate_object_store()->PreallocateObjects(out_of_memory));
966 if (!error.IsNull()) {
967 return error.ptr();
968 }
969
970 I->set_init_callback_data(isolate_data);
971
972#if !defined(PRODUCT)
975 } else {
976 I->message_handler()->set_should_pause_on_start(
977 FLAG_pause_isolates_on_start);
978 I->message_handler()->set_should_pause_on_exit(FLAG_pause_isolates_on_exit);
979 }
980#endif // !defined(PRODUCT)
981
983#if !defined(PRODUCT)
984 I->debugger()->NotifyIsolateCreated();
985#endif
986
987 // Create tag table.
989 // Set up default UserTag.
990 const UserTag& default_tag = UserTag::Handle(UserTag::DefaultTag());
991 I->set_current_tag(default_tag);
992
993 I->init_loaded_prefixes_set_storage();
994
995 return Error::null();
996}
#define IG
#define Z
static GrowableObjectArrayPtr New(Heap::Space space=Heap::kNew)
Definition object.h:11118
static bool IsSystemIsolate(const Isolate *isolate)
Definition isolate.h:1398
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:27053
const uint8_t uint32_t uint32_t GError ** error
#define T
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 DEBUG_ONLY(IG->heap()->Verify("InitializeIsolate", kForbidMarked));
924
925#if !defined(DART_PRECOMPILED_RUNTIME)
927#endif
928
929 if (snapshot_data == nullptr || kernel_buffer != nullptr) {
930 auto object_store = IG->object_store();
931 error ^= object_store->PreallocateObjects();
932 if (!error.IsNull()) {
933 return error.ptr();
934 }
935 }
936
937 if (FLAG_print_class_table) {
938 IG->class_table()->Print();
939 }
940
941 return Error::null();
942}
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:1677
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:24083
static StringPtr New(const char *cstr, Heap::Space space=Heap::kNew)
Definition object.cc:23777
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 1144 of file dart.cc.

1144 {
1145 ASSERT(predefined_handles_ != nullptr);
1146 return predefined_handles_->api_handles_.IsValidHandle(handle);
1147}
bool IsValidHandle(Dart_Handle object) const

◆ IsReadOnlyHandle()

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

Definition at line 1139 of file dart.cc.

1139 {
1140 ASSERT(predefined_handles_ != nullptr);
1141 return predefined_handles_->handles_.IsValidScopedHandle(address);
1142}
bool IsValidScopedHandle(uword handle) const

◆ 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 1102 of file dart.cc.

1102 {
1103 Thread* thread = Thread::Current();
1104 ASSERT(thread->execution_state() == Thread::kThreadInVM);
1105 Isolate* isolate = thread->isolate();
1106 void* isolate_group_data = isolate->group()->embedder_data();
1107 void* isolate_data = isolate->init_callback_data();
1108 Dart_IsolateShutdownCallback callback = isolate->on_shutdown_callback();
1109 if (callback != nullptr) {
1110 TransitionVMToNative transition(thread);
1111 (callback)(isolate_group_data, isolate_data);
1112 }
1113}
void(* Dart_IsolateShutdownCallback)(void *isolate_group_data, void *isolate_data)
Definition dart_api.h:710
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}

◆ 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 1115 of file dart.cc.

1115 {
1116 T->isolate()->Shutdown();
1117}

◆ 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 1119 of file dart.cc.

1119 {
1120 return OS::GetCurrentMonotonicMicros() - Dart::start_time_micros_;
1121}
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:1119
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:990

◆ 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: