Skip to content

Commit 355c73d

Browse files
a-sivacommit-bot@chromium.org
authored andcommitted
[VM] Remove support for option --no-preview-dart-2
- option --no-preview-dart-2 will now result in an error - change aot-assembly build rule to generate AOT snapshot using Dart 2 - generate coresnapshot using Dart 2 (this snapshot is not used yet, next CL which switch the isolate create code to use this snapshot) - by pass all Dart1 test runs in the status file - change the default compiler setting in test.py to use dartk - have test.py not pick up any configuration for --no-preview-dart-2 Change-Id: Ia136943ebfd0fed0c52683b330745b3e2c7a7ce6 Reviewed-on: https://dart-review.googlesource.com/75820 Reviewed-by: Zach Anderson <zra@google.com> Commit-Queue: Siva Annamalai <asiva@google.com>
1 parent 95b8a19 commit 355c73d

File tree

23 files changed

+121
-2245
lines changed

23 files changed

+121
-2245
lines changed

runtime/bin/BUILD.gn

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -660,13 +660,6 @@ gen_snapshot_action("generate_snapshot_bin") {
660660
]
661661
args = [
662662
"--deterministic",
663-
664-
# TODO(asiva) remove these flags once the core snapshot is switched to
665-
# dart 2.
666-
"--no-strong",
667-
"--no-sync-async",
668-
"--no-reify-generic-functions",
669-
670663
"--snapshot_kind=" + dart_core_snapshot_kind,
671664
"--vm_snapshot_data=" + rebase_path(vm_snapshot_data, root_build_dir),
672665
"--vm_snapshot_instructions=" +

runtime/bin/main.cc

Lines changed: 36 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -165,18 +165,16 @@ static void WriteDepsFile(Dart_Isolate isolate) {
165165
success &= file->Print("%s ", dep);
166166
free(dep);
167167
}
168-
if (Options::preview_dart_2()) {
169-
if (kernel_isolate_is_running) {
170-
Dart_KernelCompilationResult result = Dart_KernelListDependencies();
171-
if (result.status != Dart_KernelCompilationStatus_Ok) {
172-
ErrorExit(
173-
kErrorExitCode,
174-
"Error: Failed to fetch dependencies from kernel service: %s\n\n",
175-
result.error);
176-
}
177-
success &= file->WriteFully(result.kernel, result.kernel_size);
178-
free(result.kernel);
168+
if (kernel_isolate_is_running) {
169+
Dart_KernelCompilationResult result = Dart_KernelListDependencies();
170+
if (result.status != Dart_KernelCompilationStatus_Ok) {
171+
ErrorExit(
172+
kErrorExitCode,
173+
"Error: Failed to fetch dependencies from kernel service: %s\n\n",
174+
result.error);
179175
}
176+
success &= file->WriteFully(result.kernel, result.kernel_size);
177+
free(result.kernel);
180178
}
181179
success &= file->Print("\n");
182180
if (!success) {
@@ -300,8 +298,8 @@ static Dart_Isolate IsolateSetupHelper(Dart_Isolate isolate,
300298
CHECK_RESULT(result);
301299

302300
#if !defined(DART_PRECOMPILED_RUNTIME)
303-
if (Options::preview_dart_2() && !isolate_run_app_snapshot &&
304-
kernel_buffer == NULL && !Dart_IsKernelIsolate(isolate)) {
301+
if (!isolate_run_app_snapshot && kernel_buffer == NULL &&
302+
!Dart_IsKernelIsolate(isolate)) {
305303
if (!dfe.CanUseDartFrontend()) {
306304
const char* format = "Dart frontend unavailable to compile script %s.";
307305
intptr_t len = snprintf(NULL, 0, format, script_uri) + 1;
@@ -520,9 +518,6 @@ static Dart_Isolate CreateAndSetupServiceIsolate(const char* script_uri,
520518
#else
521519
// JIT: Service isolate uses the core libraries snapshot.
522520
bool skip_library_load = false;
523-
const uint8_t* isolate_snapshot_data = core_isolate_snapshot_data;
524-
const uint8_t* isolate_snapshot_instructions =
525-
core_isolate_snapshot_instructions;
526521
#endif // !defined(DART_PRECOMPILED_RUNTIME)
527522

528523
Dart_Isolate isolate = NULL;
@@ -540,36 +535,28 @@ static Dart_Isolate CreateAndSetupServiceIsolate(const char* script_uri,
540535
ASSERT(flags != NULL);
541536
flags->load_vmservice_library = true;
542537

543-
if (Options::preview_dart_2()) {
544-
// If there is intention to use DFE, then we create the isolate
545-
// from kernel only if we can.
546-
const uint8_t* kernel_buffer = NULL;
547-
intptr_t kernel_buffer_size = 0;
548-
dfe.LoadPlatform(&kernel_buffer, &kernel_buffer_size);
549-
if (kernel_buffer == NULL) {
550-
dfe.application_kernel_buffer(&kernel_buffer, &kernel_buffer_size);
551-
}
538+
// If there is intention to use DFE, then we create the isolate
539+
// from kernel only if we can.
540+
const uint8_t* kernel_buffer = NULL;
541+
intptr_t kernel_buffer_size = 0;
542+
dfe.LoadPlatform(&kernel_buffer, &kernel_buffer_size);
543+
if (kernel_buffer == NULL) {
544+
dfe.application_kernel_buffer(&kernel_buffer, &kernel_buffer_size);
545+
}
552546

553-
// TODO(sivachandra): When the platform program is unavailable, check if
554-
// application kernel binary is self contained or an incremental binary.
555-
// Isolate should be created only if it is a self contained kernel binary.
556-
if (kernel_buffer != NULL) {
557-
isolate = Dart_CreateIsolateFromKernel(script_uri, NULL, kernel_buffer,
558-
kernel_buffer_size, flags,
559-
isolate_data, error);
560-
} else {
561-
*error =
562-
strdup("Platform kernel not available to create service isolate.");
563-
delete isolate_data;
564-
return NULL;
565-
}
566-
skip_library_load = true;
547+
// TODO(sivachandra): When the platform program is unavailable, check if
548+
// application kernel binary is self contained or an incremental binary.
549+
// Isolate should be created only if it is a self contained kernel binary.
550+
if (kernel_buffer != NULL) {
551+
isolate = Dart_CreateIsolateFromKernel(script_uri, NULL, kernel_buffer,
552+
kernel_buffer_size, flags,
553+
isolate_data, error);
567554
} else {
568-
isolate = Dart_CreateIsolate(
569-
script_uri, main, isolate_snapshot_data, isolate_snapshot_instructions,
570-
app_isolate_shared_data, app_isolate_shared_instructions, flags,
571-
isolate_data, error);
555+
*error = strdup("Platform kernel not available to create service isolate.");
556+
delete isolate_data;
557+
return NULL;
572558
}
559+
skip_library_load = true;
573560
#endif // !defined(DART_PRECOMPILED_RUNTIME)
574561
if (isolate == NULL) {
575562
delete isolate_data;
@@ -663,7 +650,7 @@ static Dart_Isolate CreateIsolateAndSetupHelper(bool is_main_isolate,
663650
Dart_Isolate isolate = NULL;
664651

665652
#if !defined(DART_PRECOMPILED_RUNTIME)
666-
if (Options::preview_dart_2() && !isolate_run_app_snapshot) {
653+
if (!isolate_run_app_snapshot) {
667654
const uint8_t* platform_kernel_buffer = NULL;
668655
intptr_t platform_kernel_buffer_size = 0;
669656
dfe.LoadPlatform(&platform_kernel_buffer, &platform_kernel_buffer_size);
@@ -891,7 +878,7 @@ bool RunMainIsolate(const char* script_name, CommandLineOptions* dart_options) {
891878
}
892879

893880
Dart_Isolate isolate = NULL;
894-
if (Options::preview_dart_2() && Options::gen_snapshot_kind() == kAppAOT) {
881+
if (Options::gen_snapshot_kind() == kAppAOT) {
895882
isolate = IsolateSetupHelperAotCompilationDart2(
896883
script_name, "main", Options::package_root(), Options::packages_file(),
897884
&flags, &error, &exit_code);
@@ -935,12 +922,8 @@ bool RunMainIsolate(const char* script_name, CommandLineOptions* dart_options) {
935922
// the core snapshot.
936923
Platform::Exit(kErrorExitCode);
937924
}
938-
if (Options::preview_dart_2()) {
939-
Snapshot::GenerateKernel(Options::snapshot_filename(), script_name,
940-
isolate_data->resolved_packages_config());
941-
} else {
942-
Snapshot::GenerateScript(Options::snapshot_filename());
943-
}
925+
Snapshot::GenerateKernel(Options::snapshot_filename(), script_name,
926+
isolate_data->resolved_packages_config());
944927
} else {
945928
// Lookup the library of the root script.
946929
Dart_Handle root_lib = Dart_RootLibrary();
@@ -1234,14 +1217,6 @@ void main(int argc, char** argv) {
12341217
// Since we loaded the script anyway, save it.
12351218
dfe.set_application_kernel_buffer(application_kernel_buffer,
12361219
application_kernel_buffer_size);
1237-
// Since we saw a dill file, it means we have to turn on all the
1238-
// preview_dart_2 options.
1239-
if (Options::no_preview_dart_2()) {
1240-
Log::PrintErr(
1241-
"A kernel file is specified as the input, "
1242-
"--no-preview-dart-2 option is incompatible with it\n");
1243-
Platform::Exit(kErrorExitCode);
1244-
}
12451220
Options::dfe()->set_use_dfe();
12461221
}
12471222
#endif
@@ -1262,9 +1237,8 @@ void main(int argc, char** argv) {
12621237
init_params.entropy_source = DartUtils::EntropySource;
12631238
init_params.get_service_assets = GetVMServiceAssetsArchiveCallback;
12641239
#if !defined(DART_PRECOMPILED_RUNTIME)
1265-
init_params.start_kernel_isolate = Options::preview_dart_2() &&
1266-
dfe.UseDartFrontend() &&
1267-
dfe.CanUseDartFrontend();
1240+
init_params.start_kernel_isolate =
1241+
dfe.UseDartFrontend() && dfe.CanUseDartFrontend();
12681242
#else
12691243
init_params.start_kernel_isolate = false;
12701244
#endif

runtime/bin/main_options.cc

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

66-
void Options::SetDart1Options(CommandLineOptions* vm_options) {
67-
vm_options->AddArgument("--no-strong");
68-
vm_options->AddArgument("--no-reify-generic-functions");
69-
vm_options->AddArgument("--no-sync-async");
70-
}
71-
7266
#if !defined(DART_PRECOMPILED_RUNTIME)
7367
DFE* Options::dfe_ = NULL;
7468

75-
// TODO(sivachandra): Make it an error to specify --dfe without
76-
// specifying --preview_dart_2.
7769
DEFINE_STRING_OPTION_CB(dfe, { Options::dfe()->set_frontend_filename(value); });
7870
#endif // !defined(DART_PRECOMPILED_RUNTIME)
7971

@@ -384,13 +376,9 @@ int Options::ParseArguments(int argc,
384376
}
385377
}
386378

387-
if (Options::no_preview_dart_2()) {
388-
Options::SetDart1Options(vm_options);
389-
} else {
390379
#if !defined(DART_PRECOMPILED_RUNTIME)
391-
Options::dfe()->set_use_dfe();
380+
Options::dfe()->set_use_dfe();
392381
#endif // !defined(DART_PRECOMPILED_RUNTIME)
393-
}
394382
if (Options::deterministic()) {
395383
// Both an embedder and VM flag.
396384
vm_options->AddArgument("--deterministic");
@@ -469,9 +457,6 @@ int Options::ParseArguments(int argc,
469457
}
470458
if (checked_set) {
471459
vm_options->AddArgument("--enable-asserts");
472-
if (Options::no_preview_dart_2()) {
473-
vm_options->AddArgument("--enable-type-checks");
474-
}
475460
}
476461

477462
// If --snapshot is given without --snapshot-kind, default to script snapshot.

runtime/bin/main_options.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ namespace bin {
4545
V(short_socket_read, short_socket_read) \
4646
V(short_socket_write, short_socket_write) \
4747
V(disable_exit, exit_disabled) \
48-
V(no_preview_dart_2, no_preview_dart_2) \
4948
V(preview_dart_2, nop_option)
5049

5150
// Boolean flags that have a short form.
@@ -111,8 +110,7 @@ class Options {
111110
CB_OPTIONS_LIST(CB_OPTIONS_DECL)
112111
#undef CB_OPTIONS_DECL
113112

114-
static bool preview_dart_2() { return !no_preview_dart_2(); }
115-
static void SetDart1Options(CommandLineOptions* vm_options);
113+
static bool preview_dart_2() { return true; }
116114

117115
static dart::SimpleHashMap* environment() { return environment_; }
118116

runtime/observatory/tests/service/service.status

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,9 @@ async_scope_test: Pass, Slow
7979
[ $mode == debug && ($arch == simarm || $arch == simarm64) ]
8080
*: SkipSlow
8181

82+
[ !$preview_dart_2 && ($runtime == dart_precompiled || $runtime == vm) ]
83+
*: SkipByDesign # Deprecating all Dart1 modes of execution
84+
8285
[ !$strong && ($compiler == dartk || $compiler == dartkp) ]
8386
*: Skip
8487

runtime/tests/vm/dart/snapshot_version_test.dart

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

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

runtime/tests/vm/vm.status

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
22
# for details. All rights reserved. Use of this source code is governed by a
33
# BSD-style license that can be found in the LICENSE file.
4+
45
cc/AllocGeneric_Overflow: Crash, Fail # These tests are expected to crash on all platforms.
56
cc/ArrayNew_Overflow_Crash: Crash, Fail # These tests are expected to crash on all platforms.
67
cc/CodeImmutability: Crash, Fail # These tests are expected to crash on all platforms.
@@ -20,16 +21,14 @@ cc/Profiler_InliningIntervalBoundry: Skip # Differences in ia32, debug, release
2021
cc/SNPrint_BadArgs: Crash, Fail # These tests are expected to crash on all platforms.
2122
dart/data_uri_import_test/none: SkipByDesign
2223
dart/entrypoints/*: Skip # Only supported in Dart 2 JIT (hot-reload -> issue 34199).
24+
dart/snapshot_version_test: Skip # This test is a Dart1 test (script snapshot)
2325

2426
[ $builder_tag == asan ]
2527
cc/CodeImmutability: Fail, OK # Address Sanitizer turns a crash into a failure.
2628

2729
[ $builder_tag == optimization_counter_threshold ]
2830
dart/appjit*: SkipByDesign # Test needs to a particular opt-counter value
2931

30-
[ $compiler == app_jit ]
31-
dart/snapshot_version_test: Fail, OK # Expects to find script snapshot relative to Dart source.
32-
3332
[ $compiler == app_jitk ]
3433
dart/data_uri_import_test/utf16: MissingRuntimeError
3534
dart/redirection_type_shuffling_test/none: RuntimeError
@@ -363,3 +362,6 @@ dart/slow_path_shared_stub_test: SkipSlow # Too slow with --slow-path-triggers-g
363362
dart/spawn_infinite_loop_test: Skip # We can shutdown an isolate before it reloads.
364363
dart/spawn_shutdown_test: Skip # We can shutdown an isolate before it reloads.
365364
dart/stack_overflow_shared_test: SkipSlow # Too slow with --slow-path-triggers-gc flag and not relevant outside precompiled.
365+
366+
[ ($runtime == vm || $runtime == dart_precompiled) && !$preview_dart_2 ]
367+
*:SkipByDesign # Deprecating all Dart1 modes of execution

runtime/vm/unit_test.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const intptr_t platform_strong_dill_size = kPlatformStrongDillSize;
3939

4040
DEFINE_FLAG(bool,
4141
use_dart_frontend,
42-
false,
42+
true,
4343
"Parse scripts with Dart-to-Kernel parser");
4444

4545
DECLARE_FLAG(bool, strong);

samples/samples.status

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ sample_extension/test/sample_extension_app_snapshot_test: Pass, RuntimeError # I
2323
[ $compiler == none && $runtime == vm && $system == fuchsia ]
2424
*: Skip # Not yet triaged.
2525

26+
[ !$preview_dart_2 && ($runtime == dart_precompiled || $runtime == vm) ]
27+
*: SkipByDesign # Deprecating all Dart1 modes of execution
28+
2629
[ $compiler == app_jitk || $compiler == dartk || $compiler == dartkb || $compiler == dartkp ]
2730
sample_extension/test/sample_extension_app_snapshot_test: RuntimeError
2831
sample_extension/test/sample_extension_script_snapshot_test: RuntimeError

0 commit comments

Comments
 (0)