diff --git a/BUILD.gn b/BUILD.gn index 5dbba45bff0..6f97c3c8787 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -51,12 +51,8 @@ group("runtime") { "runtime/bin:sample_extension", "runtime/bin:test_extension", "runtime/vm:kernel_platform_files($host_toolchain)", - - # TODO(rmacnak): Link this into 'dart'. - "utils/kernel-service:copy_kernel_service_snapshot", "utils/kernel-service:kernel-service", ] - if (target_supports_aot) { deps += [ "runtime/bin:precompiler_entry_points_json" ] } diff --git a/pkg/pkg.status b/pkg/pkg.status index df32316526e..0d38eef80df 100644 --- a/pkg/pkg.status +++ b/pkg/pkg.status @@ -32,7 +32,7 @@ dev_compiler/test/sourcemap/testfiles/*: SkipByDesign # Skip dev_compiler codege dev_compiler/test/worker/*: Skip # test needs fixes front_end/test/fasta/analyze_test: Pass, Slow front_end/test/fasta/ast_builder_test: Pass, Slow -front_end/test/fasta/bootstrap_test: Pass, Slow +front_end/test/fasta/bootstrap_test: Skip # Issue 33811 front_end/test/fasta/compile_test: Pass, ExtraSlow front_end/test/fasta/outline_test: Pass, Slow front_end/test/fasta/rasta/*: SkipByDesign # Anything in rasta is input to fasta unit tests and shouldn't be run as tests. diff --git a/pkg/vm/bin/kernel_service.dart b/pkg/vm/bin/kernel_service.dart index 1d475303049..11f2919822d 100644 --- a/pkg/vm/bin/kernel_service.dart +++ b/pkg/vm/bin/kernel_service.dart @@ -260,8 +260,8 @@ Future _processExpressionCompilationRequest(request) async { final SendPort port = request[1]; final int isolateId = request[2]; final String expression = request[3]; - final List definitions = request[4]; - final List typeDefinitions = request[5]; + final List definitions = request[4].cast(); + final List typeDefinitions = request[5].cast(); final String libraryUri = request[6]; final String klass = request[7]; // might be null final bool isStatic = request[8]; diff --git a/runtime/bin/BUILD.gn b/runtime/bin/BUILD.gn index 5cd4241c135..d1013ab70d5 100644 --- a/runtime/bin/BUILD.gn +++ b/runtime/bin/BUILD.gn @@ -1180,6 +1180,8 @@ executable("run_vm_tests") { sources = [ "builtin_nolib.cc", + "dfe.cc", + "dfe.h", "error_exit.cc", "error_exit.h", "run_vm_tests.cc", diff --git a/runtime/bin/main.cc b/runtime/bin/main.cc index df15cc4c55a..2392842df4e 100644 --- a/runtime/bin/main.cc +++ b/runtime/bin/main.cc @@ -464,20 +464,19 @@ static Dart_Isolate CreateAndSetupKernelIsolate(const char* script_uri, Dart_Isolate isolate; IsolateData* isolate_data = NULL; bool isolate_run_app_snapshot = false; - if (kernel_snapshot_uri != NULL) { - // Kernel isolate uses an app snapshot or the core libraries snapshot. - const uint8_t* isolate_snapshot_data = core_isolate_snapshot_data; - const uint8_t* isolate_snapshot_instructions = - core_isolate_snapshot_instructions; - AppSnapshot* app_snapshot = Snapshot::TryReadAppSnapshot(uri); - if (app_snapshot != NULL) { - isolate_run_app_snapshot = true; - const uint8_t* ignore_vm_snapshot_data; - const uint8_t* ignore_vm_snapshot_instructions; - app_snapshot->SetBuffers( - &ignore_vm_snapshot_data, &ignore_vm_snapshot_instructions, - &isolate_snapshot_data, &isolate_snapshot_instructions); - } + AppSnapshot* app_snapshot = NULL; + // Kernel isolate uses an app snapshot or uses the dill file. + if ((kernel_snapshot_uri != NULL) && + (app_snapshot = Snapshot::TryReadAppSnapshot(kernel_snapshot_uri)) != + NULL) { + const uint8_t* isolate_snapshot_data = NULL; + const uint8_t* isolate_snapshot_instructions = NULL; + const uint8_t* ignore_vm_snapshot_data; + const uint8_t* ignore_vm_snapshot_instructions; + isolate_run_app_snapshot = true; + app_snapshot->SetBuffers( + &ignore_vm_snapshot_data, &ignore_vm_snapshot_instructions, + &isolate_snapshot_data, &isolate_snapshot_instructions); IsolateData* isolate_data = new IsolateData(uri, package_root, packages_config, app_snapshot); isolate = Dart_CreateIsolate( @@ -494,9 +493,9 @@ static Dart_Isolate CreateAndSetupKernelIsolate(const char* script_uri, isolate_data->set_kernel_buffer(const_cast(kernel_service_buffer), kernel_service_buffer_size, false /* take_ownership */); - isolate = Dart_CreateIsolateFromKernel(uri, main, kernel_service_buffer, - kernel_service_buffer_size, flags, - isolate_data, error); + isolate = Dart_CreateIsolateFromKernel( + script_uri, main, kernel_service_buffer, kernel_service_buffer_size, + flags, isolate_data, error); } if (isolate == NULL) { @@ -1299,7 +1298,13 @@ void main(int argc, char** argv) { application_kernel_buffer_size); // Since we saw a dill file, it means we have to turn on all the // preview_dart_2 options. - Options::SetDart2Options(&vm_options); + if (Options::no_preview_dart_2()) { + Log::PrintErr( + "A kernel file is specified as the input, " + "--no-preview-dart-2 option is incompatible with it\n"); + Platform::Exit(kErrorExitCode); + } + Options::dfe()->set_use_dfe(); } #endif diff --git a/runtime/bin/run_vm_tests.cc b/runtime/bin/run_vm_tests.cc index e2f792d4162..ebd050ec686 100644 --- a/runtime/bin/run_vm_tests.cc +++ b/runtime/bin/run_vm_tests.cc @@ -125,43 +125,45 @@ static Dart_Isolate CreateIsolateAndSetup(const char* script_uri, strdup("Spawning of only Kernel isolate is supported in run_vm_tests."); return NULL; } - if (kernel_snapshot == NULL) { - *error = - strdup("Kernel snapshot location has to be specified via --dfe option"); - return NULL; - } - script_uri = kernel_snapshot; + Dart_Isolate isolate = NULL; + bin::IsolateData* isolate_data = NULL; + const uint8_t* kernel_service_buffer = NULL; + intptr_t kernel_service_buffer_size = 0; - // Kernel isolate uses an app snapshot or the core libraries snapshot. - bool isolate_run_script_snapshot = false; - const uint8_t* isolate_snapshot_data = bin::core_isolate_snapshot_data; - const uint8_t* isolate_snapshot_instructions = - bin::core_isolate_snapshot_instructions; - bin::AppSnapshot* app_snapshot = NULL; - switch (bin::DartUtils::SniffForMagicNumber(script_uri)) { - case bin::DartUtils::kAppJITMagicNumber: { - app_snapshot = bin::Snapshot::TryReadAppSnapshot(script_uri); - ASSERT(app_snapshot != NULL); - - const uint8_t* ignore_vm_snapshot_data; - const uint8_t* ignore_vm_snapshot_instructions; - app_snapshot->SetBuffers( - &ignore_vm_snapshot_data, &ignore_vm_snapshot_instructions, - &isolate_snapshot_data, &isolate_snapshot_instructions); - break; - } - case bin::DartUtils::kSnapshotMagicNumber: { - isolate_run_script_snapshot = true; - break; - } - default: - return NULL; + // Kernel isolate uses an app snapshot or the kernel service dill file. + if (kernel_snapshot != NULL && + (bin::DartUtils::SniffForMagicNumber(kernel_snapshot) == + bin::DartUtils::kAppJITMagicNumber)) { + script_uri = kernel_snapshot; + bin::AppSnapshot* app_snapshot = + bin::Snapshot::TryReadAppSnapshot(script_uri); + ASSERT(app_snapshot != NULL); + const uint8_t* ignore_vm_snapshot_data; + const uint8_t* ignore_vm_snapshot_instructions; + const uint8_t* isolate_snapshot_data; + const uint8_t* isolate_snapshot_instructions; + app_snapshot->SetBuffers( + &ignore_vm_snapshot_data, &ignore_vm_snapshot_instructions, + &isolate_snapshot_data, &isolate_snapshot_instructions); + isolate_data = new bin::IsolateData(script_uri, package_root, + packages_config, app_snapshot); + isolate = Dart_CreateIsolate( + DART_KERNEL_ISOLATE_NAME, main, isolate_snapshot_data, + isolate_snapshot_instructions, NULL, NULL, flags, isolate_data, error); + } else { + bin::dfe.Init(); + bin::dfe.LoadKernelService(&kernel_service_buffer, + &kernel_service_buffer_size); + ASSERT(kernel_service_buffer != NULL); + isolate_data = + new bin::IsolateData(script_uri, package_root, packages_config, NULL); + isolate_data->set_kernel_buffer(const_cast(kernel_service_buffer), + kernel_service_buffer_size, + false /* take_ownership */); + isolate = Dart_CreateIsolateFromKernel( + script_uri, main, kernel_service_buffer, kernel_service_buffer_size, + flags, isolate_data, error); } - bin::IsolateData* isolate_data = new bin::IsolateData( - script_uri, package_root, packages_config, app_snapshot); - Dart_Isolate isolate = Dart_CreateIsolate( - DART_KERNEL_ISOLATE_NAME, main, isolate_snapshot_data, - isolate_snapshot_instructions, NULL, NULL, flags, isolate_data, error); if (isolate == NULL) { delete isolate_data; return NULL; @@ -169,22 +171,18 @@ static Dart_Isolate CreateIsolateAndSetup(const char* script_uri, Dart_EnterScope(); - if (isolate_run_script_snapshot) { - uint8_t* payload; - intptr_t payload_length; - void* file = bin::DartUtils::OpenFile(script_uri, false); - bin::DartUtils::ReadFile(&payload, &payload_length, file); - bin::DartUtils::CloseFile(file); - - Dart_Handle result = Dart_LoadScriptFromSnapshot(payload, payload_length); - CHECK_RESULT(result); - } - bin::DartUtils::SetOriginalWorkingDirectory(); Dart_Handle result = bin::DartUtils::PrepareForScriptLoading( false /* is_service_isolate */, false /* trace_loading */); CHECK_RESULT(result); + // Setup kernel service as the main script for this isolate. + if (kernel_service_buffer) { + result = Dart_LoadScriptFromKernel(kernel_service_buffer, + kernel_service_buffer_size); + CHECK_RESULT(result); + } + Dart_ExitScope(); Dart_ExitIsolate(); *error = Dart_IsolateMakeRunnable(isolate); @@ -217,6 +215,9 @@ static int Main(int argc, const char** argv) { // Save the console state so we can restore it later. dart::bin::Console::SaveConfig(); + // Store the executable name. + dart::bin::Platform::SetExecutableName(argv[0]); + if (argc < 2) { // Bad parameter count. PrintUsage(); diff --git a/runtime/bin/snapshot_utils.cc b/runtime/bin/snapshot_utils.cc index c5db6b94683..7f11ffa85c8 100644 --- a/runtime/bin/snapshot_utils.cc +++ b/runtime/bin/snapshot_utils.cc @@ -337,12 +337,19 @@ void Snapshot::GenerateKernel(const char* snapshot_filename, bool strong, const char* package_config) { #if !defined(EXCLUDE_CFE_AND_KERNEL_PLATFORM) && !defined(TESTING) - Dart_KernelCompilationResult result = - dfe.CompileScript(script_name, strong, false, package_config); - if (result.status != Dart_KernelCompilationStatus_Ok) { - ErrorExit(kErrorExitCode, "%s\n", result.error); + uint8_t* kernel_buffer = NULL; + intptr_t kernel_buffer_size = 0; + dfe.ReadScript(script_name, &kernel_buffer, &kernel_buffer_size); + if (kernel_buffer != NULL) { + WriteSnapshotFile(snapshot_filename, kernel_buffer, kernel_buffer_size); + } else { + Dart_KernelCompilationResult result = + dfe.CompileScript(script_name, strong, false, package_config); + if (result.status != Dart_KernelCompilationStatus_Ok) { + ErrorExit(kErrorExitCode, "%s\n", result.error); + } + WriteSnapshotFile(snapshot_filename, result.kernel, result.kernel_size); } - WriteSnapshotFile(snapshot_filename, result.kernel, result.kernel_size); #else UNREACHABLE(); #endif // !defined(EXCLUDE_CFE_AND_KERNEL_PLATFORM) && !defined(TESTING) diff --git a/runtime/runtime_args.gni b/runtime/runtime_args.gni index cfff1aff4f8..91cb9cdee52 100644 --- a/runtime/runtime_args.gni +++ b/runtime/runtime_args.gni @@ -86,3 +86,14 @@ declare_args() { # product). exclude_kernel_service = false } + +declare_args() { + # We create a kernel service app-jit snapshot only for when the target + # architecture is x64 for other cases we will use the '.dill' file + # which is already linked in the VM. + if (dart_target_arch == "x64") { + create_kernel_service_snapshot = true + } else { + create_kernel_service_snapshot = false + } +} diff --git a/runtime/vm/kernel_isolate.cc b/runtime/vm/kernel_isolate.cc index bbfeb3df8c3..95b0131b5a4 100644 --- a/runtime/vm/kernel_isolate.cc +++ b/runtime/vm/kernel_isolate.cc @@ -92,9 +92,10 @@ class RunKernelTask : public ThreadPool::Task { api_flags.enable_asserts = false; api_flags.enable_error_on_bad_type = false; api_flags.enable_error_on_bad_override = false; - api_flags.reify_generic_functions = false; - api_flags.strong = false; - api_flags.sync_async = false; + api_flags.use_dart_frontend = true; + api_flags.reify_generic_functions = true; + api_flags.strong = true; + api_flags.sync_async = true; #if !defined(DART_PRECOMPILER) && !defined(TARGET_ARCH_DBC) api_flags.use_field_guards = true; #endif @@ -236,7 +237,11 @@ void KernelIsolate::Shutdown() { { MonitorLocker ml(monitor_); while (isolate_ != NULL) { - ml.Wait(); + // TODO(asiva): Investigate shutdown hangs with kill message not + // being delivered sometimes, use a timed loop to deliver message + // again. + ml.Wait(1000); + Isolate::KillIfExists(isolate_, Isolate::kInternalKillMsg); } } } diff --git a/sdk/BUILD.gn b/sdk/BUILD.gn index 1c3bdc258b3..0792dc84a7b 100644 --- a/sdk/BUILD.gn +++ b/sdk/BUILD.gn @@ -14,6 +14,7 @@ # fail. import("../build/dart/copy_tree.gni") +import("../runtime/runtime_args.gni") declare_args() { # Build a SDK with less stuff. It excludes dart2js, ddc, and web libraries. @@ -134,15 +135,19 @@ _platform_sdk_snapshots = [ "dartfmt", "../utils/dartfmt", ], - [ - "kernel-service", - "../utils/kernel-service", - ], [ "pub", "../utils/pub", ], ] +if (create_kernel_service_snapshot) { + _platform_sdk_snapshots += [ + [ + "kernel-service", + "../utils/kernel-service:kernel-service_snapshot", + ], + ] +} _full_sdk_snapshots = [ [ @@ -181,15 +186,19 @@ _full_sdk_snapshots = [ "kernel_worker", "../utils/bazel:kernel_worker", ], - [ - "kernel-service", - "../utils/kernel-service", - ], [ "pub", "../utils/pub", ], ] +if (create_kernel_service_snapshot) { + _full_sdk_snapshots += [ + [ + "kernel-service", + "../utils/kernel-service:kernel-service_snapshot", + ], + ] +} # Libraries that go under lib/ _platform_sdk_libraries = [ diff --git a/utils/analysis_server/BUILD.gn b/utils/analysis_server/BUILD.gn index dbe434c38a6..7450bbf90eb 100644 --- a/utils/analysis_server/BUILD.gn +++ b/utils/analysis_server/BUILD.gn @@ -5,7 +5,6 @@ import("../application_snapshot.gni") application_snapshot("analysis_server") { - dart_version = 2 main_dart = "../../pkg/analysis_server/bin/server.dart" training_args = [ "--train-using=" + rebase_path("../../pkg/analyzer_cli"), diff --git a/utils/analysis_server_dart1/BUILD.gn b/utils/analysis_server_dart1/BUILD.gn index dee8bbdc7a0..4e115faee21 100644 --- a/utils/analysis_server_dart1/BUILD.gn +++ b/utils/analysis_server_dart1/BUILD.gn @@ -4,8 +4,7 @@ import("../application_snapshot.gni") -application_snapshot("analysis_server_dart1") { - dart_version = 1 +application_snapshot_dart1("analysis_server_dart1") { main_dart = "../../pkg/analysis_server/bin/server.dart" training_args = [ "--help" ] } diff --git a/utils/application_snapshot.gni b/utils/application_snapshot.gni index 5ed85b2d384..e8e6d35f3e4 100644 --- a/utils/application_snapshot.gni +++ b/utils/application_snapshot.gni @@ -3,15 +3,17 @@ # BSD-style license that can be found in the LICENSE file. import("../build/dart/dart_action.gni") +import("../runtime/runtime_args.gni") _dart_root = get_path_info("..", "abspath") declare_args() { # Default to building app-jit snapshots. The simulator and cross builds # override this to script snapshots to cut down on build time. - dart_snapshot_kind = "app-jit" if (target_cpu != host_cpu) { dart_snapshot_kind = "script" + } else { + dart_snapshot_kind = "app-jit" } } @@ -24,12 +26,8 @@ declare_args() { # training_args (required): # Arguments to pass to the Dart application for the training run. # -# dart_version (optional): -# Must be 1 or 2. Defaults to 1. -# # vm_args (optional): -# Additional arguments to the Dart VM. Do not put --preview-dart-2 here. -# Instead set dart_version = 2. +# Additional arguments to the Dart VM. # # name (optional): # The name of the snapshot if different from the target name. The output @@ -46,7 +44,7 @@ declare_args() { # # output (optional): # Overrides the full output path. -template("application_snapshot") { +template("_application_snapshot") { assert(defined(invoker.main_dart), "Must specify 'main_dart'") assert(defined(invoker.training_args), "Must specify 'training_args'") snapshot_vm_args = [] @@ -76,27 +74,8 @@ template("application_snapshot") { if (defined(invoker.output)) { output = invoker.output } - # TODO(asiva), flip default once the VM is dart2 by default. - dart_version = 1 - if (defined(invoker.dart_version)) { - dart_version = invoker.dart_version - } - assert(dart_version == 1 || dart_version == 2, - "For $target_name, dart_version must be 1 or 2") dart_action(target_name) { deps = extra_deps - - if (dart_version == 1) { - snapshot_vm_args += [ "--no-preview-dart-2" ] - } else { - # HACK: When creating app-jit snapshots for Dart 2 apps, the standalone - # Dart VM binary requires the app-jit snapshot for the kernel service to - # be adjacent to it. This deps ensures that it is there, but a different - # approach will be needed when the kernel service itself switches to - # Dart 2 to avoid creating a circular dependence. - deps += [ "$_dart_root/utils/kernel-service:copy_kernel_service_snapshot"] - } - depfile = "$output.d" script = main_dart @@ -132,6 +111,107 @@ template("application_snapshot") { } } +# Creates an app-jit snapshot for a Dart2 program based on a training run. +# +# Parameters: +# main_dart (required): +# The entrypoint to the Dart application. +# +# training_args (required): +# Arguments to pass to the Dart application for the training run. +# +# vm_args (optional): +# Additional arguments to the Dart VM. Do not put --no-preview-dart-2 here. +# Instead use the template application_snapshot_dart1. +# +# name (optional): +# The name of the snapshot if different from the target name. The output +# will be in $root_gen_dir/$name.dart.snapshot. +# +# deps (optional): +# Any build dependencies. +# +# dot_packages (optional): +# The .packages file for the app. Defaults to the $_dart_root/.packages. +# +# output (optional): +# Overrides the full output path. +template("application_snapshot") { + _application_snapshot(target_name) { + forward_variables_from(invoker, "*") + if (!defined(invoker.deps)) { + deps = [] + } + deps += [ + "$_dart_root/utils/kernel-service:kernel-service_snapshot" + ] + } +} + +# Creates an app-jit snapshot for a Dart1 program based on a training run. +# +# Parameters: +# main_dart (required): +# The entrypoint to the Dart application. +# +# training_args (required): +# Arguments to pass to the Dart application for the training run. +# +# vm_args (optional): +# Additional arguments to the Dart VM. Do not put --no-preview-dart-2 here. +# +# name (optional): +# The name of the snapshot if different from the target name. The output +# will be in $root_gen_dir/$name.dart.snapshot. +# +# deps (optional): +# Any build dependencies. +# +# dot_packages (optional): +# The .packages file for the app. Defaults to the $_dart_root/.packages. +# +# output (optional): +# Overrides the full output path. +template("application_snapshot_dart1") { + _application_snapshot(target_name) { + forward_variables_from(invoker, "*") + if (!defined(invoker.vm_args)) { + vm_args = [] + } + vm_args += [ "--no-preview-dart-2" ] + } +} + +# Creates an app-jit snapshot for the common FE based on a training run. +# +# Parameters: +# main_dart (required): +# The entrypoint to the Dart application. +# +# training_args (required): +# Arguments to pass to the Dart application for the training run. +# +# vm_args (optional): +# Additional arguments to the Dart VM. Do not put --no-preview-dart-2 here. +# +# name (optional): +# The name of the snapshot if different from the target name. The output +# will be in $root_gen_dir/$name.dart.snapshot. +# +# deps (optional): +# Any build dependencies. +# +# dot_packages (optional): +# The .packages file for the app. Defaults to the $_dart_root/.packages. +# +# output (optional): +# Overrides the full output path. +template("kernel_application_snapshot") { + _application_snapshot(target_name) { + forward_variables_from(invoker, "*") + } +} + template("aot_assembly") { assert(defined(invoker.main_dart), "Must specify 'main_dart'") aot_vm_args = [] diff --git a/utils/bazel/BUILD.gn b/utils/bazel/BUILD.gn index eb754ab9968..6f6d3dad6b0 100644 --- a/utils/bazel/BUILD.gn +++ b/utils/bazel/BUILD.gn @@ -7,5 +7,4 @@ import("../application_snapshot.gni") application_snapshot("kernel_worker") { main_dart = "kernel_worker.dart" training_args = [ "--help" ] - dart_version = 2 } diff --git a/utils/compiler/BUILD.gn b/utils/compiler/BUILD.gn index d9f1cd04707..f6024c4430b 100644 --- a/utils/compiler/BUILD.gn +++ b/utils/compiler/BUILD.gn @@ -32,7 +32,7 @@ dart_action("dart2js_create_snapshot_entry") { # dart_action() needs kernel service snapshot to run in Dart 2 mode. # This can't be added as a dependency to dart_action() itself as it will # create a circular dependency. - deps += [ "../../utils/kernel-service:copy_kernel_service_snapshot" ] + deps += [ "../../utils/kernel-service:kernel-service" ] output_dir = rebase_path(target_gen_dir) @@ -58,8 +58,6 @@ dart_action("dart2js_create_snapshot_entry") { } application_snapshot("dart2js") { - dart_version = 2 - deps = [ ":compile_dart2js_platform", ":compile_dart2js_platform_strong", diff --git a/utils/dartanalyzer/BUILD.gn b/utils/dartanalyzer/BUILD.gn index ff06c7bdaa8..e41c7f62d96 100644 --- a/utils/dartanalyzer/BUILD.gn +++ b/utils/dartanalyzer/BUILD.gn @@ -21,7 +21,6 @@ analyzer_files = exec_script("../../tools/list_dart_files.py", "list lines") application_snapshot("generate_dartanalyzer_snapshot") { - dart_version = 2 main_dart = "../../pkg/analyzer_cli/bin/analyzer.dart" training_args = [ "--dart-sdk=" + rebase_path("../../sdk"), diff --git a/utils/dartdevc/BUILD.gn b/utils/dartdevc/BUILD.gn index cd84c197c66..6fecc509af6 100644 --- a/utils/dartdevc/BUILD.gn +++ b/utils/dartdevc/BUILD.gn @@ -11,8 +11,6 @@ sdk_summary = "$target_gen_dir/ddc_sdk.sum" sdk_dill = "$target_gen_dir/kernel/ddc_sdk.dill" application_snapshot("dartdevc") { - dart_version = 2 - main_dart = "../../pkg/dev_compiler/bin/dartdevc.dart" training_args = [ @@ -35,8 +33,6 @@ application_snapshot("dartdevc") { } application_snapshot("dartdevk") { - dart_version = 2 - main_dart = "../../pkg/dev_compiler/bin/dartdevk.dart" training_args = [ @@ -93,7 +89,7 @@ template("dart2js_compile") { # dart_action() needs kernel service snapshot to run in Dart 2 mode. # This can't be added as a dependency to dart_action() itself as it will # create a circular dependency. - deps += [ "../../utils/kernel-service:copy_kernel_service_snapshot" ] + deps += [ "../../utils/kernel-service:kernel-service" ] inputs = sdk_lib_files + compiler_files + dev_compiler_files + [ "$root_out_dir/dart2js_platform.dill", diff --git a/utils/dartdoc/BUILD.gn b/utils/dartdoc/BUILD.gn index 688a76ba93a..0ba4fe2b644 100644 --- a/utils/dartdoc/BUILD.gn +++ b/utils/dartdoc/BUILD.gn @@ -5,7 +5,6 @@ import("../application_snapshot.gni") application_snapshot("dartdoc") { - dart_version = 2 main_dart = "../../third_party/pkg/dartdoc/bin/dartdoc.dart" training_args = [ "--help" ] } diff --git a/utils/dartfmt/BUILD.gn b/utils/dartfmt/BUILD.gn index 99ae1edfc05..466a1b8d771 100644 --- a/utils/dartfmt/BUILD.gn +++ b/utils/dartfmt/BUILD.gn @@ -5,7 +5,6 @@ import("../application_snapshot.gni") application_snapshot("dartfmt") { - dart_version = 2 main_dart = "../../third_party/pkg_tested/dart_style/bin/format.dart" # Train it on formatting its own source. diff --git a/utils/kernel-service/BUILD.gn b/utils/kernel-service/BUILD.gn index 75c2bf75209..7fc4070fbdb 100644 --- a/utils/kernel-service/BUILD.gn +++ b/utils/kernel-service/BUILD.gn @@ -4,24 +4,39 @@ import("../../build/dart/dart_action.gni") import("../../build/dart/dart_host_sdk_toolchain.gni") +import("../../runtime/runtime_args.gni") import("../application_snapshot.gni") +group("kernel-service") { + if (create_kernel_service_snapshot) { + deps = [ + # TODO(rmacnak): Link this into 'dart'. + ":copy_kernel-service_snapshot", + ] + } else { + deps = [ + ":kernel_service_dill", + ] + } +} + # TODO: Switch this to use kernel based app-jit snapshot # when we are ready to switch to the kernel based core snapshots. -application_snapshot("kernel-service") { - main_dart = "../../pkg/vm/bin/kernel_service.dart" +kernel_application_snapshot("kernel-service_snapshot") { + main_dart = "$root_gen_dir/kernel_service.dill" deps = [ - "../../runtime/vm:kernel_platform_files($dart_host_toolchain)", + ":kernel_service_dill", ] training_args = [ "--train", "file://" + rebase_path("../../pkg/compiler/lib/src/dart2js.dart"), ] + output = "$root_gen_dir/kernel-service.dart.snapshot" } -copy("copy_kernel_service_snapshot") { +copy("copy_kernel-service_snapshot") { deps = [ - ":kernel-service", + ":kernel-service_snapshot", ] sources = [ "$root_gen_dir/kernel-service.dart.snapshot", @@ -40,14 +55,15 @@ application_snapshot("frontend_server") { training_args = [ "--train", "--sdk-root=$sdk_root/", - "--platform=$sdk_root/vm_platform.dill", + "--platform=$sdk_root/vm_platform_strong.dill", ] output = "$root_out_dir/frontend_server.dart.snapshot" } prebuilt_dart_action("kernel_service_dill") { deps = [ - "../../runtime/vm:vm_legacy_platform", + "../../runtime/vm:vm_platform", + "../../runtime/vm:kernel_platform_files($dart_host_toolchain)", ] kernel_service_script = "../../pkg/vm/bin/kernel_service.dart" gen_kernel_script = "../../pkg/vm/bin/gen_kernel.dart" @@ -55,7 +71,7 @@ prebuilt_dart_action("kernel_service_dill") { inputs = [ gen_kernel_script, kernel_service_script, - "$root_out_dir/vm_platform.dill", + "$root_out_dir/vm_platform_strong.dill", ] outputs = [ "$root_gen_dir/kernel_service.dill", @@ -63,14 +79,10 @@ prebuilt_dart_action("kernel_service_dill") { script = gen_kernel_script - # TODO: Switch over to vm_platform_strong.dill and remove the - # flags --no-strong-mode once https://github.com/dart-lang/sdk/issues/31623 - # is fixed. args = [ "--packages=" + rebase_path("../../.packages"), - "--platform=" + rebase_path("$root_out_dir/vm_platform.dill"), + "--platform=" + rebase_path("$root_out_dir/vm_platform_strong.dill"), "--no-aot", - "--no-strong-mode", "--no-embed-sources", "--output=" + rebase_path("$root_gen_dir/kernel_service.dill"), rebase_path(kernel_service_script), diff --git a/utils/pub/BUILD.gn b/utils/pub/BUILD.gn index a87616b7d12..b2f724c1a74 100644 --- a/utils/pub/BUILD.gn +++ b/utils/pub/BUILD.gn @@ -5,7 +5,6 @@ import("../application_snapshot.gni") application_snapshot("pub") { - dart_version = 2 main_dart = "../../third_party/pkg/pub/bin/pub.dart" training_args = [ "--help" ] }