diff --git a/runtime/vm/dart.cc b/runtime/vm/dart.cc index 2ccf2151ede..65aea3aef55 100644 --- a/runtime/vm/dart.cc +++ b/runtime/vm/dart.cc @@ -154,6 +154,7 @@ class DartInitializationState { }; static DartInitializationState init_state_; +#if defined(DART_PRECOMPILER) || defined(DART_PRECOMPILED_RUNTIME) static void CheckOffsets() { #if !defined(IS_SIMARM_HOST64) // These offsets are embedded in precompiled instructions. We need the @@ -243,9 +244,16 @@ static void CheckOffsets() { #undef CHECK_PAYLOAD_SIZEOF #endif // !defined(IS_SIMARM_HOST64) } +#endif // defined(DART_PRECOMPILER) || defined(DART_PRECOMPILED_RUNTIME) char* Dart::DartInit(const Dart_InitializeParams* params) { +#if defined(DART_PRECOMPILER) || defined(DART_PRECOMPILED_RUNTIME) CheckOffsets(); +#elif defined(ARCH_IS_64_BIT) != defined(TARGET_ARCH_IS_64_BIT) + return Utils::StrDup( + "JIT cannot simulate target architecture with different word size than " + "host"); +#endif if (!Flags::Initialized()) { return Utils::StrDup("VM initialization failed-VM Flags not initialized."); diff --git a/utils/application_snapshot.gni b/utils/application_snapshot.gni index 19cbb4570ac..56796823d9f 100644 --- a/utils/application_snapshot.gni +++ b/utils/application_snapshot.gni @@ -135,44 +135,51 @@ template("_application_snapshot") { } # Create a snapshot from kernel built above. - dart_action(target_name) { - if (defined(invoker.pool)) { - pool = invoker.pool - } - deps = extra_deps + [ ":${target_name}_dill" ] - depfile = "$output.d" + if (dart_snapshot_kind == "kernel") { + copy(target_name) { + deps = extra_deps + [ ":${target_name}_dill" ] + sources = [ "$target_gen_dir/$name.dart.dill" ] + outputs = [ output ] - script = "$target_gen_dir/$name.dart.dill" - - inputs = extra_inputs - - outputs = [ output ] - - # Explicitly set DFE so Dart doesn't implicitly depend on the kernel service - # snapshot (creating a circular dep. for kernel-service_snapshot). - dfe = "NEVER_LOADED" - - abs_depfile = rebase_path(depfile) - abs_output = rebase_path(output) - rel_output = rebase_path(output, root_build_dir) - - vm_args = [ - "--deterministic", - "--packages=$dot_packages", - "--snapshot=$abs_output", - "--snapshot-depfile=$abs_depfile", - "--depfile-output-filename=$rel_output", - ] + snapshot_vm_args - - if (dart_snapshot_kind == "kernel") { - vm_args += [ "--snapshot-kind=kernel" ] + assert(snapshot_vm_args != "", "Ignoring unused argument") assert(training_args != "", "Ignoring unused argument") - args = [] - } else if (dart_snapshot_kind == "app-jit") { - vm_args += [ "--snapshot-kind=app-jit" ] - args = training_args - } else { - assert(false, "Bad dart_snapshot_kind: $dart_snapshot_kind") + } + } else { + dart_action(target_name) { + if (defined(invoker.pool)) { + pool = invoker.pool + } + deps = extra_deps + [ ":${target_name}_dill" ] + depfile = "$output.d" + + script = "$target_gen_dir/$name.dart.dill" + + inputs = extra_inputs + + outputs = [ output ] + + # Explicitly set DFE so Dart doesn't implicitly depend on the kernel service + # snapshot (creating a circular dep. for kernel-service_snapshot). + dfe = "NEVER_LOADED" + + abs_depfile = rebase_path(depfile) + abs_output = rebase_path(output) + rel_output = rebase_path(output, root_build_dir) + + vm_args = [ + "--deterministic", + "--packages=$dot_packages", + "--snapshot=$abs_output", + "--snapshot-depfile=$abs_depfile", + "--depfile-output-filename=$rel_output", + ] + snapshot_vm_args + + if (dart_snapshot_kind == "app-jit") { + vm_args += [ "--snapshot-kind=app-jit" ] + args = training_args + } else { + assert(false, "Bad dart_snapshot_kind: $dart_snapshot_kind") + } } } }