Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(244)

Unified Diff: runtime/bin/main.cc

Issue 3002733002: [vm,aot,kernel] Fix AOT snapshot creation with kernel front-end (Closed)
Patch Set: Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/bin/dfe.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/main.cc
diff --git a/runtime/bin/main.cc b/runtime/bin/main.cc
index ffbc2e738135cdef6550cf493f225e9792d5d9a9..1e799b5bc507a277e27bde1c3a2897bd19d08f19 100644
--- a/runtime/bin/main.cc
+++ b/runtime/bin/main.cc
@@ -1047,9 +1047,16 @@ static Dart_Isolate CreateAndSetupServiceIsolate(const char* script_uri,
#if !defined(DART_PRECOMPILED_RUNTIME)
if (dfe.UsePlatformBinary()) {
- Dart_Handle library = Dart_LoadKernel(dfe.kernel_vmservice_io());
+ // Read vmservice_io kernel file independently of main thread
+ // as Dart_LoadKernel takes ownership.
+ void* kernel_vmservice_io = dfe.ReadVMServiceIO();
+ if (kernel_vmservice_io == NULL) {
+ Log::PrintErr("Could not read dart:vmservice_io binary file.");
+ Platform::Exit(kErrorExitCode);
+ }
+ // Dart_LoadKernel takes ownership.
+ Dart_Handle library = Dart_LoadKernel(kernel_vmservice_io);
CHECK_RESULT_CLEANUP(library, isolate_data);
- dfe.clear_kernel_vmservice_io(); // Dart_LoadKernel takes ownership.
skip_library_load = true;
}
#endif // !defined(DART_PRECOMPILED_RUNTIME)
@@ -1458,16 +1465,24 @@ bool RunMainIsolate(const char* script_name, CommandLineOptions* dart_options) {
result = Dart_LibraryImportLibrary(isolate_data->builtin_lib(), root_lib,
Dart_Null());
if ((gen_snapshot_kind == kAppAOT) || (gen_snapshot_kind == kAppJIT)) {
-// Load the embedder's portion of the VM service's Dart code so it will
-// be included in the app snapshot.
-#if defined(DART_PRECOMPILED_RUNTIME)
- if (!VmService::LoadForGenPrecompiled(NULL)) {
-#else
- if (!VmService::LoadForGenPrecompiled(dfe.kernel_vmservice_io())) {
+ // Load the embedder's portion of the VM service's Dart code so it will
+ // be included in the app snapshot.
+ void* kernel_vmservice_io = NULL;
+#if !defined(DART_PRECOMPILED_RUNTIME)
+ if (dfe.UsePlatformBinary()) {
+ // Do not cache vmservice_io kernel file as
+ // VmService::LoadForGenPrecompiled takes ownership.
+ kernel_vmservice_io = dfe.ReadVMServiceIO();
+ if (kernel_vmservice_io == NULL) {
+ Log::PrintErr("Could not read dart:vmservice_io binary file.");
+ Platform::Exit(kErrorExitCode);
+ }
+ }
#endif // defined(DART_PRECOMPILED_RUNTIME)
+ if (!VmService::LoadForGenPrecompiled(kernel_vmservice_io)) {
Log::PrintErr("VM service loading failed: %s\n",
VmService::GetErrorMessage());
- exit(kErrorExitCode);
+ Platform::Exit(kErrorExitCode);
}
}
@@ -1769,14 +1784,12 @@ void main(int argc, char** argv) {
// step will become redundant once we have the snapshot version
// of the kernel core/platform libraries.
if (dfe.UsePlatformBinary()) {
- if (dfe.ReadPlatform() == NULL) {
+ void* kernel_platform = dfe.ReadPlatform();
+ if (kernel_platform == NULL) {
Log::PrintErr("The platform binary is not a valid Dart Kernel file.");
Platform::Exit(kErrorExitCode);
}
- if (dfe.ReadVMServiceIO() == NULL) {
- Log::PrintErr("Could not read dart:vmservice_io binary file.");
- Platform::Exit(kErrorExitCode);
- }
+ dfe.set_kernel_platform(kernel_platform);
}
#endif
« no previous file with comments | « runtime/bin/dfe.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698