Skip to content

Commit bc7220a

Browse files
a-sivacommit-bot@chromium.org
authored andcommitted
[VM] Turn dart2 on by default on the command line VM
- make Dart2 the default option for the command line VM - add option --no-preview-dart-2 as a fallback option to run dart1 - change test scripts to use the executable dart for testing dart2 mode instead of pkg/vm/tool/dart2 - adjust numerous build and test configurations Change-Id: Id813fa5b71a89c7ec9335d3f6e83cfc9f35f86e7 Reviewed-on: https://dart-review.googlesource.com/58240 Commit-Queue: Siva Annamalai <[email protected]> Reviewed-by: Brian Wilkerson <[email protected]> Reviewed-by: Alexander Thomas <[email protected]> Reviewed-by: Nate Bosch <[email protected]> Reviewed-by: Sigmund Cherem <[email protected]> Reviewed-by: Vijay Menon <[email protected]>
1 parent cdd2553 commit bc7220a

Some content is hidden

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

66 files changed

+209
-304
lines changed

BUILD.gn

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ group("default") {
1313
testonly = true
1414
}
1515
deps = [
16-
":runtime_kernel",
16+
":runtime",
1717
]
1818
}
1919

@@ -34,6 +34,11 @@ group("most") {
3434
}
3535

3636
group("runtime") {
37+
import("runtime/runtime_args.gni")
38+
39+
target_supports_aot = dart_target_arch == "arm" ||
40+
dart_target_arch == "arm64" || dart_target_arch == "x64"
41+
3742
if (targetting_fuchsia) {
3843
# Fuchsia has run_vm_tests marked testonly.
3944
testonly = true
@@ -45,21 +50,6 @@ group("runtime") {
4550
"runtime/bin:run_vm_tests",
4651
"runtime/bin:sample_extension",
4752
"runtime/bin:test_extension",
48-
]
49-
}
50-
51-
group("runtime_kernel") {
52-
import("runtime/runtime_args.gni")
53-
54-
target_supports_aot = dart_target_arch == "arm" ||
55-
dart_target_arch == "arm64" || dart_target_arch == "x64"
56-
57-
if (targetting_fuchsia) {
58-
# Fuchsia has run_vm_tests marked testonly.
59-
testonly = true
60-
}
61-
deps = [
62-
":runtime",
6353
"runtime/vm:kernel_platform_files($host_toolchain)",
6454

6555
# TODO(rmacnak): Link this into 'dart'.
@@ -72,6 +62,12 @@ group("runtime_kernel") {
7262
}
7363
}
7464

65+
group("runtime_kernel") {
66+
deps = [
67+
":runtime",
68+
]
69+
}
70+
7571
group("runtime_precompiled") {
7672
deps = [
7773
"runtime/bin:dart_bootstrap($host_toolchain)",

pkg/front_end/test/fasta/bootstrap_test.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ Future runCompiler(Uri compiler, Uri input, Uri output) async {
4848
Uri dartVm = Uri.base.resolveUri(new Uri.file(Platform.resolvedExecutable));
4949
StdioProcess result = await StdioProcess.run(dartVm.toFilePath(), <String>[
5050
"-c",
51+
"--no_preview_dart_2",
5152
compiler.toFilePath(),
5253
"--compile-sdk=sdk/",
5354
"--output=${output.toFilePath()}",

pkg/front_end/test/whole_program_test.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ Future runCompiler(Uri input, Uri output) async {
5656

5757
final List<String> arguments = <String>[
5858
'--packages=${packagesFile.toFilePath()}',
59+
'--no_preview_dart_2',
5960
'-c',
6061
compiler.toFilePath(),
6162
'--platform=${platformDill.toFilePath()}',
@@ -91,7 +92,7 @@ Future dumpDillFile(Uri dillFile, Uri txtFile) async {
9192
}
9293

9394
Future runHelloWorld(Uri dillFile) async {
94-
final List<String> arguments = <String>['-c', dillFile.toFilePath()];
95+
final List<String> arguments = <String>[dillFile.toFilePath()];
9596
await run('Running hello.dart', arguments, 'hello world!\n');
9697
}
9798

pkg/front_end/testing.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,24 @@
8080
"exclude": [
8181
"/testcases/.*_part[0-9]*\\.dart$",
8282
"/testcases/.*_lib[0-9]*\\.dart$",
83+
"/testcases/bug33099",
84+
"/testcases/covariant_generic",
85+
"/testcases/inference/bug32291",
86+
"/testcases/inference/downward_inference_miscellaneous",
87+
"/testcases/inference/generic_methods_correctly_recognize_generic_upper_bound",
88+
"/testcases/inference/generic_methods_do_not_infer_invalid_override_of_generic_method",
89+
"/testcases/inference/generic_methods_nested_generic_instantiation",
90+
"/testcases/inference/infer_list_literal_nested_in_map_literal",
91+
"/testcases/inference/infer_return_of_statement_lambda",
92+
"/testcases/inference/override_equals",
93+
"/testcases/inference/unsafe_block_closure_inference_in_map_typed",
94+
"/testcases/inference/unsafe_block_closure_inference_method_call_explicit_type_param",
95+
"/testcases/rasta/issue_000002",
96+
"/testcases/regress/issue_31766",
97+
"/testcases/runtime_checks_new/contravariant_generic_return_with_compound_assign_implicit_downcast",
98+
"/testcases/runtime_checks_new/mixin_forwarding_stub_field",
99+
"/testcases/runtime_checks_new/mixin_forwarding_stub_setter",
100+
"/testcases/runtime_checks_new/stub_checked_via_target",
83101
"/testcases/dartino/",
84102
"/testcases/shaker/",
85103
"/testcases/expression/"

pkg/front_end/tool/_fasta/compile_platform_legacy_test.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ main(List<String> arguments) {
2222
Uri platformDill = tmp.resolve("vm_platform.dill");
2323
Uri outlineDill = tmp.resolve("vm_outline_strong.dill");
2424
ProcessResult result = await Process.run(dartVm.toFilePath(), <String>[
25+
"--no_preview_dart_2",
2526
compilePlatform.toFilePath(),
2627
"-v",
2728
"dart:core",

pkg/front_end/tool/_fasta/compile_platform_test.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ main(List<String> arguments) {
2222
Uri platformDill = tmp.resolve("vm_platform.dill");
2323
Uri outlineDill = tmp.resolve("vm_outline_strong.dill");
2424
ProcessResult result = await Process.run(dartVm.toFilePath(), <String>[
25+
"--no_preview_dart_2",
2526
compilePlatform.toFilePath(),
2627
"-v",
2728
"--strong",

pkg/front_end/tool/fasta

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,4 @@ esac
6868

6969
shift
7070

71-
exec "${DART_VM}" -c "${SCRIPT}" "$@"
71+
exec "${DART_VM}" --no_preview_dart_2 -c "${SCRIPT}" "$@"

pkg/pkg.status

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ analyzer/tool/task_dependency_graph/check_test: Slow, Pass
222222
front_end/tool/perf_test: Slow, Pass
223223

224224
[ $runtime == vm && $checked ]
225+
analysis_server/test/benchmarks_test: Pass, Slow
225226
analysis_server/test/completion_test: Pass, Slow
226227
analysis_server/test/integration/edit/sort_members_test: Pass, Slow
227228
analysis_server/test/services/correction/fix_test: Pass, Slow

pkg/vm/tool/dart2

Lines changed: 0 additions & 46 deletions
This file was deleted.

pkg/vm/tool/dart2.bat

Lines changed: 0 additions & 38 deletions
This file was deleted.

runtime/bin/main.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,7 @@ static Dart_Isolate CreateAndSetupKernelIsolate(const char* script_uri,
503503
}
504504

505505
if (isolate == NULL) {
506+
Log::PrintErr("%s\n", *error);
506507
delete isolate_data;
507508
return NULL;
508509
}
@@ -1302,7 +1303,7 @@ void main(int argc, char** argv) {
13021303
application_kernel_buffer_size);
13031304
// Since we saw a dill file, it means we have to turn on all the
13041305
// preview_dart_2 options.
1305-
Options::SetPreviewDart2Options(&vm_options);
1306+
Options::SetDart2Options(&vm_options);
13061307
}
13071308
#endif
13081309

runtime/bin/main_options.cc

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,19 +63,17 @@ ENUM_OPTIONS_LIST(ENUM_OPTION_DEFINITION)
6363
CB_OPTIONS_LIST(CB_OPTION_DEFINITION)
6464
#undef CB_OPTION_DEFINITION
6565

66-
void Options::SetPreviewDart2Options(CommandLineOptions* vm_options) {
67-
#if !defined(DART_PRECOMPILED_RUNTIME)
68-
Options::dfe()->set_use_dfe();
69-
#endif // !defined(DART_PRECOMPILED_RUNTIME)
70-
OPTION_FIELD(preview_dart_2) = true;
66+
void Options::SetDart2Options(CommandLineOptions* vm_options) {
7167
vm_options->AddArgument("--strong");
7268
vm_options->AddArgument("--reify-generic-functions");
7369
vm_options->AddArgument("--sync-async");
7470
}
7571

76-
bool OPTION_FIELD(preview_dart_2) = false;
77-
DEFINE_BOOL_OPTION_CB(preview_dart_2,
78-
{ Options::SetPreviewDart2Options(vm_options); });
72+
void Options::SetDart1Options(CommandLineOptions* vm_options) {
73+
vm_options->AddArgument("--no-strong");
74+
vm_options->AddArgument("--no-reify-generic-functions");
75+
vm_options->AddArgument("--no-sync-async");
76+
}
7977

8078
#if !defined(DART_PRECOMPILED_RUNTIME)
8179
DFE* Options::dfe_ = NULL;
@@ -338,6 +336,9 @@ int Options::ParseArguments(int argc,
338336
const char* kPrefix = "--";
339337
const intptr_t kPrefixLen = strlen(kPrefix);
340338

339+
// Set Dart 2 as the default option.
340+
Options::SetDart2Options(vm_options);
341+
341342
// Store the executable name.
342343
Platform::SetExecutableName(argv[0]);
343344

@@ -381,6 +382,13 @@ int Options::ParseArguments(int argc,
381382
}
382383
}
383384

385+
if (Options::no_preview_dart_2()) {
386+
Options::SetDart1Options(vm_options);
387+
} else {
388+
#if !defined(DART_PRECOMPILED_RUNTIME)
389+
Options::dfe()->set_use_dfe();
390+
#endif // !defined(DART_PRECOMPILED_RUNTIME)
391+
}
384392
if (Options::deterministic()) {
385393
// Both an embedder and VM flag.
386394
vm_options->AddArgument("--deterministic");

runtime/bin/main_options.h

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ namespace bin {
4242
V(trace_loading, trace_loading) \
4343
V(short_socket_read, short_socket_read) \
4444
V(short_socket_write, short_socket_write) \
45-
V(disable_exit, exit_disabled)
45+
V(disable_exit, exit_disabled) \
46+
V(no_preview_dart_2, no_preview_dart_2)
4647

4748
// Boolean flags that have a short form.
4849
#define SHORT_BOOL_OPTIONS_LIST(V) \
@@ -107,8 +108,9 @@ class Options {
107108
CB_OPTIONS_LIST(CB_OPTIONS_DECL)
108109
#undef CB_OPTIONS_DECL
109110

110-
static bool preview_dart_2() { return preview_dart_2_; }
111-
static void SetPreviewDart2Options(CommandLineOptions* vm_options);
111+
static bool preview_dart_2() { return !no_preview_dart_2(); }
112+
static void SetDart2Options(CommandLineOptions* vm_options);
113+
static void SetDart1Options(CommandLineOptions* vm_options);
112114

113115
static dart::HashMap* environment() { return environment_; }
114116

@@ -143,7 +145,6 @@ class Options {
143145
ENUM_OPTIONS_LIST(ENUM_OPTION_DECL)
144146
#undef ENUM_OPTION_DECL
145147

146-
static bool preview_dart_2_;
147148
static dart::HashMap* environment_;
148149

149150
// Frontend argument processing.
@@ -175,8 +176,6 @@ class Options {
175176
ENUM_OPTIONS_LIST(ENUM_OPTION_FRIEND)
176177
#undef ENUM_OPTION_FRIEND
177178

178-
friend class OptionProcessor_preview_dart_2;
179-
180179
DISALLOW_ALLOCATION();
181180
DISALLOW_IMPLICIT_CONSTRUCTORS(Options);
182181
};

runtime/observatory/tests/service/service.status

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,12 @@ pause_on_unhandled_async_exceptions_test: Pass, RuntimeError # Issue 33365
7272
[ $compiler == dart2analyzer && $strong ]
7373
*: Skip # Issue 28649
7474

75+
[ $compiler == none && $runtime == vm ]
76+
coverage_leaf_function_test: RuntimeError
77+
coverage_optimized_function_test: RuntimeError
78+
get_object_rpc_test: RuntimeError # Spawned process runs in Dart2 mode
79+
get_source_report_test: RuntimeError # Spawned process runs in Dart2 mode
80+
7581
[ $compiler == none && $runtime == vm && $system == fuchsia ]
7682
*: Skip # Not yet triaged.
7783

@@ -85,12 +91,8 @@ async_scope_test: Pass, Slow
8591
*: Skip
8692

8793
[ ($compiler == none || $compiler == precompiler) && ($runtime == dart_precompiled || $runtime == vm) ]
88-
async_step_out_test: RuntimeError # Issue 29158, Async debugging
89-
awaiter_async_stack_contents_test: RuntimeError # Issue 29158, Async debugging
9094
evaluate_activation_test/instance: RuntimeError # http://dartbug.com/20047
9195
evaluate_activation_test/scope: RuntimeError # http://dartbug.com/20047
92-
regress_28980_test: RuntimeError # Issue 29158, Async debugging
93-
set_library_debuggable_test: RuntimeError # Issue 29158, Async debugging
9496

9597
[ $arch != ia32 || $arch != x64 || $system != linux ]
9698
get_native_allocation_samples_test: Skip # Unsupported.

runtime/observatory/tests/service/service_kernel.status

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -233,8 +233,6 @@ async_generator_breakpoint_test: Pass, RuntimeError, Crash # dartbug.com/33175 f
233233
bad_reload_test: Skip # Times out on sim architectures, also RuntimeError.
234234
break_on_activation_test: RuntimeError # Issue #33087
235235
complex_reload_test: Skip # Times out on sim architectures, also RuntimeError.
236-
coverage_leaf_function_test: RuntimeError # Please triage.
237-
coverage_optimized_function_test: RuntimeError # Please triage.
238236
debugger_inspect_test: RuntimeError, Timeout # Issue #33087
239237
developer_service_get_isolate_id_test: RuntimeError # Issue #33087
240238
eval_internal_class_test: RuntimeError # Issue #33087
@@ -251,7 +249,6 @@ evaluate_with_scope_test: RuntimeError # Issue #33087
251249
get_instances_rpc_test: RuntimeError # Issue #33087
252250
get_object_rpc_test: RuntimeError # Please triage.
253251
get_retaining_path_rpc_test: RuntimeError # Issue #33087
254-
get_source_report_test: RuntimeError # Please triage.
255252
get_user_level_retaining_path_rpc_test: RuntimeError # Issue #33087
256253
instance_field_order_rpc_test: RuntimeError # Issue #33087
257254
pause_on_exceptions_test: RuntimeError, Timeout # Issue #33087

runtime/observatory/tests/service/service_test_common.dart

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -553,10 +553,9 @@ List<String> removeAdjacentDuplicates(List<String> fromList) {
553553

554554
bool isKernel() {
555555
for (String argument in Platform.executableArguments) {
556-
if (argument.startsWith("--preview_dart_2") || argument.startsWith("--dfe"))
557-
return true;
556+
if (argument.startsWith("--no-preview_dart_2")) return false;
558557
}
559-
return false;
558+
return true;
560559
}
561560

562561
E ifKernel<E>(E then, E otherwise) {

runtime/tests/vm/dart/snapshot_version_test.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@ import "dart:io";
66
import "package:expect/expect.dart";
77

88
main() {
9-
var result = Process.runSync(Platform.executable,
10-
[Platform.script.resolve('./bad_snapshot').toFilePath()]);
9+
var result = Process.runSync(Platform.executable, [
10+
'--no-preview-dart-2',
11+
Platform.script.resolve('./bad_snapshot').toFilePath()
12+
]);
1113
print("=== stdout ===\n ${result.stdout}");
1214
print("=== stderr ===\n ${result.stderr}");
1315
Expect.equals(253, result.exitCode);

0 commit comments

Comments
 (0)