diff --git a/utils/application_snapshot.gni b/utils/application_snapshot.gni index 2c257a29f844..8504b2db3825 100644 --- a/utils/application_snapshot.gni +++ b/utils/application_snapshot.gni @@ -74,11 +74,65 @@ template("_application_snapshot") { if (defined(invoker.output)) { output = invoker.output } + + # Build the kernel file using the prebuilt VM to speed up the debug and + # simulator builds. + prebuilt_dart_action(target_name + "_dill") { + deps = + extra_deps + [ + "$_dart_root/runtime/vm:kernel_platform_files($dart_host_toolchain)", + "$_dart_root/runtime/vm:vm_platform", + ] + gen_kernel_script = "$_dart_root/pkg/vm/bin/gen_kernel.dart" + platform_dill = "$root_out_dir/vm_platform_strong.dill" + + inputs = extra_inputs + [ + gen_kernel_script, + platform_dill, + main_dart, + dot_packages, + ] + output = "$target_gen_dir/$name.dart.dill" + outputs = [ + output, + ] + + depfile = "$output.d" + abs_depfile = rebase_path(depfile) + rebased_output = rebase_path(output, root_build_dir) + vm_args = [ + "--depfile=$abs_depfile", + "--depfile_output_filename=$rebased_output", + ] + + script = gen_kernel_script + + args = [ + "--packages=" + rebase_path(dot_packages), + "--platform=" + rebase_path(platform_dill), + "--no-aot", + "--no-embed-sources", + "--no-link-platform", + "--output=" + rebase_path(output), + ] + # TODO(bytecode): Remove special case for the kernel service once + # interpreter-compiled transitions no longer cause stack overflows in + # the language_2/deep_nesting* tests. + if (dart_platform_bytecode && (name != "kernel-service_snapshot")) { + args += [ + "--gen-bytecode", + "--drop-ast", + "--bytecode-options=source-positions", + ] + } + args += [ rebase_path(main_dart) ] + } + dart_action(target_name) { - deps = extra_deps + deps = extra_deps + [ ":${target_name}_dill" ] depfile = "$output.d" - script = main_dart + script = "$target_gen_dir/$name.dart.dill" inputs = extra_inputs @@ -90,16 +144,14 @@ template("_application_snapshot") { abs_output = rebase_path(output, root_build_dir) vm_args = [ - "--deterministic", - "--packages=$dot_packages", - "--snapshot=$abs_output", - "--snapshot-depfile=$abs_depfile", - ] + snapshot_vm_args + "--deterministic", + "--packages=$dot_packages", + "--snapshot=$abs_output", + "--snapshot-depfile=$abs_depfile", + ] + snapshot_vm_args if (dart_snapshot_kind == "kernel") { - vm_args += [ - "--snapshot-kind=kernel", - ] + vm_args += [ "--snapshot-kind=kernel" ] assert(training_args != "", "Ignoring unused argument") args = [] } else if (dart_snapshot_kind == "app-jit") { @@ -141,9 +193,7 @@ template("application_snapshot") { if (!defined(invoker.deps)) { deps = [] } - deps += [ - "$_dart_root/utils/kernel-service:kernel-service" - ] + deps += [ "$_dart_root/utils/kernel-service:kernel-service" ] } } diff --git a/utils/compiler/BUILD.gn b/utils/compiler/BUILD.gn index 07e808710dc9..27dfc696becc 100644 --- a/utils/compiler/BUILD.gn +++ b/utils/compiler/BUILD.gn @@ -3,8 +3,8 @@ # BSD-style license that can be found in the LICENSE file. import("../../utils/compile_platform.gni") -import("../create_timestamp.gni") import("../application_snapshot.gni") +import("../create_timestamp.gni") create_timestamp_file("dart2js_files_stamp") { path = rebase_path("../../pkg/compiler/lib") @@ -21,18 +21,13 @@ create_timestamp_file("dartdoc_files_stamp") { output = "$target_gen_dir/dartdoc_files.stamp" } -dart_action("dart2js_create_snapshot_entry") { +prebuilt_dart_action("dart2js_create_snapshot_entry") { deps = [ ":dart2js_files_stamp", ":dartdoc_files_stamp", ":runtime_lib_files_stamp", ] - # 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:kernel-service" ] - output_dir = rebase_path(target_gen_dir) script = "create_snapshot_entry.dart" diff --git a/utils/dartdevc/BUILD.gn b/utils/dartdevc/BUILD.gn index b7b63ce6d770..2048ad4f2184 100644 --- a/utils/dartdevc/BUILD.gn +++ b/utils/dartdevc/BUILD.gn @@ -30,7 +30,9 @@ application_snapshot("dartdevc") { ":dartdevc_kernel_sdk_outline", ] - inputs = [ sdk_dill ] + inputs = [ + sdk_dill, + ] } sdk_lib_files = exec_script("../../tools/list_dart_files.py", @@ -62,16 +64,11 @@ template("dart2js_compile") { abs_main = rebase_path(main) abs_output = rebase_path(out) - dart_action(target_name) { + prebuilt_dart_action(target_name) { deps = [ "../compiler:compile_dart2js_platform", ] - # 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:kernel-service" ] - inputs = sdk_lib_files + compiler_files + dev_compiler_files + [ "$root_out_dir/dart2js_platform.dill", "$root_out_dir/dart2js_outline.dill", @@ -89,6 +86,7 @@ template("dart2js_compile") { "-m", "-o$abs_output", "--no-source-maps", + "--platform-binaries=" + rebase_path("$root_out_dir"), ] } } @@ -211,8 +209,8 @@ prebuilt_dart_action("dartdevc_sdk") { group("dartdevc_test") { deps = [ ":dartdevc", - ":dartdevc_sdk", ":dartdevc_kernel_sdk", + ":dartdevc_sdk", ":dartdevc_test_pkg", "../../sdk:create_sdk", ] @@ -223,8 +221,8 @@ group("dartdevc_test") { # building the Dart VM and create_sdk. group("dartdevc_test_local") { deps = [ - ":dartdevc_sdk", ":dartdevc_kernel_sdk", + ":dartdevc_sdk", ":dartdevc_test_pkg", ] } @@ -244,10 +242,10 @@ create_timestamp_file("dartdevc_sdk_patch_stamp") { prebuilt_dart_action("dartdevc_test_pkg") { deps = [ ":dartdevc_files_stamp", - ":dartdevc_sdk", ":dartdevc_kernel_sdk", - ":dartdevc_kernel_sdk_outline", ":dartdevc_kernel_sdk_libraries_json", + ":dartdevc_kernel_sdk_outline", + ":dartdevc_sdk", "../../pkg:pkg_files_stamp", ] @@ -319,9 +317,9 @@ prebuilt_dart_action("dartdevc_test_pkg") { prebuilt_dart_action("dartdevc_kernel_sdk_outline") { deps = [ - "../../pkg:pkg_files_stamp", ":dartdevc_files_stamp", ":dartdevc_sdk_patch_stamp", + "../../pkg:pkg_files_stamp", ] inputs = [ @@ -349,7 +347,7 @@ prebuilt_dart_action("dartdevc_kernel_sdk_outline") { "--output", rebase_path(sdk_dill), "--source", - "dart:core" + "dart:core", ] } @@ -365,9 +363,9 @@ copy("dartdevc_kernel_sdk_libraries_json") { # Compiles the DDC SDK's kernel summary and JS code. prebuilt_dart_action("dartdevc_kernel_sdk") { deps = [ - "../../pkg:pkg_files_stamp", ":dartdevc_files_stamp", ":dartdevc_sdk_patch_stamp", + "../../pkg:pkg_files_stamp", ] inputs = [ diff --git a/utils/kernel-service/BUILD.gn b/utils/kernel-service/BUILD.gn index a5f889c60e1b..d4d8fd59bf39 100644 --- a/utils/kernel-service/BUILD.gn +++ b/utils/kernel-service/BUILD.gn @@ -10,7 +10,6 @@ import("../application_snapshot.gni") group("kernel-service") { if (create_kernel_service_snapshot) { deps = [ - # TODO(rmacnak): Link this into 'dart'. ":copy_kernel-service_snapshot", ] } else { @@ -20,13 +19,8 @@ group("kernel-service") { } } -# TODO: Switch this to use kernel based app-jit snapshot -# when we are ready to switch to the kernel based core snapshots. kernel_application_snapshot("kernel-service_snapshot") { - main_dart = "$root_gen_dir/kernel_service.dill" - deps = [ - ":kernel_service_dill", - ] + main_dart = "../../pkg/vm/bin/kernel_service.dart" training_args = [ "--train", # Force triple-slashes both on Windows and otherwise.