141 {
143 (snapshot_kind == kVMAOTAssembly);
144}
145
146
148 Syslog::PrintErr(
149"Usage: gen_snapshot [<vm-flags>] [<options>] <dart-kernel-file> \n"
150" \n"
151"Common options: \n"
152"--help \n"
153" Display this message (add --verbose for information about all VM options).\n"
154"--version \n"
155" Print the SDK version. \n"
156" \n"
157"To create a core snapshot: \n"
158"--snapshot_kind=core \n"
159"--vm_snapshot_data=<output-file> \n"
160"--isolate_snapshot_data=<output-file> \n"
161"<dart-kernel-file> \n"
162" \n"
163"To create an AOT application snapshot as assembly suitable for compilation \n"
164"as a static or dynamic library: \n"
165"--snapshot_kind=app-aot-assembly \n"
166"--assembly=<output-file> \n"
167"[--strip] \n"
168"[--obfuscate] \n"
169"[--save-debugging-info=<debug-filename>] \n"
170"[--save-obfuscation-map=<map-filename>] \n"
171"<dart-kernel-file> \n"
172" \n"
173"To create an AOT application snapshot as an ELF shared library: \n"
174"--snapshot_kind=app-aot-elf \n"
175"--elf=<output-file> \n"
176"[--strip] \n"
177"[--obfuscate] \n"
178"[--save-debugging-info=<debug-filename>] \n"
179"[--save-obfuscation-map=<map-filename>] \n"
180"<dart-kernel-file> \n"
181" \n"
182"AOT snapshots can be obfuscated: that is all identifiers will be renamed \n"
183"during compilation. This mode is enabled with --obfuscate flag. Mapping \n"
184"between original and obfuscated names can be serialized as a JSON array \n"
185"using --save-obfuscation-map=<filename> option. See dartbug.com/30524 \n"
186"for implementation details and limitations of the obfuscation pass. \n"
187" \n"
188"\n");
189 if (verbose) {
190 Syslog::PrintErr(
191"The following options are only used for VM development and may\n"
192"be changed in any future version:\n");
193 const char* print_flags = "--print_flags";
196 }
197}
198
199
200
201
203 char** argv,
204 CommandLineOptions* vm_options,
205 CommandLineOptions* inputs) {
206
207 int i = 1;
208
209
210 while ((i < argc) && OptionProcessor::IsValidShortFlag(argv[i])) {
211 if (OptionProcessor::TryProcess(argv[i], vm_options)) {
212 i += 1;
213 continue;
214 }
215 vm_options->AddArgument(argv[i]);
216 i += 1;
217 }
218
219
220 while (i < argc) {
221 inputs->AddArgument(argv[i]);
222 i++;
223 }
224
225 if (help) {
227 Platform::Exit(0);
228 } else if (version) {
230 Platform::Exit(0);
231 }
232
233
234 if (
inputs->count() < 1) {
235 Syslog::PrintErr("At least one input is required\n");
236 return -1;
237 }
238
239 switch (snapshot_kind) {
241 if ((vm_snapshot_data_filename == nullptr) ||
242 (isolate_snapshot_data_filename == nullptr)) {
243 Syslog::PrintErr(
244 "Building a core snapshot requires specifying output files for "
245 "--vm_snapshot_data and --isolate_snapshot_data.\n\n");
246 return -1;
247 }
248 break;
249 }
252 if ((load_vm_snapshot_data_filename == nullptr) ||
253 (isolate_snapshot_data_filename == nullptr) ||
254 (isolate_snapshot_instructions_filename == nullptr)) {
255 Syslog::PrintErr(
256 "Building an app JIT snapshot requires specifying input files for "
257 "--load_vm_snapshot_data and --load_vm_snapshot_instructions, an "
258 " output file for --isolate_snapshot_data, and an output "
259 "file for --isolate_snapshot_instructions.\n\n");
260 return -1;
261 }
262 break;
263 }
265 if (elf_filename == nullptr) {
266 Syslog::PrintErr(
267 "Building an AOT snapshot as ELF requires specifying "
268 "an output file for --elf.\n\n");
269 return -1;
270 }
271 break;
272 }
275 if (assembly_filename == nullptr) {
276 Syslog::PrintErr(
277 "Building an AOT snapshot as assembly requires specifying "
278 "an output file for --assembly.\n\n");
279 return -1;
280 }
281 break;
282 }
283 }
284
285 if (!obfuscate && obfuscation_map_filename != nullptr) {
286 Syslog::PrintErr(
287 "--save-obfuscation_map=<...> should only be specified when "
288 "obfuscation is enabled by the --obfuscate flag.\n\n");
289 return -1;
290 }
291
293 if (obfuscate) {
294 Syslog::PrintErr(
295 "Obfuscation can only be enabled when building an AOT snapshot.\n\n");
296 return -1;
297 }
298
299 if (debugging_info_filename != nullptr) {
300 Syslog::PrintErr(
301 "--save-debugging-info=<...> can only be enabled when building an "
302 "AOT snapshot.\n\n");
303 return -1;
304 }
305
306 if (strip) {
307 Syslog::PrintErr(
308 "Stripping can only be enabled when building an AOT snapshot.\n\n");
309 return -1;
310 }
311 }
312
313 return 0;
314}
315
321
324 exit(kErrorExitCode);
325}
326
327static File*
OpenFile(
const char* filename) {
328 File*
file = File::Open(
nullptr, filename, File::kWriteTruncate);
329 if (file == nullptr) {
330 PrintErrAndExit("Error: Unable to write file: %s\n\n", filename);
331 }
333}
334
335static void WriteFile(
const char* filename,
337 const intptr_t size) {
339 RefCntReleaseScope<File> rs(file);
341 PrintErrAndExit("Error: Unable to write file: %s\n\n", filename);
342 }
343}
344
345static void ReadFile(
const char* filename, uint8_t**
buffer, intptr_t* size) {
346 File*
file = File::Open(
nullptr, filename, File::kRead);
347 if (file == nullptr) {
348 PrintErrAndExit("Error: Unable to read file: %s\n", filename);
349 }
350 RefCntReleaseScope<File> rs(file);
354 PrintErrAndExit("Error: Unable to read file: %s\n", filename);
355 }
356}
357
359 free(peer);
360}
361
363 for (intptr_t i = 1; i <
inputs.count(); i++) {
364 uint8_t*
buffer =
nullptr;
372 }
373}
374
376 if (compile_all && (snapshot_kind == kAppJIT)) {
379 }
380}
381
383 ASSERT(snapshot_kind == kCore);
384 ASSERT(vm_snapshot_data_filename !=
nullptr);
385 ASSERT(isolate_snapshot_data_filename !=
nullptr);
386
388 uint8_t* vm_snapshot_data_buffer = nullptr;
389 intptr_t vm_snapshot_data_size = 0;
390 uint8_t* isolate_snapshot_data_buffer = nullptr;
391 intptr_t isolate_snapshot_data_size = 0;
392
393
395 &isolate_snapshot_data_buffer,
396 &isolate_snapshot_data_size,
397 true);
399
400
401
402 WriteFile(vm_snapshot_data_filename, vm_snapshot_data_buffer,
403 vm_snapshot_data_size);
404 if (vm_snapshot_instructions_filename != nullptr) {
405
406 WriteFile(vm_snapshot_instructions_filename,
nullptr, 0);
407 }
408 WriteFile(isolate_snapshot_data_filename, isolate_snapshot_data_buffer,
409 isolate_snapshot_data_size);
410 if (isolate_snapshot_instructions_filename != nullptr) {
411
412 WriteFile(isolate_snapshot_instructions_filename,
nullptr, 0);
413 }
414}
415
416static std::unique_ptr<MappedMemory>
MapFile(
const char* filename,
419 File*
file = File::Open(
nullptr, filename, File::kRead);
420 if (file == nullptr) {
421 Syslog::PrintErr("Failed to open: %s\n", filename);
422 exit(kErrorExitCode);
423 }
424 RefCntReleaseScope<File> rs(file);
427
429 return nullptr;
430 }
432 if (mapping == nullptr) {
433 Syslog::PrintErr("Failed to read: %s\n", filename);
434 exit(kErrorExitCode);
435 }
436 *
buffer =
reinterpret_cast<const uint8_t*
>(mapping->address());
437 return std::unique_ptr<MappedMemory>(mapping);
438}
439
441 ASSERT(snapshot_kind == kApp);
442 ASSERT(isolate_snapshot_data_filename !=
nullptr);
443
445 uint8_t* isolate_snapshot_data_buffer = nullptr;
446 intptr_t isolate_snapshot_data_size = 0;
447
449 &isolate_snapshot_data_size, false);
451
452 WriteFile(isolate_snapshot_data_filename, isolate_snapshot_data_buffer,
453 isolate_snapshot_data_size);
454 if (isolate_snapshot_instructions_filename != nullptr) {
455
456 WriteFile(isolate_snapshot_instructions_filename,
nullptr, 0);
457 }
458}
459
461 ASSERT(snapshot_kind == kAppJIT);
462 ASSERT(isolate_snapshot_data_filename !=
nullptr);
463 ASSERT(isolate_snapshot_instructions_filename !=
nullptr);
464
466 uint8_t* isolate_snapshot_data_buffer = nullptr;
467 intptr_t isolate_snapshot_data_size = 0;
468 uint8_t* isolate_snapshot_instructions_buffer = nullptr;
469 intptr_t isolate_snapshot_instructions_size = 0;
470
472 &isolate_snapshot_data_buffer, &isolate_snapshot_data_size,
473 &isolate_snapshot_instructions_buffer,
474 &isolate_snapshot_instructions_size);
476
477 WriteFile(isolate_snapshot_data_filename, isolate_snapshot_data_buffer,
478 isolate_snapshot_data_size);
479 WriteFile(isolate_snapshot_instructions_filename,
480 isolate_snapshot_instructions_buffer,
481 isolate_snapshot_instructions_size);
482}
483
486 intptr_t size) {
487 File*
file =
reinterpret_cast<File*
>(callback_data);
488 if ((file !=
nullptr) && !
file->WriteFully(
buffer, size)) {
489 PrintErrAndExit("Error: Unable to write snapshot file\n\n");
490 }
491}
492
494 File*
file =
reinterpret_cast<File*
>(callback_data);
496}
497
499 File* manifest_file =
OpenFile(loading_unit_manifest_filename);
500 if (!manifest_file->Print("{ \"loadingUnits\": [\n ")) {
501 PrintErrAndExit("Error: Unable to write file: %s\n\n",
502 loading_unit_manifest_filename);
503 }
504 return manifest_file;
505}
506
508 intptr_t id,
509 const char* path,
510 const char* debug_path = nullptr) {
511 TextBuffer
line(128);
512 if (id != 1) {
513 line.AddString(
",\n ");
514 }
515 line.Printf(
"{\n \"id\": %" Pd ",\n \"path\": \"",
id);
516 line.AddEscapedString(path);
517 if (debug_path != nullptr) {
518 line.Printf(
"\",\n \"debugPath\": \"");
519 line.AddEscapedString(debug_path);
520 }
521 line.AddString(
"\",\n \"libraries\": [\n ");
526 for (intptr_t i = 0; i <
length; i++) {
527 const char* uri;
529 if (i != 0) {
530 line.AddString(
",\n ");
531 }
532 line.AddString(
"\"");
533 line.AddEscapedString(uri);
534 line.AddString(
"\"");
535 }
536 line.AddString(
"\n ]}");
537 if (!manifest_file->Print(
"%s",
line.buffer())) {
538 PrintErrAndExit("Error: Unable to write file: %s\n\n",
539 loading_unit_manifest_filename);
540 }
541}
542
544 if (!manifest_file->Print("]}\n")) {
545 PrintErrAndExit("Error: Unable to write file: %s\n\n",
546 loading_unit_manifest_filename);
547 }
548 manifest_file->Release();
549}
550
552 intptr_t loading_unit_id,
553 void** write_callback_data,
554 void** write_debug_callback_data,
555 const char* main_filename,
556 const char* suffix) {
557 char* filename = loading_unit_id == 1
558 ? Utils::StrDup(main_filename)
559 : Utils::SCreate(
"%s-%" Pd ".part.%s", main_filename,
562 *write_callback_data =
file;
563
564 char* debug_filename = nullptr;
565 if (debugging_info_filename != nullptr) {
566 debug_filename =
567 loading_unit_id == 1
568 ? Utils::StrDup(debugging_info_filename)
569 : Utils::SCreate(
"%s-%" Pd ".part.so", debugging_info_filename,
570 loading_unit_id);
571 File* debug_file =
OpenFile(debug_filename);
572 *write_debug_callback_data = debug_file;
573 }
574
576 loading_unit_id, filename, debug_filename);
577 free(debug_filename);
578
579 free(filename);
580}
581
583 intptr_t loading_unit_id,
584 void** write_callback_data,
585 void** write_debug_callback_data) {
587 write_debug_callback_data, assembly_filename, "S");
588}
589
591 intptr_t loading_unit_id,
592 void** write_callback_data,
593 void** write_debug_callback_data) {
595 write_debug_callback_data, elf_filename, "so");
596}
597
601
602
605
606
607 if (snapshot_kind == kAppAOTAssembly) {
608 if (strip && (debugging_info_filename == nullptr)) {
609 Syslog::PrintErr(
610 "Warning: Generating assembly code without DWARF debugging"
611 " information.\n");
612 }
613 if (loading_unit_manifest_filename == nullptr) {
615 RefCntReleaseScope<File> rs(file);
616 File* debug_file = nullptr;
617 if (debugging_info_filename != nullptr) {
618 debug_file =
OpenFile(debugging_info_filename);
619 }
621 strip, debug_file);
622 if (debug_file != nullptr) debug_file->Release();
624 } else {
627 NextAsmCallback, manifest_file, strip, StreamingWriteCallback,
628 StreamingCloseCallback);
631 }
632 if (obfuscate && !strip) {
633 Syslog::PrintErr(
634 "Warning: The generated assembly code contains unobfuscated DWARF "
635 "debugging information.\n"
636 " To avoid this, use --strip to remove it.\n");
637 }
638 } else if (snapshot_kind == kAppAOTElf) {
639 if (strip && (debugging_info_filename == nullptr)) {
640 Syslog::PrintErr(
641 "Warning: Generating ELF library without DWARF debugging"
642 " information.\n");
643 }
644 if (loading_unit_manifest_filename == nullptr) {
646 RefCntReleaseScope<File> rs(file);
647 File* debug_file = nullptr;
648 if (debugging_info_filename != nullptr) {
649 debug_file =
OpenFile(debugging_info_filename);
650 }
652 strip, debug_file);
653 if (debug_file != nullptr) debug_file->Release();
655 } else {
658 strip, StreamingWriteCallback,
659 StreamingCloseCallback);
662 }
663 if (obfuscate && !strip) {
664 Syslog::PrintErr(
665 "Warning: The generated ELF library contains unobfuscated DWARF "
666 "debugging information.\n"
667 " To avoid this, use --strip to remove it and "
668 "--save-debugging-info=<...> to save it to a separate file.\n");
669 }
670 } else {
672 }
673
674
675 if (obfuscation_map_filename != nullptr) {
677 uint8_t*
buffer =
nullptr;
682 }
683}
684
686 uint8_t* kernel_buffer = nullptr;
687 intptr_t kernel_buffer_size = 0;
688 ReadFile(
inputs.GetArgument(0), &kernel_buffer, &kernel_buffer_size);
689
694 }
695
696 auto isolate_group_data = std::unique_ptr<IsolateGroupData>(
697 new IsolateGroupData(nullptr, nullptr, nullptr, false));
699 char*
error =
nullptr;
700
701 bool loading_kernel_failed = false;
702 if (isolate_snapshot_data == nullptr) {
703
704
707 nullptr, nullptr, kernel_buffer, kernel_buffer_size, &isolate_flags,
708 isolate_group_data.get(),
nullptr, &
error);
709 loading_kernel_failed = (isolate == nullptr);
710 } else {
712 isolate_snapshot_instructions,
713 &isolate_flags, isolate_group_data.get(),
715 }
716 if (isolate == nullptr) {
717 Syslog::PrintErr(
"%s\n",
error);
719 free(kernel_buffer);
720
721
722
723
724
725
726
727
728
729
731 }
732
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
755
757
759
760 switch (snapshot_kind) {
763 break;
766 break;
769 break;
773 break;
776 RefCntReleaseScope<File> rs(file);
779 break;
780 }
781 default:
783 }
784
787
788 free(kernel_buffer);
789 return 0;
790}
791
792int main(
int argc,
char** argv) {
793#if !defined(DART_HOST_OS_WINDOWS)
794
795 EXEUtils::LoadDartProfilerSymbols(argv[0]);
796#endif
797
798 const int EXTRA_VM_ARGUMENTS = 7;
799 CommandLineOptions vm_options(argc + EXTRA_VM_ARGUMENTS);
800 CommandLineOptions
inputs(argc);
801
802
803
804
805 if (kWordSize <= 4) {
806 vm_options.AddArgument("--new_gen_semi_max_size=16");
807 } else {
808 vm_options.AddArgument("--new_gen_semi_max_size=32");
809 }
810 vm_options.AddArgument("--new_gen_growth_factor=4");
811 vm_options.AddArgument("--deterministic");
812
813
817 }
818 DartUtils::SetEnvironment(environment);
819
820 if (!Platform::Initialize()) {
821 Syslog::PrintErr("Initialization failed\n");
823 }
824 Console::SaveConfig();
825 Loader::InitOnce();
826 DartUtils::SetOriginalWorkingDirectory();
827
828 TimerUtils::InitOnce();
829 EventHandler::Start();
830
832 vm_options.AddArgument("--precompilation");
833
834
835
836 vm_options.AddArgument("--target_unknown_cpu");
837 } else if (snapshot_kind == kAppJIT) {
838
839
840
841 vm_options.AddArgument("--target_unknown_cpu");
842#if !defined(TARGET_ARCH_IA32)
843 vm_options.AddArgument("--link_natives_lazily");
844#endif
845 }
846
848 if (
error !=
nullptr) {
849 Syslog::PrintErr(
"Setting VM flags failed: %s\n",
error);
852 }
853
855 memset(&init_params, 0, sizeof(init_params));
857 init_params.
file_open = DartUtils::OpenFile;
858 init_params.
file_read = DartUtils::ReadFile;
859 init_params.
file_write = DartUtils::WriteFile;
860 init_params.
file_close = DartUtils::CloseFile;
863#if defined(DART_HOST_OS_FUCHSIA)
864 init_params.vmex_resource = Platform::GetVMEXResource();
865#endif
866
867 std::unique_ptr<MappedMemory> mapped_vm_snapshot_data;
868 std::unique_ptr<MappedMemory> mapped_vm_snapshot_instructions;
869 std::unique_ptr<MappedMemory> mapped_isolate_snapshot_data;
870 std::unique_ptr<MappedMemory> mapped_isolate_snapshot_instructions;
871 if (load_vm_snapshot_data_filename != nullptr) {
872 mapped_vm_snapshot_data =
873 MapFile(load_vm_snapshot_data_filename, File::kReadOnly,
875 }
876 if (load_vm_snapshot_instructions_filename != nullptr) {
877 mapped_vm_snapshot_instructions =
878 MapFile(load_vm_snapshot_instructions_filename, File::kReadExecute,
880 }
881 if (load_isolate_snapshot_data_filename != nullptr) {
882 mapped_isolate_snapshot_data =
883 MapFile(load_isolate_snapshot_data_filename, File::kReadOnly,
884 &isolate_snapshot_data);
885 }
886 if (load_isolate_snapshot_instructions_filename != nullptr) {
887 mapped_isolate_snapshot_instructions =
888 MapFile(load_isolate_snapshot_instructions_filename, File::kReadExecute,
889 &isolate_snapshot_instructions);
890 }
891
893 if (
error !=
nullptr) {
894 Syslog::PrintErr(
"VM initialization failed: %s\n",
error);
897 }
898
902 }
903
905 if (
error !=
nullptr) {
906 Syslog::PrintErr(
"VM cleanup failed: %s\n",
error);
908 }
909 EventHandler::Stop();
910 return 0;
911}
912
913}
914}
915
916int main(
int argc,
char** argv) {
918}
DART_EXPORT Dart_Isolate Dart_CreateIsolateGroup(const char *script_uri, const char *name, const uint8_t *isolate_snapshot_data, const uint8_t *isolate_snapshot_instructions, Dart_IsolateFlags *flags, void *isolate_group_data, void *isolate_data, char **error)
DART_EXPORT void Dart_IsolateFlagsInitialize(Dart_IsolateFlags *flags)
DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle Dart_CreateAppAOTSnapshotAsElf(Dart_StreamingWriteCallback callback, void *callback_data, bool stripped, void *debug_callback_data)
#define DART_INITIALIZE_PARAMS_CURRENT_VERSION
DART_EXPORT void Dart_EnterScope(void)
DART_EXPORT void Dart_ExitScope(void)
DART_EXPORT const char * Dart_VersionString(void)
DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle Dart_CreateAppAOTSnapshotAsAssemblies(Dart_CreateLoadingUnitCallback next_callback, void *next_callback_data, bool stripped, Dart_StreamingWriteCallback write_callback, Dart_StreamingCloseCallback close_callback)
DART_EXPORT void Dart_ShutdownIsolate(void)
DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle Dart_CreateAppAOTSnapshotAsElfs(Dart_CreateLoadingUnitCallback next_callback, void *next_callback_data, bool stripped, Dart_StreamingWriteCallback write_callback, Dart_StreamingCloseCallback close_callback)
struct _Dart_Handle * Dart_Handle
DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle Dart_CreateVMAOTSnapshotAsAssembly(Dart_StreamingWriteCallback callback, void *callback_data)
DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle Dart_CreateAppAOTSnapshotAsAssembly(Dart_StreamingWriteCallback callback, void *callback_data, bool stripped, void *debug_callback_data)
struct _Dart_Isolate * Dart_Isolate
DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle Dart_LoadLibraryFromKernel(const uint8_t *kernel_buffer, intptr_t kernel_buffer_size)
DART_EXPORT Dart_Handle Dart_NewExternalTypedDataWithFinalizer(Dart_TypedData_Type type, void *data, intptr_t length, void *peer, intptr_t external_allocation_size, Dart_HandleFinalizer callback)
DART_EXPORT DART_WARN_UNUSED_RESULT char * Dart_Initialize(Dart_InitializeParams *params)
DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle Dart_GetObfuscationMap(uint8_t **buffer, intptr_t *buffer_length)
DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle Dart_CreateSnapshot(uint8_t **vm_snapshot_data_buffer, intptr_t *vm_snapshot_data_size, uint8_t **isolate_snapshot_data_buffer, intptr_t *isolate_snapshot_data_size, bool is_core)
DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle Dart_LoadLibrary(Dart_Handle kernel_buffer)
DART_EXPORT Dart_Handle Dart_SetEnvironmentCallback(Dart_EnvironmentCallback callback)
DART_EXPORT Dart_Handle Dart_Precompile(void)
DART_EXPORT DART_WARN_UNUSED_RESULT char * Dart_Cleanup(void)
DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle Dart_CreateAppJITSnapshotAsBlobs(uint8_t **isolate_snapshot_data_buffer, intptr_t *isolate_snapshot_data_size, uint8_t **isolate_snapshot_instructions_buffer, intptr_t *isolate_snapshot_instructions_size)
DART_EXPORT Dart_Handle Dart_ListLength(Dart_Handle list, intptr_t *length)
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 Dart_Handle Dart_StringToCString(Dart_Handle str, const char **cstr)
DART_EXPORT DART_WARN_UNUSED_RESULT char * Dart_SetVMFlags(int argc, const char **argv)
DART_EXPORT Dart_Handle Dart_ListGetAt(Dart_Handle list, intptr_t index)
DART_EXPORT Dart_Handle Dart_LoadingUnitLibraryUris(intptr_t loading_unit_id)
DART_EXPORT Dart_Handle Dart_SetRootLibrary(Dart_Handle library)
DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle Dart_CompileAll(void)
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
static const uint8_t buffer[]
const uint8_t uint32_t uint32_t GError ** error
uint32_t uint32_t * format
#define CHECK_RESULT(result)
constexpr int kCompilationErrorExitCode
static void CloseLoadingUnitManifest(File *manifest_file)
void ReadFile(uint8_t **data, intptr_t *file_len, void *stream)
static bool IsSnapshottingForPrecompilation()
static void CreateAndWritePrecompiledSnapshot()
static int CreateIsolateAndSnapshot(const CommandLineOptions &inputs)
static File * OpenLoadingUnitManifest()
static void MaybeLoadCode()
static void CreateAndWriteCoreSnapshot()
static void StreamingWriteCallback(void *callback_data, const uint8_t *buffer, intptr_t size)
int main(int argc, char **argv)
constexpr int kErrorExitCode
static void MaybeLoadExtraInputs(const CommandLineOptions &inputs)
static void NextLoadingUnit(void *callback_data, intptr_t loading_unit_id, void **write_callback_data, void **write_debug_callback_data, const char *main_filename, const char *suffix)
static void WriteLoadingUnitManifest(File *manifest_file, intptr_t id, const char *path, const char *debug_path=nullptr)
static SnapshotKind snapshot_kind
static void StreamingCloseCallback(void *callback_data)
static void CreateAndWriteAppJITSnapshot()
static int ParseArguments(int argc, char **argv, CommandLineOptions *vm_options, CommandLineOptions *inputs)
static void CreateAndWriteAppSnapshot()
static void MallocFinalizer(void *isolate_callback_data, void *peer)
static void NextAsmCallback(void *callback_data, intptr_t loading_unit_id, void **write_callback_data, void **write_debug_callback_data)
static void NextElfCallback(void *callback_data, intptr_t loading_unit_id, void **write_callback_data, void **write_debug_callback_data)
static std::unique_ptr< MappedMemory > MapFile(const char *filename, File::MapType type, const uint8_t **buffer)
bool WriteFile(const std::string &path, const char *data, ssize_t size)
void * malloc(size_t size)
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
fml::UniqueFD OpenFile(const char *path, bool create_if_necessary, FilePermission permission)
This can open a directory on POSIX, but not on Windows.
Dart_FileReadCallback file_read
const uint8_t * vm_snapshot_data
bool start_kernel_isolate
Dart_FileOpenCallback file_open
Dart_FileWriteCallback file_write
Dart_EntropySource entropy_source
const uint8_t * vm_snapshot_instructions
Dart_FileCloseCallback file_close
bool load_vmservice_library