[VM/SDK] Switch kernel isolate to run in Dart 2 mode

- Switch the kernel isolate to run in Dart2 mode
- Refactor build rules so bootstrapping of the front end happens
  with a prebuilt dart sdk
- Refactor application snapshot build rules so the kernel application
  snapshot rule does not get into a cyclic dependency during the
  bootstrap stage

Change-Id: I067c5f1165fb93811dcc8e390a8bf381db721e5b
Reviewed-on: https://dart-review.googlesource.com/70461
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
This commit is contained in:
asiva 2018-08-18 22:50:09 +00:00 committed by commit-bot@chromium.org
parent 222ac2498a
commit 499761f0da
22 changed files with 265 additions and 160 deletions

View file

@ -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" ]
}

View file

@ -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<String> definitions = request[4].cast<String>();
final List<String> typeDefinitions = request[5].cast<String>();
final String libraryUri = request[6];
final String klass = request[7]; // might be null
final bool isStatic = request[8];

View file

@ -1237,6 +1237,8 @@ executable("run_vm_tests") {
sources = [
"builtin_nolib.cc",
"dfe.cc",
"dfe.h",
"error_exit.cc",
"error_exit.h",
"run_vm_tests.cc",

View file

@ -459,10 +459,7 @@ static Dart_Isolate CreateAndSetupKernelIsolate(const char* script_uri,
Dart_IsolateFlags* flags,
char** error,
int* exit_code) {
const char* kernel_snapshot_uri = NULL;
if (Options::gen_snapshot_kind() != kAppJIT) {
kernel_snapshot_uri = dfe.frontend_filename();
}
const char* kernel_snapshot_uri = dfe.frontend_filename();
const char* uri =
kernel_snapshot_uri != NULL ? kernel_snapshot_uri : script_uri;
@ -473,20 +470,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(
@ -1258,7 +1254,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

View file

@ -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<uint8_t*>(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();

View file

@ -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)

View file

@ -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
}
}

View file

@ -643,7 +643,7 @@ MessageHandler::MessageStatus IsolateMessageHandler::HandleMessage(
#ifndef PRODUCT
void IsolateMessageHandler::NotifyPauseOnStart() {
if (!FLAG_support_service) {
if (!FLAG_support_service || Isolate::IsVMInternalIsolate(I)) {
return;
}
if (Service::debug_stream.enabled() || FLAG_warn_on_pause_with_no_debugger) {
@ -659,7 +659,7 @@ void IsolateMessageHandler::NotifyPauseOnStart() {
}
void IsolateMessageHandler::NotifyPauseOnExit() {
if (!FLAG_support_service) {
if (!FLAG_support_service || Isolate::IsVMInternalIsolate(I)) {
return;
}
if (Service::debug_stream.enabled() || FLAG_warn_on_pause_with_no_debugger) {
@ -1310,7 +1310,8 @@ const char* Isolate::MakeRunnable() {
event->Complete();
}
}
if (FLAG_support_service && Service::isolate_stream.enabled()) {
if (FLAG_support_service && !Isolate::IsVMInternalIsolate(this) &&
Service::isolate_stream.enabled()) {
ServiceEvent runnableEvent(this, ServiceEvent::kIsolateRunnable);
Service::HandleEvent(&runnableEvent);
}
@ -2438,10 +2439,7 @@ void Isolate::AppendServiceExtensionCall(const Instance& closure,
// done atomically.
void Isolate::RegisterServiceExtensionHandler(const String& name,
const Instance& closure) {
if (!FLAG_support_service) {
return;
}
if (Isolate::IsVMInternalIsolate(this)) {
if (!FLAG_support_service || Isolate::IsVMInternalIsolate(this)) {
return;
}
GrowableObjectArray& handlers =

View file

@ -469,6 +469,9 @@ IsolateReloadContext::~IsolateReloadContext() {
}
void IsolateReloadContext::ReportError(const Error& error) {
if (!FLAG_support_service || Isolate::IsVMInternalIsolate(I)) {
return;
}
if (FLAG_trace_reload) {
THR_Print("ISO-RELOAD: Error: %s\n", error.ToErrorCString());
}
@ -478,6 +481,9 @@ void IsolateReloadContext::ReportError(const Error& error) {
}
void IsolateReloadContext::ReportSuccess() {
if (!FLAG_support_service || Isolate::IsVMInternalIsolate(I)) {
return;
}
ServiceEvent service_event(I, ServiceEvent::kIsolateReload);
Service::HandleEvent(&service_event);
}

View file

@ -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) && \
!defined(DART_USE_INTERPRETER)
api_flags.use_field_guards = true;
@ -233,12 +234,10 @@ void KernelIsolate::Run() {
}
void KernelIsolate::Shutdown() {
Isolate::KillIfExists(isolate_, Isolate::kInternalKillMsg);
{
MonitorLocker ml(monitor_);
while (isolate_ != NULL) {
ml.Wait();
}
MonitorLocker ml(monitor_);
while (isolate_ != NULL) {
Isolate::KillIfExists(isolate_, Isolate::kInternalKillMsg);
ml.Wait();
}
}

View file

@ -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.
@ -129,15 +130,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 = [
[
@ -172,15 +177,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/
_full_sdk_libraries = [

View file

@ -833,14 +833,8 @@ class AppJitCompilerConfiguration extends CompilerConfiguration {
int get timeoutMultiplier {
var multiplier = 1;
if (_isDebug) multiplier *= 4;
if (_isDebug) multiplier *= 2;
if (_isChecked) multiplier *= 2;
// The CL in 396c92e disabled running the kernel-isolate from app-jit
// snapshots if the VM is run with --snapshot-kind=app-jit. This made our
// app-jit tests run slower.
if (previewDart2) multiplier *= 2;
return multiplier;
}

View file

@ -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"),

View file

@ -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 = []

View file

@ -7,5 +7,4 @@ import("../application_snapshot.gni")
application_snapshot("kernel_worker") {
main_dart = "kernel_worker.dart"
training_args = [ "--help" ]
dart_version = 2
}

View file

@ -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",

View file

@ -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"),

View file

@ -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",

View file

@ -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" ]
}

View file

@ -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.

View file

@ -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",
]
output = "$root_gen_dir/kernel_service.dill"
outputs = [
@ -74,14 +90,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),

View file

@ -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" ]
}