Skip to content

Commit 97bc401

Browse files
committed
Revert "[VM/dartdev] Switch dartdev to use an AOT runtime."
This reverts commit 5399dbf. Reason for revert : Flutter rolls are failing TEST=ci Change-Id: I76fede849705514496adbc2ab7f6c262de4103ca Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/439661 Reviewed-by: Jason Simmons <[email protected]> Commit-Queue: Siva Annamalai <[email protected]>
1 parent 1a8b172 commit 97bc401

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+1687
-2640
lines changed

BUILD.gn

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ group("runtime") {
4242

4343
deps = [
4444
"runtime/bin:dart",
45-
"runtime/bin:dartvm",
4645
"runtime/bin:ffi_test_dynamic_library",
4746
"runtime/bin:ffi_test_functions",
4847
"runtime/bin:process_test",
@@ -61,15 +60,12 @@ group("runtime") {
6160
deps += [
6261
"runtime/bin:dartaotruntime",
6362
"runtime/bin:dartaotruntime_product",
64-
"utils/dartdev:dartdev_aot_snapshot",
6563
"utils/dds:dds_aot",
66-
"utils/dtd:dtd_aot",
6764
"utils/kernel-service:frontend_server_aot_product",
6865
]
6966
} else {
7067
deps += [
7168
"utils/dds:dds",
72-
"utils/dtd:dtd",
7369
"utils/kernel-service:frontend_server",
7470
]
7571
}
@@ -424,7 +420,7 @@ if (is_fuchsia) {
424420
}
425421

426422
test_binaries = [
427-
"dartvm",
423+
"dart",
428424
"dartaotruntime",
429425
"run_vm_tests",
430426
]

CHANGELOG.md

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -83,25 +83,6 @@ host platforms.
8383

8484
[cross-compilation]: https://dart.dev/tools/dart-compile#cross-compilation-exe
8585

86-
#### Dart CLI and Dart VM
87-
88-
- The Dart CLI and Dart VM have been split into two seperate executables.
89-
90-
The Dart CLI tool has been split out of the VM into it's own embedder which
91-
runs in AOT mode. The pure Dart VM executable is called `dartvm` and
92-
has no Dart CLI functionality in it
93-
94-
The Dart CLI executable parses the CLI commands and invokes the rest
95-
of the AOT tools in the same process, for the 'run' and 'test'
96-
commands it execs a process which runs `dartvm`
97-
98-
`dart hello.dart` execs the `dartvm` process and runs 'hello.dart'
99-
100-
The Dart CLI is not generated for ia32 as we are not shipping a
101-
Dart SDK for ia32 anymore (support to execute the `dartvm` for ia32
102-
architecture is retained)
103-
104-
10586
#### Pub
10687

10788
- Git dependencies can now be version-solved based on git tags.

build/dart/dart_action.gni

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ import("../executable_suffix.gni")
1010
# - prebuilt_dart_action()
1111
# Runs Dart scripts using the downloaded prebuilt Dart SDK. This is the
1212
# preferred method of running Dart code during the build as it is much
13-
# faster than using dartvm_action() in debug and cross builds.
13+
# faster than using dart_action() in debug and cross builds.
1414
# However, prebuilt_dart_action() should *not* be used to generate snapshots.
1515
#
1616
# - prebuilt_dartaotruntime_action()
1717
# Runs Dart AOT snapshots using the downloaded prebuilt Dart SDK. This is the
1818
# preferred method of running Dart AOT code during the build as it avoids
1919
# the multiple layers of code that prebuilt_dart_action goes through.
2020
#
21-
# - dartvm_action()
21+
# - dart_action()
2222
# Runs Dart scripts using the binary built for runtime/bin:dart using the
2323
# host toolchain. It should only be used when an artifact agreeing exactly
2424
# with the version of the Dart VM being built must be produced, for example
@@ -350,10 +350,10 @@ template("_built_tool_action") {
350350
# outputs
351351
# testonly
352352
# visibility
353-
template("dartvm_action") {
353+
template("dart_action") {
354354
assert(defined(invoker.script), "script must be defined for $target_name")
355355
_built_tool_action(target_name) {
356-
tool = "$_dart_root/runtime/bin:dartvm"
356+
tool = "$_dart_root/runtime/bin:dart"
357357
forward_variables_from(invoker,
358358
[
359359
"args",

build/rbe/rewrapper_dart.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -269,9 +269,6 @@ def parse_rewrapper(self):
269269
elif arg.endswith('/dart'):
270270
self.dart_subdir = os.path.dirname(arg)
271271
return self.parse_dart()
272-
elif arg.endswith('/dartvm'):
273-
self.dart_subdir = os.path.dirname(arg)
274-
return self.parse_dart()
275272
elif arg.endswith('/dartaotruntime'):
276273
self.dart_subdir = os.path.dirname(arg)
277274
return self.parse_dartaotruntime()

pkg/analysis_server/integration_test/analysis/get_errors_non_standard_sdk_test.dart

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,6 @@ class AnalysisDomainGetErrorsTest
2727
return path.join(sdkPath, 'bin', name);
2828
}
2929

30-
String executableVmFilePathIn(String sdkPath) {
31-
var name = Platform.isWindows ? 'dartvm.exe' : 'dartvm';
32-
return path.join(sdkPath, 'bin', name);
33-
}
34-
3530
String serverSnapshotPathIn(String sdkPath) {
3631
return path.join(
3732
sdkPath,
@@ -55,10 +50,6 @@ class AnalysisDomainGetErrorsTest
5550
executableFilePathIn(standardSdkPath),
5651
).copySync(executableFilePathIn(sdkPath));
5752

58-
File(
59-
executableVmFilePathIn(standardSdkPath),
60-
).copySync(executableVmFilePathIn(sdkPath));
61-
6253
File(
6354
serverSnapshotPathIn(standardSdkPath),
6455
).copySync(serverSnapshotPathIn(sdkPath));

pkg/dartdev/lib/src/commands/compile.dart

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,19 @@ class CompileJSCommand extends CompileSubcommandCommand {
9898
}
9999
final args = argResults!;
100100
var snapshot = sdk.dart2jsAotSnapshot;
101+
var script = sdk.dartAotRuntime;
102+
var useExecProcess = true;
101103
if (!Sdk.checkArtifactExists(snapshot, logError: false)) {
102-
log.stderr('Error: JS compilation failed');
103-
log.stderr('Unable to find $snapshot');
104-
return compileErrorExitCode;
104+
// AOT snapshots cannot be generated on IA32, so we need this fallback
105+
// branch until support for IA32 is dropped (https://dartbug.com/49969).
106+
script = sdk.dart2jsSnapshot;
107+
if (!Sdk.checkArtifactExists(script)) {
108+
return genericErrorExitCode;
109+
}
110+
useExecProcess = false;
105111
}
106112
final dart2jsCommand = [
113+
if (useExecProcess) snapshot,
107114
'--libraries-spec=${sdk.librariesJson}',
108115
'--cfe-invocation-modes=compile',
109116
'--invoker=dart_cli',
@@ -112,10 +119,10 @@ class CompileJSCommand extends CompileSubcommandCommand {
112119
];
113120
try {
114121
VmInteropHandler.run(
115-
snapshot,
122+
script,
116123
dart2jsCommand,
117124
packageConfigOverride: null,
118-
useExecProcess: false,
125+
useExecProcess: useExecProcess,
119126
);
120127
return 0;
121128
} catch (e, st) {
@@ -156,21 +163,28 @@ class CompileDDCCommand extends CompileSubcommandCommand {
156163
}
157164
final args = argResults!;
158165
var snapshot = sdk.ddcAotSnapshot;
166+
var script = sdk.dartAotRuntime;
167+
var useExecProcess = true;
159168
if (!Sdk.checkArtifactExists(snapshot, logError: false)) {
160-
log.stderr('Error: JS compilation failed');
161-
log.stderr('Unable to find $snapshot');
162-
return compileErrorExitCode;
169+
// AOT snapshots cannot be generated on IA32, so we need this fallback
170+
// branch until support for IA32 is dropped (https://dartbug.com/49969).
171+
script = sdk.ddcSnapshot;
172+
if (!Sdk.checkArtifactExists(script)) {
173+
return genericErrorExitCode;
174+
}
175+
useExecProcess = false;
163176
}
164177
final ddcCommand = <String>[
178+
if (useExecProcess) snapshot,
165179
// Add the remaining arguments.
166180
if (args.rest.isNotEmpty) ...args.rest.sublist(0),
167181
];
168182
try {
169183
VmInteropHandler.run(
170-
snapshot,
184+
script,
171185
ddcCommand,
172186
packageConfigOverride: null,
173-
useExecProcess: false,
187+
useExecProcess: useExecProcess,
174188
);
175189
return 0;
176190
} catch (e, st) {
@@ -445,7 +459,7 @@ class CompileJitSnapshotCommand extends CompileSubcommandCommand {
445459

446460
log.stdout('Compiling $sourcePath to jit-snapshot file $outputFile.');
447461
// TODO(bkonyi): perform compilation in same process.
448-
return await runProcess([sdk.dartvm, ...buildArgs]);
462+
return await runProcess([sdk.dart, ...buildArgs]);
449463
}
450464
}
451465

pkg/dartdev/lib/src/commands/dart_mcp_server.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,12 @@ A stdio based Model Context Protocol (MCP) server to aid in Dart and Flutter dev
5151
}
5252
try {
5353
VmInteropHandler.run(
54-
sdk.dartMCPServerAotSnapshot,
54+
sdk.dartAotRuntime,
5555
[
56+
sdk.dartMCPServerAotSnapshot,
5657
...forwardedArgs,
5758
],
58-
useExecProcess: false,
59+
useExecProcess: true,
5960
);
6061
return 0;
6162
} catch (e, st) {

pkg/dartdev/lib/src/commands/development_service.dart

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// BSD-style license that can be found in the LICENSE file.
44

55
import 'dart:async';
6+
import 'dart:io';
67

78
import 'package:dds/src/arg_parser.dart';
89
import 'package:path/path.dart';
@@ -36,22 +37,38 @@ class DevelopmentServiceCommand extends DartdevCommand {
3637
Future<int> run() async {
3738
final sdkDir = dirname(sdk.dart);
3839
final fullSdk = sdkDir.endsWith('bin');
40+
var script = fullSdk
41+
? sdk.dartAotRuntime
42+
: absolute(sdkDir, 'dartaotruntime${Platform.isWindows ? '.exe' : ''}');
3943
var snapshot = fullSdk
4044
? sdk.ddsAotSnapshot
4145
: absolute(sdkDir, 'dds_aot.dart.snapshot');
46+
var useExecProcess = true;
4247
final args = argResults!.arguments;
4348

4449
if (!Sdk.checkArtifactExists(snapshot, logError: false)) {
45-
log.stderr('Error: launching development server failed : '
46-
'Unable to find snapshot for the development server');
47-
return 255;
50+
// On ia32 platforms we do not have an AOT snapshot and so we need
51+
// to run the JIT snapshot.
52+
useExecProcess = false;
53+
script =
54+
fullSdk ? sdk.ddsSnapshot : absolute(sdkDir, 'dds.dart.snapshot');
55+
if (!Sdk.checkArtifactExists(script, logError: false)) {
56+
log.stderr('Error: launching development server failed : '
57+
'Unable to find snapshot for the development server');
58+
return 255;
59+
}
4860
}
61+
final ddsCommand = [
62+
if (useExecProcess) snapshot,
63+
// Add the remaining args.
64+
if (args.isNotEmpty) ...args,
65+
];
4966
try {
5067
VmInteropHandler.run(
51-
snapshot,
52-
args,
68+
script,
69+
ddsCommand,
5370
packageConfigOverride: null,
54-
useExecProcess: false,
71+
useExecProcess: useExecProcess,
5572
);
5673
return 0;
5774
} catch (e, st) {

pkg/dartdev/lib/src/commands/language_server.dart

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -54,35 +54,34 @@ For more information about the server's capabilities and configuration, see:
5454
args = [...args, '--$protocol=$lsp'];
5555
}
5656
try {
57-
var script = sdk.analysisServerAotSnapshot;
58-
var useExec = false;
5957
if (argResults!.flag(useAotSnapshotFlag)) {
60-
if (!Sdk.checkArtifactExists(sdk.analysisServerAotSnapshot)) {
61-
log.stderr('Error: launching language analysis server failed');
62-
log.stderr('${sdk.analysisServerAotSnapshot} not found');
58+
if (!Sdk.checkArtifactExists(sdk.dartAotRuntime)) {
6359
return _genericErrorExitCode;
6460
}
6561
args = [...args];
6662
args.remove('--$useAotSnapshotFlag');
63+
VmInteropHandler.run(
64+
sdk.dartAotRuntime,
65+
[sdk.analysisServerAotSnapshot, ...args],
66+
useExecProcess: true,
67+
);
6768
} else {
6869
args = [...args];
6970
args.remove('--no-$useAotSnapshotFlag');
70-
script = sdk.analysisServerSnapshot;
71-
useExec = true;
71+
VmInteropHandler.run(
72+
sdk.analysisServerSnapshot,
73+
args,
74+
useExecProcess: false,
75+
);
7276
}
73-
VmInteropHandler.run(
74-
script,
75-
args,
76-
useExecProcess: useExec,
77-
);
7877
return 0;
7978
} catch (e, st) {
8079
log.stderr('Error: launching language analysis server failed');
8180
log.stderr(e.toString());
8281
if (verbose) {
8382
log.stderr(st.toString());
8483
}
85-
return _genericErrorExitCode;
84+
return 255;
8685
}
8786
}
8887

0 commit comments

Comments
 (0)