75#define SAVE_ERROR_AND_EXIT(result) \
76 *error = Utils::StrDup(Dart_GetError(result)); \
77 if (Dart_IsCompilationError(result)) { \
78 *exit_code = kCompilationErrorExitCode; \
79 } else if (Dart_IsApiError(result)) { \
80 *exit_code = kApiErrorExitCode; \
82 *exit_code = kErrorExitCode; \
85 Dart_ShutdownIsolate(); \
88#define CHECK_RESULT(result) \
89 if (Dart_IsError(result)) { \
90 SAVE_ERROR_AND_EXIT(result); \
93#define CHECK_RESULT_CLEANUP(result, cleanup) \
94 if (Dart_IsError(result)) { \
96 SAVE_ERROR_AND_EXIT(result); \
100 if (Options::depfile() ==
nullptr) {
104 if (
file ==
nullptr) {
109 if (Options::depfile_output_filename() !=
nullptr) {
110 success &=
file->Print(
"%s: ", Options::depfile_output_filename());
112 success &=
file->Print(
"%s: ", Options::snapshot_filename());
119 "Error: Failed to fetch dependencies from kernel service: %s\n\n",
125 success &=
file->Print(
"\n");
136 "A snapshot was requested, but a secondary isolate "
137 "performed a hard exit (%" Pd64 ").\n",
141 if (exit_code == 0) {
142 if (Options::gen_snapshot_kind() ==
kAppJIT) {
151 bool is_isolate_group_start,
152 bool is_kernel_isolate,
153 const char** resolved_packages_config) {
156 const auto script_uri = isolate_group_data->script_url;
172 ASSERT(*resolved_packages_config !=
nullptr);
173#if !defined(DART_PRECOMPILED_RUNTIME)
174 if (is_isolate_group_start) {
175 isolate_group_data->set_resolved_packages_config(
176 *resolved_packages_config);
178 ASSERT(strcmp(isolate_group_data->resolved_packages_config(),
179 *resolved_packages_config) == 0);
193 const char* namespc = is_kernel_isolate ? nullptr : Options::namespc();
203 ASSERT(isolate !=
nullptr);
205 auto isolate_group_data =
208 auto isolate_data =
new IsolateData(isolate_group_data);
209 *child_callback_data = isolate_data;
212 const auto script_uri = isolate_group_data->script_url;
213 const bool isolate_run_app_snapshot =
214 isolate_group_data->RunFromAppSnapshot();
221 if (isolate_run_app_snapshot) {
228 if (isolate_group_data->kernel_buffer() !=
nullptr) {
233 const char* resolved_script_uri =
nullptr;
251 auto isolate_group_data =
253 const char* script_uri = isolate_group_data->
script_url;
258 bool is_main_isolate,
259 const char* script_uri,
260 const char* packages_config,
261 bool isolate_run_app_snapshot,
276 const char* resolved_packages_config =
nullptr;
280 flags->is_kernel_isolate, &resolved_packages_config);
283#if !defined(DART_PRECOMPILED_RUNTIME)
284 auto isolate_group_data = isolate_data->isolate_group_data();
285 const uint8_t* kernel_buffer = isolate_group_data->kernel_buffer().get();
286 intptr_t kernel_buffer_size = isolate_group_data->kernel_buffer_size();
287 if (!isolate_run_app_snapshot && kernel_buffer ==
nullptr &&
290 const char*
format =
"Dart frontend unavailable to compile script %s.";
291 intptr_t
len = snprintf(
nullptr, 0,
format, script_uri) + 1;
300 uint8_t* application_kernel_buffer =
nullptr;
301 intptr_t application_kernel_buffer_size = 0;
306 const bool for_snapshot = Options::gen_snapshot_kind() ==
kAppJIT;
309 const bool embed_sources = Options::gen_snapshot_kind() !=
kAppJIT;
311 &application_kernel_buffer_size,
error, exit_code,
312 resolved_packages_config, for_snapshot,
314 if (application_kernel_buffer ==
nullptr) {
319 isolate_group_data->SetKernelBufferNewlyOwned(
320 application_kernel_buffer, application_kernel_buffer_size);
321 kernel_buffer = application_kernel_buffer;
322 kernel_buffer_size = application_kernel_buffer_size;
324 if (kernel_buffer !=
nullptr) {
334 if (isolate_run_app_snapshot) {
337#if !defined(DART_PRECOMPILED_RUNTIME)
338 if (is_main_isolate) {
341 const char* resolved_script_uri =
nullptr;
344 &resolved_script_uri);
351#if !defined(DART_PRECOMPILED_RUNTIME)
356 if (kernel_buffer !=
nullptr) {
360 const char* resolved_script_uri =
nullptr;
369 0,
nullptr,
nullptr);
375 if ((Options::gen_snapshot_kind() ==
kAppJIT) && is_main_isolate) {
380#if !defined(DART_PRECOMPILED_RUNTIME)
382 const char* isolate_name =
nullptr;
391#if !defined(DART_PRECOMPILER)
393 memset(&native_assets, 0,
sizeof(native_assets));
407 if (*
error !=
nullptr) {
416#if !defined(EXCLUDE_CFE_AND_KERNEL_PLATFORM)
421 const char* packages_config,
428 if (Options::gen_snapshot_kind() ==
kAppJIT) {
429 const uint8_t* kernel_buffer =
nullptr;
430 intptr_t kernel_buffer_size = 0;
432 if (kernel_buffer_size != 0) {
439 kernel_snapshot_uri !=
nullptr ? kernel_snapshot_uri : script_uri;
441 if (packages_config ==
nullptr) {
442 packages_config = Options::packages_file();
448 bool isolate_run_app_snapshot =
false;
451 if ((kernel_snapshot_uri !=
nullptr) &&
453 kernel_snapshot_uri,
false,
454 false)) !=
nullptr) &&
455 app_snapshot->
IsJIT()) {
458 const uint8_t* ignore_vm_snapshot_data;
459 const uint8_t* ignore_vm_snapshot_instructions;
460 isolate_run_app_snapshot =
true;
462 &ignore_vm_snapshot_data, &ignore_vm_snapshot_instructions,
465 uri, packages_config, app_snapshot, isolate_run_app_snapshot);
466 isolate_data =
new IsolateData(isolate_group_data);
470 isolate_group_data, isolate_data,
error);
472 if (isolate ==
nullptr) {
477 delete isolate_group_data;
479 const uint8_t* kernel_service_buffer =
nullptr;
480 intptr_t kernel_service_buffer_size = 0;
482 ASSERT(kernel_service_buffer !=
nullptr);
484 isolate_run_app_snapshot);
486 const_cast<uint8_t*
>(kernel_service_buffer),
487 kernel_service_buffer_size);
488 isolate_data =
new IsolateData(isolate_group_data);
491 kernel_service_buffer, kernel_service_buffer_size,
flags,
492 isolate_group_data, isolate_data,
error);
495 if (isolate ==
nullptr) {
498 delete isolate_group_data;
504 isolate_run_app_snapshot,
flags,
error, exit_code);
512 const char* packages_config,
517 ASSERT(script_uri !=
nullptr);
519 auto isolate_group_data =
523#if defined(DART_PRECOMPILED_RUNTIME)
537 flags->load_vmservice_library =
true;
538 flags->null_safety =
true;
547 if (isolate ==
nullptr) {
548 delete isolate_group_data;
562 bool wait_for_dds_to_advertise_service =
563 !(Options::disable_dart_dev() || Options::disable_dds());
564 bool serve_devtools =
565 Options::enable_devtools() || !Options::disable_devtools();
569 Options::vm_service_dev_mode(), Options::vm_service_auth_disabled(),
570 Options::vm_write_service_info_filename(), Options::trace_loading(),
571 Options::deterministic(), Options::enable_service_port_fallback(),
572 wait_for_dds_to_advertise_service, serve_devtools,
573 Options::enable_observatory(), Options::print_dtd())) {
577 if (Options::compile_all()) {
591#if !defined(DART_PRECOMPILED_RUNTIME)
594 const char* packages_config,
601 if (dartdev_path.get() ==
nullptr) {
603 "Failed to start the Dart CLI isolate. Could not resolve DartDev "
604 "snapshot or kernel.\n");
619 bool isolate_run_app_snapshot =
true;
622 dartdev_path.get(),
false,
623 false)) !=
nullptr) &&
624 app_snapshot->
IsJIT()) {
627 const uint8_t* ignore_vm_snapshot_data;
628 const uint8_t* ignore_vm_snapshot_instructions;
630 &ignore_vm_snapshot_data, &ignore_vm_snapshot_instructions,
634 app_snapshot, isolate_run_app_snapshot);
635 isolate_data =
new IsolateData(isolate_group_data);
642 if (isolate ==
nullptr) {
649 isolate_run_app_snapshot =
false;
650 if (app_snapshot !=
nullptr) {
655 isolate_run_app_snapshot);
656 uint8_t* application_kernel_buffer =
nullptr;
657 intptr_t application_kernel_buffer_size = 0;
658 dfe.
ReadScript(dartdev_path.get(),
nullptr, &application_kernel_buffer,
659 &application_kernel_buffer_size,
false);
661 application_kernel_buffer, application_kernel_buffer_size);
663 isolate_data =
new IsolateData(isolate_group_data);
672 isolate_run_app_snapshot,
flags,
error, exit_code);
678 0,
nullptr,
nullptr);
679 return created_isolate;
686 bool is_main_isolate,
687 const char* script_uri,
689 const char* packages_config,
695 ASSERT(script_uri !=
nullptr);
696 uint8_t* kernel_buffer =
nullptr;
697 std::shared_ptr<uint8_t> kernel_buffer_ptr;
698 intptr_t kernel_buffer_size = 0;
701#if defined(DART_PRECOMPILED_RUNTIME)
704 if (is_main_isolate) {
709 const bool kForceLoadElfFromMemory =
false;
712 if (app_snapshot ==
nullptr || !app_snapshot->
IsAOT()) {
714 "The uri(%s) provided to `Isolate.spawnUri()` does not "
715 "contain a valid AOT snapshot.",
720 const uint8_t* ignore_vm_snapshot_data;
721 const uint8_t* ignore_vm_snapshot_instructions;
723 &ignore_vm_snapshot_data, &ignore_vm_snapshot_instructions,
727 bool isolate_run_app_snapshot =
true;
731 bool isolate_run_app_snapshot =
false;
738 isolate_run_app_snapshot =
true;
741 }
else if (!is_main_isolate) {
743 if (app_snapshot !=
nullptr && app_snapshot->
IsJITorAOT()) {
744 if (app_snapshot->
IsAOT()) {
746 "The uri(%s) provided to `Isolate.spawnUri()` is an "
747 "AOT snapshot and the JIT VM cannot spawn an isolate using it.",
752 isolate_run_app_snapshot =
true;
753 const uint8_t* ignore_vm_snapshot_data;
754 const uint8_t* ignore_vm_snapshot_instructions;
756 &ignore_vm_snapshot_data, &ignore_vm_snapshot_instructions,
761 if (kernel_buffer ==
nullptr && !isolate_run_app_snapshot) {
763 &kernel_buffer_size,
true,
771 script_uri, packages_config, app_snapshot, isolate_run_app_snapshot);
772 if (kernel_buffer !=
nullptr) {
773 if (kernel_buffer_ptr) {
774 isolate_group_data->SetKernelBufferAlreadyOwned(
775 std::move(kernel_buffer_ptr), kernel_buffer_size);
777 isolate_group_data->SetKernelBufferNewlyOwned(kernel_buffer,
785#if !defined(DART_PRECOMPILED_RUNTIME)
787 const uint8_t* platform_kernel_buffer =
nullptr;
788 intptr_t platform_kernel_buffer_size = 0;
789 dfe.
LoadPlatform(&platform_kernel_buffer, &platform_kernel_buffer_size);
790 if (platform_kernel_buffer ==
nullptr) {
791 platform_kernel_buffer = kernel_buffer;
792 platform_kernel_buffer_size = kernel_buffer_size;
794 if (platform_kernel_buffer ==
nullptr) {
795#if defined(EXCLUDE_CFE_AND_KERNEL_PLATFORM)
797 "Binary built with --exclude-kernel-service. Cannot run"
800 FATAL(
"platform_program cannot be nullptr.");
806 isolate_data =
new IsolateData(isolate_group_data);
808 script_uri,
name, platform_kernel_buffer, platform_kernel_buffer_size,
809 flags, isolate_group_data, isolate_data,
error);
811 isolate_data =
new IsolateData(isolate_group_data);
814 isolate_group_data, isolate_data,
error);
817 isolate_data =
new IsolateData(isolate_group_data);
820 isolate_group_data, isolate_data,
error);
824 if (isolate ==
nullptr) {
826 delete isolate_group_data;
829 isolate, is_main_isolate, script_uri, packages_config,
830 isolate_run_app_snapshot,
flags,
error, exit_code);
836 0,
nullptr,
nullptr);
837 return created_isolate;
844 const char* package_root,
845 const char* package_config,
852 ASSERT(package_root ==
nullptr);
854 if (
error !=
nullptr) {
858 bool dontneed_safe =
true;
859#if defined(DART_HOST_OS_LINUX)
862 dontneed_safe =
false;
865 if (Options::force_load_elf_from_memory()) {
866 dontneed_safe =
false;
869 flags->snapshot_is_dontneed_safe = dontneed_safe;
872#if !defined(EXCLUDE_CFE_AND_KERNEL_PLATFORM)
879#if !defined(DART_PRECOMPILED_RUNTIME)
891 bool is_main_isolate =
false;
893 package_config,
flags, callback_data,
897#if !defined(DART_PRECOMPILED_RUNTIME)
899 intptr_t kernel_buffer_size) {
917 auto isolate_data =
reinterpret_cast<IsolateData*
>(callback_data);
922 auto isolate_group_data =
reinterpret_cast<IsolateGroupData*
>(callback_data);
923 delete isolate_group_data;
950 if (
path ==
nullptr) {
965 info->name =
"Dart VM";
969#define CHECK_RESULT(result) \
970 if (Dart_IsError(result)) { \
971 const int exit_code = Dart_IsCompilationError(result) \
972 ? kCompilationErrorExitCode \
974 ErrorExit(exit_code, "%s\n", Dart_GetError(result)); \
978 const char* package_config_override,
981 Syslog::PrintErr(
"Cannot create a script snapshot from an app snapshot.\n");
987 package_config_override);
992 const char* package_config_override,
994 if (script_name !=
nullptr) {
995 const char*
base_name = strrchr(script_name,
'/');
1001 const intptr_t kMaxNameLength = 64;
1002 char name[kMaxNameLength];
1009 char*
error =
nullptr;
1013 flags.is_system_isolate = Options::mark_main_isolate_as_system_isolate();
1014 bool dontneed_safe =
true;
1015#if defined(DART_HOST_OS_LINUX)
1018 dontneed_safe =
false;
1021 if (Options::force_load_elf_from_memory()) {
1022 dontneed_safe =
false;
1025 flags.snapshot_is_dontneed_safe = dontneed_safe;
1028 true, script_name,
"main",
1029 Options::packages_file() ==
nullptr ? package_config_override
1030 : Options::packages_file(),
1033 if (isolate ==
nullptr) {
1039 if (
error !=
nullptr) {
1050 ASSERT(isolate !=
nullptr);
1060#if !defined(DART_PRECOMPILED_RUNTIME)
1061 if (Options::compile_all()) {
1085 const intptr_t kNumIsolateArgs = 2;
1087 isolate_args[0] = main_closure;
1094 kNumIsolateArgs, isolate_args);
1100 if (Options::gen_snapshot_kind() ==
kAppJIT) {
1122 if (strncmp(
path,
"\\\\?\\", 4) == 0) {
1130#if !defined(PRODUCT)
1135 uint8_t* decompressed =
nullptr;
1136 intptr_t decompressed_len = 0;
1138 &decompressed, &decompressed_len);
1151#if !defined(DART_HOST_OS_WINDOWS)
1156 char* script_name =
nullptr;
1158 char* package_config_override =
nullptr;
1159 const int EXTRA_VM_ARGUMENTS = 10;
1160 CommandLineOptions vm_options(argc + EXTRA_VM_ARGUMENTS);
1161 CommandLineOptions dart_options(argc + EXTRA_VM_ARGUMENTS);
1162 bool print_flags_seen =
false;
1163 bool verbose_debug_seen =
false;
1178#if !defined(DART_PRECOMPILED_RUNTIME)
1187 vm_options.AddArgument(
"--new_gen_semi_max_size=16");
1189 vm_options.AddArgument(
"--new_gen_semi_max_size=32");
1191 vm_options.AddArgument(
"--new_gen_growth_factor=4");
1193 auto parse_arguments = [&](
int argc,
char**
argv,
1194 CommandLineOptions* vm_options,
1195 CommandLineOptions* dart_options,
1196 bool parsing_dart_vm_options) {
1199 &script_name, dart_options, &print_flags_seen, &verbose_debug_seen);
1201 if (Options::help_option()) {
1204 }
else if (Options::version_option()) {
1207 }
else if (print_flags_seen) {
1212 if (
error !=
nullptr) {
1227 AppSnapshot* app_snapshot =
nullptr;
1228#if defined(DART_PRECOMPILED_RUNTIME)
1234 const size_t kPathBufSize =
PATH_MAX + 1;
1235 char executable_path[kPathBufSize];
1238 if (app_snapshot !=
nullptr) {
1239 script_name =
argv[0];
1245 for (
int i = 1;
i < argc;
i++) {
1246 dart_options.AddArgument(
argv[
i]);
1251 char** env_argv = Options::GetEnvArguments(&env_argc);
1252 if (env_argv !=
nullptr) {
1255 CommandLineOptions tmp_options(env_argc + EXTRA_VM_ARGUMENTS);
1256 parse_arguments(env_argc, env_argv, &vm_options, &tmp_options,
1264 if (app_snapshot ==
nullptr) {
1265 parse_arguments(argc,
argv, &vm_options, &dart_options,
1271 if (Options::suppress_core_dump()) {
1279 auto try_load_snapshots_lambda = [&](void) ->
void {
1280 if (app_snapshot ==
nullptr) {
1283 const bool force_load_elf_from_memory =
1284 false DEBUG_ONLY(|| Options::force_load_elf_from_memory());
1288 if (app_snapshot !=
nullptr && app_snapshot->IsJITorAOT()) {
1291 "%s is an AOT snapshot and should be run with 'dartaotruntime'\n",
1305 if (script_name !=
nullptr) {
1309 try_load_snapshots_lambda();
1312#if defined(DART_PRECOMPILED_RUNTIME)
1313 vm_options.AddArgument(
"--precompilation");
1315 if (Options::gen_snapshot_kind() ==
kAppJIT) {
1319 vm_options.AddArgument(
"--target-unknown-cpu");
1320#if !defined(TARGET_ARCH_IA32)
1321 vm_options.AddArgument(
"--link_natives_lazily");
1327 if ((Options::gen_snapshot_kind() ==
kAppJIT) ||
1328 (Options::depfile() !=
nullptr)) {
1332 char*
error =
nullptr;
1340 if (
error !=
nullptr) {
1348#if !defined(DART_PRECOMPILED_RUNTIME)
1352 if (script_name !=
nullptr) {
1353 uint8_t* application_kernel_buffer =
nullptr;
1354 intptr_t application_kernel_buffer_size = 0;
1355 dfe.
ReadScript(script_name, app_snapshot, &application_kernel_buffer,
1356 &application_kernel_buffer_size);
1357 if (application_kernel_buffer !=
nullptr) {
1360 application_kernel_buffer_size);
1368 memset(&init_params, 0,
sizeof(init_params));
1383#if !defined(DART_PRECOMPILED_RUNTIME)
1393#if defined(DART_HOST_OS_FUCHSIA)
1394#if defined(DART_PRECOMPILED_RUNTIME)
1395 init_params.vmex_resource = ZX_HANDLE_INVALID;
1397 init_params.vmex_resource = Platform::GetVMEXResource();
1402 if (
error !=
nullptr) {
1413 bool ran_dart_dev =
false;
1414 bool should_run_user_program =
true;
1415#if !defined(DART_PRECOMPILED_RUNTIME)
1422 ran_dart_dev =
true;
1423 should_run_user_program =
1425 if (should_run_user_program) {
1426 try_load_snapshots_lambda();
1428 }
else if (script_name ==
nullptr &&
1431 "Snapshot generation should be done using the 'dart compile' "
1437 if (should_run_user_program) {
1438 if (Options::gen_snapshot_kind() ==
kKernel) {
1442 RunMainIsolate(script_name, package_config_override, &dart_options);
1450 if (
error !=
nullptr) {
1457 delete app_snapshot;
1459 if (ran_dart_dev && script_name !=
nullptr) {
1464 if (argv_converted) {
1465 for (
int i = 0;
i < argc;
i++) {
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
static std::string base_name(const std::string &path)
static void PrintErr(const char *format,...) PRINTF_ATTRIBUTE(1
static int SNPrint(char *str, size_t size, const char *format,...) PRINTF_ATTRIBUTE(3
static char * StrDup(const char *s)
static char * SCreate(const char *format,...) PRINTF_ATTRIBUTE(1
virtual void SetBuffers(const uint8_t **vm_data_buffer, const uint8_t **vm_instructions_buffer, const uint8_t **isolate_data_buffer, const uint8_t **isolate_instructions_buffer)=0
static void SetNativeResolver(BuiltinLibraryId id)
Dart_Handle CreateRuntimeOptions()
void CompileAndReadScript(const char *script_uri, uint8_t **kernel_buffer, intptr_t *kernel_buffer_size, char **error, int *exit_code, const char *package_config, bool for_snapshot, bool embed_sources)
bool CanUseDartFrontend() const
void set_use_dfe(bool value=true)
void set_verbosity(Dart_KernelCompilationVerbosityLevel verbosity)
void set_application_kernel_buffer(uint8_t *buffer, intptr_t size)
bool UseDartFrontend() const
void LoadPlatform(const uint8_t **kernel_buffer, intptr_t *kernel_buffer_size)
const char * RegisterKernelBlob(const uint8_t *kernel_buffer, intptr_t kernel_buffer_size)
void application_kernel_buffer(const uint8_t **buffer, intptr_t *size) const
void UnregisterKernelBlob(const char *uri)
void ReadScript(const char *script_uri, const AppSnapshot *app_snapshot, uint8_t **kernel_buffer, intptr_t *kernel_buffer_size, bool decode_uri=true, std::shared_ptr< uint8_t > *kernel_blob_ptr=nullptr)
void LoadKernelService(const uint8_t **kernel_service_buffer, intptr_t *kernel_service_buffer_size)
char * frontend_filename() const
static bool should_run_dart_dev()
static CStringUniquePtr TryResolveDartDevSnapshotPath()
static DartDev_Result RunDartDev(Dart_IsolateGroupCreateCallback create_isolate, char **packages_file, char **script, CommandLineOptions *dart_options)
static Dart_Handle SetupPackageConfig(const char *packages_file)
static void ReadFile(uint8_t **data, intptr_t *file_len, void *stream)
static Dart_Handle MakeUint8Array(const void *buffer, intptr_t length)
static Dart_Handle SetupIOLibrary(const char *namespc_path, const char *script_uri, bool disable_exit)
static bool EntropySource(uint8_t *buffer, intptr_t length)
static Dart_Handle EnvironmentCallback(Dart_Handle name)
static Dart_Handle PrepareForScriptLoading(bool is_service_isolate, bool trace_loading)
static void SetEnvironment(dart::SimpleHashMap *environment)
static void CloseFile(void *stream)
static void * OpenFile(const char *name, bool write)
static Dart_Handle ResolveScript(Dart_Handle url)
static void WriteFile(const void *buffer, intptr_t num_bytes, void *stream)
static void LoadDartProfilerSymbols(const char *exepath)
static CStringUniquePtr UriToPath(const char *uri)
static void Stat(Namespace *namespc, const char *path, int64_t *data)
static File * Open(Namespace *namespc, const char *path, FileOpenMode mode)
const char * packages_file() const
IsolateGroupData * isolate_group_data() const
void SetKernelBufferNewlyOwned(uint8_t *buffer, intptr_t size)
void SetKernelBufferUnowned(uint8_t *buffer, intptr_t size)
static Dart_Handle InitForSnapshot(const char *snapshot_uri, IsolateData *isolate_data)
static Dart_Handle DeferredLoadHandler(intptr_t loading_unit_id)
static Dart_Handle LibraryTagHandler(Dart_LibraryTag tag, Dart_Handle library, Dart_Handle url)
static void * DlopenSystem(const char *path, char **error)
static void * DlopenExecutable(char **error)
static void * DlopenProcess(char **error)
static void * DlopenRelative(const char *path, const char *script_uri, char **error)
static void * Dlsym(void *handle, const char *symbol, char **error)
static void * DlopenAbsolute(const char *path, char **error)
static void PrintVersion()
static void set_dfe(DFE *dfe)
static Dart_KernelCompilationVerbosityLevel verbosity_level()
static bool ParseArguments(int argc, char **argv, bool vm_run_app_snapshot, bool parsing_dart_vm_options, CommandLineOptions *vm_options, char **script_name, CommandLineOptions *dart_options, bool *print_flags_seen, bool *verbose_debug_seen)
static const char * vm_service_server_ip()
static int vm_service_server_port()
static dart::SimpleHashMap * environment()
static void GetRSSInformation(int64_t *max_rss, int64_t *current_rss)
static void TerminateExitCodeHandler()
static int GlobalExitCode()
static void SetExitHook(ExitHook hook)
static bool GetUtf8Argv(int argc, char **argv)
static AppSnapshot * TryReadAppSnapshot(const char *script_uri, bool force_load_elf_from_memory=false, bool decode_uri=true)
static AppSnapshot * TryReadAppendedAppSnapshotElf(const char *container_path)
static void GenerateKernel(const char *snapshot_filename, const char *script_name, const char *package_config)
static void GenerateAppJIT(const char *snapshot_filename)
static const char * GetErrorMessage()
static void SetNativeResolver()
static bool Setup(const char *server_ip, intptr_t server_port, bool dev_mode_server, bool auth_codes_disabled, const char *write_service_info_filename, bool trace_loading, bool deterministic, bool enable_service_port_fallback, bool wait_for_dds_to_advertise_service, bool serve_devtools, bool serve_observatory, bool print_dtd)
#define DART_FLAGS_CURRENT_VERSION
#define DART_INITIALIZE_PARAMS_CURRENT_VERSION
@ Dart_KernelCompilationStatus_Ok
#define DART_KERNEL_ISOLATE_NAME
struct _Dart_Handle * Dart_Handle
struct _Dart_Isolate * Dart_Isolate
Dart_Handle(* Dart_GetVMServiceAssetsArchive)(void)
#define DART_VM_SERVICE_ISOLATE_NAME
#define DART_DEV_ISOLATE_NAME
FlutterSemanticsFlag flags
const uint8_t uint32_t uint32_t GError ** error
uint32_t uint32_t * format
#define CHECK_RESULT(result)
const uint8_t kDartVmSnapshotData[]
const uint8_t kDartVmSnapshotInstructions[]
const uint8_t kDartCoreIsolateSnapshotInstructions[]
const uint8_t kDartCoreIsolateSnapshotData[]
static bool FileModifiedCallback(const char *url, int64_t since)
const uint8_t * isolate_snapshot_data
unsigned int observatory_assets_archive_len
static void DeleteIsolateGroupData(void *callback_data)
static const char * RegisterKernelBlob(const uint8_t *kernel_buffer, intptr_t kernel_buffer_size)
void SetCaptureStdout(bool value)
static Dart_Isolate IsolateSetupHelper(Dart_Isolate isolate, bool is_main_isolate, const char *script_uri, const char *packages_config, bool isolate_run_app_snapshot, Dart_IsolateFlags *flags, char **error, int *exit_code)
static constexpr const char * kStderrStreamId
static void UnregisterKernelBlob(const char *kernel_blob_uri)
static void CompileAndSaveKernel(const char *script_name, const char *package_config_override, CommandLineOptions *dart_options)
static void * NativeAssetsDlopenRelative(const char *path, char **error)
static Dart_Isolate CreateAndSetupServiceIsolate(const char *script_uri, const char *packages_config, Dart_IsolateFlags *flags, char **error, int *exit_code)
const uint8_t * vm_snapshot_data
static Dart_Isolate CreateAndSetupDartDevIsolate(const char *script_uri, const char *packages_config, Dart_IsolateFlags *flags, char **error, int *exit_code)
static bool OnIsolateInitialize(void **child_callback_data, char **error)
const uint8_t * vm_snapshot_instructions
void RunMainIsolate(const char *script_name, const char *package_config_override, CommandLineOptions *dart_options)
static void ServiceStreamCancelCallback(const char *stream_id)
static void WriteDepsFile()
const uint8_t * core_isolate_snapshot_data
static bool vm_run_app_snapshot
static char * app_script_uri
static constexpr const char * kStdoutStreamId
int main(int argc, char **argv)
static void DeleteIsolateData(void *isolate_group_data, void *callback_data)
const uint8_t * observatory_assets_archive
constexpr int kErrorExitCode
static Dart_Isolate main_isolate
Dart_Handle GetVMServiceAssetsArchiveCallback()
static Dart_Handle SetupCoreLibraries(Dart_Isolate isolate, IsolateData *isolate_data, bool is_isolate_group_start, bool is_kernel_isolate, const char **resolved_packages_config)
static bool ServiceStreamListenCallback(const char *stream_id)
static bool kernel_isolate_is_running
const uint8_t * core_isolate_snapshot_instructions
static void OnExitHook(int64_t exit_code)
static Dart_Isolate CreateIsolateGroupAndSetup(const char *script_uri, const char *main, const char *package_root, const char *package_config, Dart_IsolateFlags *flags, void *callback_data, char **error)
void InitializeCrashpadClient()
void SetCaptureStderr(bool value)
static const uint8_t * app_isolate_snapshot_data
static const uint8_t * app_isolate_snapshot_instructions
void ErrorExit(int exit_code, const char *format,...)
static void OnIsolateShutdown(void *isolate_group_data, void *isolate_data)
static void EmbedderInformationCallback(Dart_EmbedderInformation *info)
void Decompress(const uint8_t *input, intptr_t input_len, uint8_t **output, intptr_t *output_length)
static Dart_Isolate CreateIsolateGroupAndSetupHelper(bool is_main_isolate, const char *script_uri, const char *name, const char *packages_config, Dart_IsolateFlags *flags, void *callback_data, char **error, int *exit_code)
static Dart_Isolate CreateAndSetupKernelIsolate(const char *script_uri, const char *packages_config, Dart_IsolateFlags *flags, char **error, int *exit_code)
const uint8_t * isolate_snapshot_instructions
static bool CheckForInvalidPath(const char *path)
bool InitOnce(char **error)
DART_EXPORT bool Dart_IsCompilationError(Dart_Handle object)
DART_EXPORT void Dart_EnterScope()
DART_EXPORT Dart_Port Dart_GetMainPortId()
DART_EXPORT Dart_Handle Dart_GetStickyError()
DART_EXPORT void Dart_EnterIsolate(Dart_Isolate isolate)
DART_EXPORT Dart_Handle Dart_DebugName()
DART_EXPORT char * Dart_SetServiceStreamCallbacks(Dart_ServiceStreamListenCallback listen_callback, Dart_ServiceStreamCancelCallback cancel_callback)
DART_EXPORT Dart_Handle Dart_Invoke(Dart_Handle target, Dart_Handle name, int number_of_arguments, Dart_Handle *arguments)
DART_EXPORT Dart_Handle Dart_RootLibrary()
DART_EXPORT void Dart_SetEmbedderInformationCallback(Dart_EmbedderInformationCallback callback)
void * malloc(size_t size)
DART_EXPORT void Dart_SetShouldPauseOnExit(bool should_pause)
DART_EXPORT void Dart_IsolateFlagsInitialize(Dart_IsolateFlags *flags)
DART_EXPORT Dart_Handle Dart_SetDeferredLoadHandler(Dart_DeferredLoadHandler handler)
DART_EXPORT const char * Dart_GetError(Dart_Handle handle)
DART_EXPORT void Dart_RecordTimelineEvent(const char *label, int64_t timestamp0, int64_t timestamp1_or_id, intptr_t flow_id_count, const int64_t *flow_ids, Dart_Timeline_Event_Type type, intptr_t argument_count, const char **argument_names, const char **argument_values)
DART_EXPORT char * Dart_SetFileModifiedCallback(Dart_FileModifiedCallback file_modified_callback)
DART_EXPORT char * Dart_Initialize(Dart_InitializeParams *params)
DART_EXPORT Dart_Handle Dart_GetField(Dart_Handle container, Dart_Handle name)
DART_EXPORT void Dart_InitializeNativeAssetsResolver(NativeAssetsApi *native_assets_api)
DART_EXPORT Dart_Isolate Dart_CurrentIsolate()
DART_EXPORT bool Dart_IsKernelIsolate(Dart_Isolate isolate)
DART_EXPORT char * Dart_Cleanup()
DART_EXPORT bool Dart_IsError(Dart_Handle handle)
DART_EXPORT void Dart_ExitIsolate()
DART_EXPORT void * Dart_IsolateData(Dart_Isolate isolate)
DART_EXPORT char * Dart_IsolateMakeRunnable(Dart_Isolate isolate)
DART_EXPORT Dart_Isolate Dart_CreateIsolateGroup(const char *script_uri, const char *name, const uint8_t *snapshot_data, const uint8_t *snapshot_instructions, Dart_IsolateFlags *flags, void *isolate_group_data, void *isolate_data, char **error)
DART_EXPORT Dart_Handle Dart_RunLoop()
DART_EXPORT void * Dart_CurrentIsolateGroupData()
DART_EXPORT bool Dart_IsPrecompiledRuntime()
DART_EXPORT Dart_Isolate Dart_CreateIsolateGroupFromKernel(const char *script_uri, const char *name, const uint8_t *kernel_buffer, intptr_t kernel_buffer_size, Dart_IsolateFlags *flags, void *isolate_group_data, void *isolate_data, char **error)
DART_EXPORT char * Dart_SetVMFlags(int argc, const char **argv)
DART_EXPORT Dart_KernelCompilationResult Dart_KernelListDependencies()
DART_EXPORT Dart_Handle Dart_SetLibraryTagHandler(Dart_LibraryTagHandler handler)
DART_EXPORT Dart_Handle Dart_SortClasses()
DART_EXPORT Dart_Handle Dart_CompileAll()
constexpr intptr_t kWordSize
DART_EXPORT Dart_Handle Dart_LookupLibrary(Dart_Handle url)
DART_EXPORT Dart_Handle Dart_LoadScriptFromKernel(const uint8_t *buffer, intptr_t buffer_size)
DART_EXPORT int64_t Dart_TimelineGetMicros()
DART_EXPORT bool Dart_IsNull(Dart_Handle object)
DART_EXPORT Dart_Handle Dart_SetEnvironmentCallback(Dart_EnvironmentCallback callback)
DART_EXPORT Dart_Handle Dart_Null()
static int8_t data[kExtLength]
DART_EXPORT Dart_Handle Dart_StringToCString(Dart_Handle object, const char **cstr)
DART_EXPORT bool Dart_IsClosure(Dart_Handle object)
DART_EXPORT Dart_Handle Dart_NewStringFromCString(const char *str)
DART_EXPORT bool Dart_IsFatalError(Dart_Handle object)
DART_EXPORT void Dart_SetShouldPauseOnStart(bool should_pause)
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
Dart_IsolateGroupCreateCallback create_group
Dart_InitializeIsolateCallback initialize_isolate
Dart_IsolateGroupCleanupCallback cleanup_group
Dart_FileReadCallback file_read
const uint8_t * vm_snapshot_data
bool start_kernel_isolate
Dart_GetVMServiceAssetsArchive get_service_assets
Dart_FileOpenCallback file_open
Dart_IsolateShutdownCallback shutdown_isolate
Dart_UnregisterKernelBlobCallback unregister_kernel_blob
Dart_FileWriteCallback file_write
Dart_EntropySource entropy_source
Dart_RegisterKernelBlobCallback register_kernel_blob
Dart_IsolateCleanupCallback cleanup_isolate
const uint8_t * vm_snapshot_instructions
Dart_FileCloseCallback file_close
Dart_NativeAssetsDlopenCallback dlopen_system
Dart_NativeAssetsDlopenCallback dlopen_absolute
Dart_NativeAssetsDlopenCallbackNoPath dlopen_process
Dart_NativeAssetsDlopenCallback dlopen_relative
Dart_NativeAssetsDlsymCallback dlsym
Dart_NativeAssetsDlopenCallbackNoPath dlopen_executable