mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 01:45:06 +00:00
[Reland] [dartdev] Use an AOT snapshot for dds
This change enables use of an AOT snapshot for dds execution. TEST=ci Change-Id: I1eba2913a4160dee5de663622aa9106dd1d83c04 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/327710 Reviewed-by: Ben Konyi <bkonyi@google.com> Commit-Queue: Siva Annamalai <asiva@google.com>
This commit is contained in:
parent
731d7dc1c6
commit
df266b8a44
|
@ -388,13 +388,23 @@ class _DebuggingSession {
|
||||||
) async {
|
) async {
|
||||||
final sdkDir = dirname(sdk.dart);
|
final sdkDir = dirname(sdk.dart);
|
||||||
final fullSdk = sdkDir.endsWith('bin');
|
final fullSdk = sdkDir.endsWith('bin');
|
||||||
final ddsSnapshot = fullSdk
|
|
||||||
? sdk.ddsSnapshot
|
|
||||||
: absolute(sdkDir, 'gen', 'dds.dart.snapshot');
|
|
||||||
final devToolsBinaries =
|
final devToolsBinaries =
|
||||||
fullSdk ? sdk.devToolsBinaries : absolute(sdkDir, 'devtools');
|
fullSdk ? sdk.devToolsBinaries : absolute(sdkDir, 'devtools');
|
||||||
if (!Sdk.checkArtifactExists(ddsSnapshot)) {
|
String snapshotName = fullSdk
|
||||||
return false;
|
? sdk.ddsAotSnapshot
|
||||||
|
: absolute(sdkDir, 'gen', 'dds_aot.dart.snapshot');
|
||||||
|
String execName = sdk.dartAotRuntime;
|
||||||
|
if (!Sdk.checkArtifactExists(snapshotName)) {
|
||||||
|
// An AOT snapshot of dds is not available, we could
|
||||||
|
// be running on the ia32 platform so check for a regular
|
||||||
|
// kernel file being present.
|
||||||
|
snapshotName = fullSdk
|
||||||
|
? sdk.ddsSnapshot
|
||||||
|
: absolute(sdkDir, 'gen', 'dds.dart.snapshot');
|
||||||
|
if (!Sdk.checkArtifactExists(snapshotName)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
execName = sdk.dart;
|
||||||
}
|
}
|
||||||
ServiceProtocolInfo serviceInfo = await Service.getInfo();
|
ServiceProtocolInfo serviceInfo = await Service.getInfo();
|
||||||
// Wait for VM service to publish its connection info.
|
// Wait for VM service to publish its connection info.
|
||||||
|
@ -403,10 +413,10 @@ class _DebuggingSession {
|
||||||
serviceInfo = await Service.getInfo();
|
serviceInfo = await Service.getInfo();
|
||||||
}
|
}
|
||||||
final process = await Process.start(
|
final process = await Process.start(
|
||||||
sdk.dart,
|
execName,
|
||||||
[
|
[
|
||||||
if (debugDds) '--enable-vm-service=0',
|
if (debugDds) '--enable-vm-service=0',
|
||||||
ddsSnapshot,
|
snapshotName,
|
||||||
serviceInfo.serverUri.toString(),
|
serviceInfo.serverUri.toString(),
|
||||||
host,
|
host,
|
||||||
port,
|
port,
|
||||||
|
|
|
@ -52,6 +52,13 @@ class Sdk {
|
||||||
'dds.dart.snapshot',
|
'dds.dart.snapshot',
|
||||||
);
|
);
|
||||||
|
|
||||||
|
String get ddsAotSnapshot => path.absolute(
|
||||||
|
sdkPath,
|
||||||
|
'bin',
|
||||||
|
'snapshots',
|
||||||
|
'dds_aot.dart.snapshot',
|
||||||
|
);
|
||||||
|
|
||||||
String get frontendServerSnapshot => path.absolute(
|
String get frontendServerSnapshot => path.absolute(
|
||||||
sdkPath,
|
sdkPath,
|
||||||
'bin',
|
'bin',
|
||||||
|
|
|
@ -26,7 +26,7 @@ void _sdk() {
|
||||||
});
|
});
|
||||||
|
|
||||||
test('dds snapshot', () {
|
test('dds snapshot', () {
|
||||||
expectFileExists(Sdk().ddsSnapshot);
|
expectSnapshotExists(Sdk().ddsAotSnapshot, Sdk().ddsSnapshot);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('dart2js snapshot', () {
|
test('dart2js snapshot', () {
|
||||||
|
@ -45,6 +45,10 @@ void expectFileExists(String path) {
|
||||||
expect(File(path).existsSync(), isTrue);
|
expect(File(path).existsSync(), isTrue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void expectSnapshotExists(String aotpath, String jitpath) {
|
||||||
|
expect(File(aotpath).existsSync() || File(jitpath).existsSync(), isTrue);
|
||||||
|
}
|
||||||
|
|
||||||
void expectDirectoryExists(String path) {
|
void expectDirectoryExists(String path) {
|
||||||
expect(Directory(path).existsSync(), isTrue);
|
expect(Directory(path).existsSync(), isTrue);
|
||||||
}
|
}
|
||||||
|
|
17
sdk/BUILD.gn
17
sdk/BUILD.gn
|
@ -46,7 +46,7 @@ declare_args() {
|
||||||
# ........dart2wasm_product.snapshot (if not on ia32)
|
# ........dart2wasm_product.snapshot (if not on ia32)
|
||||||
# ........dartdev.dart.snapshot (app-jit snapshot or kernel dill file)
|
# ........dartdev.dart.snapshot (app-jit snapshot or kernel dill file)
|
||||||
# ........dartdevc.dart.snapshot
|
# ........dartdevc.dart.snapshot
|
||||||
# ........dds.dart.snapshot
|
# ........dds_aot.dart.snapshot (AOT snapshot) or dds.dart.snapshot (ia32)
|
||||||
# ........frontend_server_aot.dart.snapshot (AOT snapshot, if not on ia32)
|
# ........frontend_server_aot.dart.snapshot (AOT snapshot, if not on ia32)
|
||||||
# ........frontend_server.dart.snapshot
|
# ........frontend_server.dart.snapshot
|
||||||
# ........gen_kernel.dart.snapshot (if not on ia32)
|
# ........gen_kernel.dart.snapshot (if not on ia32)
|
||||||
|
@ -116,15 +116,22 @@ _platform_sdk_snapshots = [
|
||||||
"dartdev",
|
"dartdev",
|
||||||
"../utils/dartdev:dartdev",
|
"../utils/dartdev:dartdev",
|
||||||
],
|
],
|
||||||
[
|
|
||||||
"dds",
|
|
||||||
"../utils/dds:dds",
|
|
||||||
],
|
|
||||||
[
|
[
|
||||||
"frontend_server",
|
"frontend_server",
|
||||||
"../utils/kernel-service:frontend_server",
|
"../utils/kernel-service:frontend_server",
|
||||||
],
|
],
|
||||||
]
|
]
|
||||||
|
if (dart_target_arch != "ia32" && dart_target_arch != "x86") {
|
||||||
|
_platform_sdk_snapshots += [ [
|
||||||
|
"dds_aot",
|
||||||
|
"../utils/dds:dds_aot",
|
||||||
|
] ]
|
||||||
|
} else {
|
||||||
|
_platform_sdk_snapshots += [ [
|
||||||
|
"dds",
|
||||||
|
"../utils/dds:dds",
|
||||||
|
] ]
|
||||||
|
}
|
||||||
if (dart_snapshot_kind == "app-jit") {
|
if (dart_snapshot_kind == "app-jit") {
|
||||||
_platform_sdk_snapshots += [ [
|
_platform_sdk_snapshots += [ [
|
||||||
"kernel-service",
|
"kernel-service",
|
||||||
|
|
|
@ -81,11 +81,24 @@ class _DebuggingSession {
|
||||||
|
|
||||||
final fullSdk = dartDir.endsWith('bin');
|
final fullSdk = dartDir.endsWith('bin');
|
||||||
|
|
||||||
final ddsSnapshot = [
|
final dartAotPath = [
|
||||||
|
dartDir,
|
||||||
|
fullSdk ? 'dartaotruntime' : 'dart_precompiled_runtime_product',
|
||||||
|
].join('/');
|
||||||
|
String snapshotName = [
|
||||||
dartDir,
|
dartDir,
|
||||||
fullSdk ? 'snapshots' : 'gen',
|
fullSdk ? 'snapshots' : 'gen',
|
||||||
'dds.dart.snapshot',
|
'dds_aot.dart.snapshot',
|
||||||
].join('/');
|
].join('/');
|
||||||
|
String execName = dartAotPath;
|
||||||
|
if (!File(snapshotName).existsSync()) {
|
||||||
|
snapshotName = [
|
||||||
|
dartDir,
|
||||||
|
fullSdk ? 'snapshots' : 'gen',
|
||||||
|
'dds.dart.snapshot',
|
||||||
|
].join('/');
|
||||||
|
execName = dartPath.toString();
|
||||||
|
}
|
||||||
|
|
||||||
final devToolsBinaries = [
|
final devToolsBinaries = [
|
||||||
dartDir,
|
dartDir,
|
||||||
|
@ -95,9 +108,9 @@ class _DebuggingSession {
|
||||||
|
|
||||||
const enableLogging = false;
|
const enableLogging = false;
|
||||||
_process = await Process.start(
|
_process = await Process.start(
|
||||||
dartPath.toString(),
|
execName,
|
||||||
[
|
[
|
||||||
ddsSnapshot,
|
snapshotName,
|
||||||
server!.serverAddress!.toString(),
|
server!.serverAddress!.toString(),
|
||||||
host,
|
host,
|
||||||
port,
|
port,
|
||||||
|
|
|
@ -2,12 +2,17 @@
|
||||||
# for details. All rights reserved. Use of this source code is governed by a
|
# for details. All rights reserved. Use of this source code is governed by a
|
||||||
# BSD-style license that can be found in the LICENSE file.
|
# BSD-style license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
import("../aot_snapshot.gni")
|
||||||
import("../application_snapshot.gni")
|
import("../application_snapshot.gni")
|
||||||
|
|
||||||
group("dds") {
|
group("dds") {
|
||||||
public_deps = [ ":copy_dds_snapshot" ]
|
public_deps = [ ":copy_dds_snapshot" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
group("dds_aot") {
|
||||||
|
public_deps = [ ":copy_dds_aot_snapshot" ]
|
||||||
|
}
|
||||||
|
|
||||||
copy("copy_dds_snapshot") {
|
copy("copy_dds_snapshot") {
|
||||||
visibility = [ ":dds" ]
|
visibility = [ ":dds" ]
|
||||||
public_deps = [ ":generate_dds_snapshot" ]
|
public_deps = [ ":generate_dds_snapshot" ]
|
||||||
|
@ -15,8 +20,28 @@ copy("copy_dds_snapshot") {
|
||||||
outputs = [ "$root_out_dir/dds.dart.snapshot" ]
|
outputs = [ "$root_out_dir/dds.dart.snapshot" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
copy("copy_dds_aot_snapshot") {
|
||||||
|
visibility = [ ":dds_aot" ]
|
||||||
|
public_deps = [ ":generate_dds_aot_snapshot" ]
|
||||||
|
sources = [ "$root_gen_dir/dds_aot.dart.snapshot" ]
|
||||||
|
outputs = [ "$root_out_dir/dds_aot.dart.snapshot" ]
|
||||||
|
}
|
||||||
|
|
||||||
application_snapshot("generate_dds_snapshot") {
|
application_snapshot("generate_dds_snapshot") {
|
||||||
main_dart = "../../pkg/dds/bin/dds.dart"
|
main_dart = "../../pkg/dds/bin/dds.dart"
|
||||||
training_args = []
|
training_args = []
|
||||||
output = "$root_gen_dir/dds.dart.snapshot"
|
output = "$root_gen_dir/dds.dart.snapshot"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
aot_snapshot("generate_dds_aot_snapshot") {
|
||||||
|
main_dart = "../../pkg/dds/bin/dds.dart"
|
||||||
|
output = "$root_gen_dir/dds_aot.dart.snapshot"
|
||||||
|
|
||||||
|
# dartaotruntime has dart_product_config applied to it,
|
||||||
|
# so it is built in # product mode in both release and
|
||||||
|
# product builds, and is only built in debug mode in debug
|
||||||
|
# builds. The following line ensures that the dartaotruntime
|
||||||
|
# and frontend_server_aot snapshot in an SDK build are
|
||||||
|
# always compatible with each other.
|
||||||
|
force_product_mode = !dart_debug
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue