mirror of
https://github.com/dart-lang/sdk
synced 2024-10-06 14:39:38 +00:00
Make --sync-async the default for the VM.
Change-Id: Ic6d7bbc27835ea7b197cccf05724adb99e95dd51 Reviewed-on: https://dart-review.googlesource.com/57580 Commit-Queue: Vyacheslav Egorov <vegorov@google.com> Reviewed-by: Martin Kustermann <kustermann@google.com>
This commit is contained in:
parent
a518d3c6dc
commit
1ddf553eb6
|
@ -13,6 +13,9 @@
|
|||
|
||||
### Dart VM
|
||||
|
||||
* The VM now uses `--sync-async` by default. Users can still opt out by
|
||||
providing the `--no-sync-async` flag.
|
||||
|
||||
### Tool Changes
|
||||
|
||||
#### Analyzer
|
||||
|
|
|
@ -533,15 +533,17 @@ abstract class DartCompletionContributorTest extends AbstractContextTest {
|
|||
}
|
||||
|
||||
Future<E> performAnalysis<E>(int times, Completer<E> completer) async {
|
||||
// Await a microtask. Otherwise the futures are chained and would
|
||||
// resolve linearly using up the stack.
|
||||
await null;
|
||||
if (completer.isCompleted) {
|
||||
return completer.future;
|
||||
}
|
||||
// We use a delayed future to allow microtask events to finish. The
|
||||
// Future.value or Future() constructors use scheduleMicrotask themselves and
|
||||
// would therefore not wait for microtask callbacks that are scheduled after
|
||||
// invoking this method.
|
||||
return new Future.delayed(
|
||||
Duration.zero, () => performAnalysis(times - 1, completer));
|
||||
// Future.value or Future.microtask() constructors use scheduleMicrotask
|
||||
// themselves and would therefore not wait for microtask callbacks that
|
||||
// are scheduled after invoking this method.
|
||||
return new Future(() => performAnalysis(times - 1, completer));
|
||||
}
|
||||
|
||||
void resolveSource(String path, String content) {
|
||||
|
|
|
@ -1939,6 +1939,8 @@ class AnalysisDriverScheduler {
|
|||
* priority first.
|
||||
*/
|
||||
Future<Null> _run() async {
|
||||
// Give other microtasks the time to run before doing the analysis cycle.
|
||||
await null;
|
||||
Stopwatch timer = new Stopwatch()..start();
|
||||
PerformanceLogSection analysisSection;
|
||||
while (true) {
|
||||
|
|
|
@ -212,7 +212,7 @@ const Map<String, dynamic> optionSpecification = const <String, dynamic>{
|
|||
"--sdk": Uri,
|
||||
"--strong": "--strong-mode",
|
||||
"--strong-mode": false,
|
||||
"--sync-async": false,
|
||||
"--sync-async": true,
|
||||
"--target": String,
|
||||
"--verbose": false,
|
||||
"--verify": false,
|
||||
|
|
|
@ -28,7 +28,8 @@ final ArgParser _argParser = new ArgParser(allowTrailingOptions: true)
|
|||
'Produce kernel file for AOT compilation (enables global transformations).',
|
||||
defaultsTo: false)
|
||||
..addFlag('strong-mode', help: 'Enable strong mode', defaultsTo: true)
|
||||
..addFlag('sync-async', help: 'Start `async` functions synchronously')
|
||||
..addFlag('sync-async',
|
||||
help: 'Start `async` functions synchronously', defaultsTo: true)
|
||||
..addFlag('embed-sources',
|
||||
help: 'Embed source files in the generated kernel component',
|
||||
defaultsTo: true)
|
||||
|
|
|
@ -48,7 +48,7 @@ ArgParser argParser = new ArgParser(allowTrailingOptions: true)
|
|||
help: 'Run compiler in strong mode (uses strong mode semantics)',
|
||||
defaultsTo: false)
|
||||
..addFlag('sync-async',
|
||||
help: 'Start `async` functions synchronously.', defaultsTo: false)
|
||||
help: 'Start `async` functions synchronously.', defaultsTo: true)
|
||||
..addFlag('tfa',
|
||||
help:
|
||||
'Enable global type flow analysis and related transformations in AOT mode.',
|
||||
|
|
|
@ -69,16 +69,16 @@ Future<int> main() async {
|
|||
)).captured;
|
||||
expect(capturedArgs.single['sdk-root'], equals('sdkroot'));
|
||||
expect(capturedArgs.single['strong'], equals(true));
|
||||
expect(capturedArgs.single['sync-async'], equals(false));
|
||||
expect(capturedArgs.single['sync-async'], equals(true));
|
||||
});
|
||||
|
||||
test('compile from command line (sync-async)', () async {
|
||||
test('compile from command line (no-sync-async)', () async {
|
||||
final List<String> args = <String>[
|
||||
'server.dart',
|
||||
'--sdk-root',
|
||||
'sdkroot',
|
||||
'--strong',
|
||||
'--sync-async',
|
||||
'--no-sync-async',
|
||||
];
|
||||
final int exitcode = await starter(args, compiler: compiler);
|
||||
expect(exitcode, equals(0));
|
||||
|
@ -89,7 +89,7 @@ Future<int> main() async {
|
|||
)).captured;
|
||||
expect(capturedArgs.single['sdk-root'], equals('sdkroot'));
|
||||
expect(capturedArgs.single['strong'], equals(true));
|
||||
expect(capturedArgs.single['sync-async'], equals(true));
|
||||
expect(capturedArgs.single['sync-async'], equals(false));
|
||||
});
|
||||
|
||||
test('compile from command line with link platform', () async {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
|
||||
// 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.
|
||||
// VMOptions=--error_on_bad_type --error_on_bad_override --verbose_debug --async_debugger
|
||||
// VMOptions=--error_on_bad_type --error_on_bad_override --verbose_debug --async_debugger --no-sync-async
|
||||
|
||||
import 'dart:developer';
|
||||
import 'service_test_common.dart';
|
||||
|
|
|
@ -78,8 +78,12 @@ async_scope_test: Pass, Slow
|
|||
*: Skip
|
||||
|
||||
[ ($compiler == none || $compiler == precompiler) && ($runtime == dart_precompiled || $runtime == vm) ]
|
||||
async_step_out_test: RuntimeError # Issue 29158, Async debugging
|
||||
awaiter_async_stack_contents_test: RuntimeError # Issue 29158, Async debugging
|
||||
evaluate_activation_test/instance: RuntimeError # http://dartbug.com/20047
|
||||
evaluate_activation_test/scope: RuntimeError # http://dartbug.com/20047
|
||||
regress_28980_test: RuntimeError # Issue 29158, Async debugging
|
||||
set_library_debuggable_test: RuntimeError # Issue 29158, Async debugging
|
||||
|
||||
[ $arch != ia32 || $arch != x64 || $system != linux ]
|
||||
get_native_allocation_samples_test: Skip # Unsupported.
|
||||
|
|
|
@ -4408,43 +4408,6 @@ TEST_CASE(DartAPI_NegativeNativeFieldAccess) {
|
|||
EXPECT(Dart_IsError(result));
|
||||
}
|
||||
|
||||
TEST_CASE(DartAPI_NegativeNativeFieldInIsolateMessage) {
|
||||
const char* kScriptChars =
|
||||
"import 'dart:isolate';\n"
|
||||
"import 'dart:nativewrappers';\n"
|
||||
"echo(msg) {\n"
|
||||
" var data = msg[0];\n"
|
||||
" var reply = msg[1];\n"
|
||||
" reply.send('echoing ${data(1)}}');\n"
|
||||
"}\n"
|
||||
"class Test extends NativeFieldWrapperClass2 {\n"
|
||||
" Test(this.i, this.j);\n"
|
||||
" int i, j;\n"
|
||||
"}\n"
|
||||
"main() {\n"
|
||||
" var port = new RawReceivePort();\n"
|
||||
" var obj = new Test(1,2);\n"
|
||||
" var msg = [obj, port.sendPort];\n"
|
||||
" var snd = Isolate.spawn(echo, msg);\n"
|
||||
" port.handler = (msg) {\n"
|
||||
" port.close();\n"
|
||||
" print('from worker ${msg}');\n"
|
||||
" };\n"
|
||||
"}\n";
|
||||
|
||||
CHECK_API_SCOPE(thread);
|
||||
HANDLESCOPE(thread);
|
||||
|
||||
// Create a test library and Load up a test script in it.
|
||||
Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
|
||||
|
||||
// Invoke 'main' which should spawn an isolate and try to send an
|
||||
// object with native fields over to the spawned isolate. This
|
||||
// should result in an unhandled exception which is checked.
|
||||
Dart_Handle retobj = Dart_Invoke(lib, NewString("main"), 0, NULL);
|
||||
EXPECT(Dart_IsError(retobj));
|
||||
}
|
||||
|
||||
TEST_CASE(DartAPI_GetStaticField_RunsInitializer) {
|
||||
const char* kScriptChars =
|
||||
"class TestClass {\n"
|
||||
|
|
|
@ -152,7 +152,7 @@
|
|||
C(stress_async_stacks, false, false, bool, false, \
|
||||
"Stress test async stack traces") \
|
||||
P(strong, bool, false, "Enable strong mode.") \
|
||||
P(sync_async, bool, false, "Start `async` functions synchronously.") \
|
||||
P(sync_async, bool, true, "Start `async` functions synchronously.") \
|
||||
R(support_ast_printer, false, bool, true, "Support the AST printer.") \
|
||||
R(support_compiler_stats, false, bool, true, "Support compiler stats.") \
|
||||
R(support_disassembler, false, bool, true, "Support the disassembler.") \
|
||||
|
|
|
@ -88,7 +88,7 @@ class RunKernelTask : public ThreadPool::Task {
|
|||
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.sync_async = true;
|
||||
#if !defined(DART_PRECOMPILER) && !defined(TARGET_ARCH_DBC)
|
||||
api_flags.use_field_guards = true;
|
||||
#endif
|
||||
|
|
|
@ -168,6 +168,7 @@ LibTest/typed_data/Int32List/buffer_A01_t02: Pass, Timeout # Flutter Issue 9109
|
|||
|
||||
[ $runtime == vm ]
|
||||
Language/Classes/Constructors/Generative_Constructors/execution_of_an_initializer_t02: MissingCompileTimeError # Issue 114
|
||||
Language/Expressions/Function_Invocation/async_invokation_t02: RuntimeError # sync-async is on by default.
|
||||
LibTest/isolate/Isolate/spawnUri_A01_t06: Pass, Fail # Issue 28269, These tests are timing dependent and should be non-flaky once the fix for https://github.com/dart-lang/co19/issues/86 is merged into master. (They are skipped on $runtime == pre_compiled below.)
|
||||
LibTest/isolate/Isolate/spawnUri_A01_t07: Pass, Fail # Issue 28269, These tests are timing dependent and should be non-flaky once the fix for https://github.com/dart-lang/co19/issues/86 is merged into master. (They are skipped on $runtime == pre_compiled below.)
|
||||
LibTest/isolate/Isolate/spawn_A04_t01: Pass, Fail # Issue 28269, These tests are timing dependent and should be non-flaky once the fix for https://github.com/dart-lang/co19/issues/86 is merged into master. (They are skipped on $runtime == pre_compiled below.)
|
||||
|
|
|
@ -474,6 +474,10 @@ vm/causal_async_exception_stack_test: SkipByDesign # Causal async stacks are not
|
|||
|
||||
[ $runtime == dart_precompiled || $runtime == vm ]
|
||||
arithmetic_test: CompileTimeError # Large integer literal
|
||||
async_await_test: RuntimeError # sync-async is on by default
|
||||
asyncstar_throw_in_catch_test: RuntimeError # sync-async is on by default
|
||||
await_nonfuture_test: RuntimeError # sync-async is on by default
|
||||
await_not_started_immediately_test: RuntimeError # sync-async is on by default
|
||||
bit_operations_test: CompileTimeError # Large integer literal
|
||||
deopt_inlined_function_lazy_test: CompileTimeError # Large integer literal
|
||||
guess_cid_test: CompileTimeError # Large integer literal
|
||||
|
|
|
@ -153,6 +153,7 @@ typed_data/float32x4_test: Fail, Pass # Safari has an optimization bug (nightlie
|
|||
typed_data/int32x4_test: Fail, Pass # Safari has an optimization bug (nightlies are already fine).
|
||||
|
||||
[ $runtime == vm ]
|
||||
async/async_await_sync_completer_test: RuntimeError # sync-async is on by default.
|
||||
convert/streamed_conversion_json_utf8_decode_test: Pass, Slow # Infrequent timeouts.
|
||||
|
||||
[ !$checked ]
|
||||
|
|
34
tests/lib_2/isolate/native_wrapper_message_test.dart
Normal file
34
tests/lib_2/isolate/native_wrapper_message_test.dart
Normal file
|
@ -0,0 +1,34 @@
|
|||
// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
|
||||
// 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.
|
||||
|
||||
import 'dart:isolate';
|
||||
import 'dart:nativewrappers';
|
||||
import 'package:expect/expect.dart';
|
||||
import 'package:async_helper/async_helper.dart';
|
||||
|
||||
echo(msg) {
|
||||
var data = msg[0];
|
||||
var reply = msg[1];
|
||||
reply.send('echoing ${data(1)}}');
|
||||
}
|
||||
|
||||
class Test extends NativeFieldWrapperClass2 {
|
||||
Test(this.i, this.j);
|
||||
int i, j;
|
||||
}
|
||||
|
||||
main() {
|
||||
var port = new RawReceivePort();
|
||||
var obj = new Test(1, 2);
|
||||
var msg = [obj, port.sendPort];
|
||||
var snd = Isolate.spawn(echo, msg);
|
||||
|
||||
asyncStart();
|
||||
snd.catchError((e) {
|
||||
Expect.isTrue(e is ArgumentError);
|
||||
Expect.isTrue("$e".contains("NativeWrapper"));
|
||||
port.close();
|
||||
asyncEnd();
|
||||
});
|
||||
}
|
|
@ -2,6 +2,9 @@
|
|||
# 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.
|
||||
|
||||
[ $runtime != vm ]
|
||||
isolate/native_wrapper_message_test: Skip # A VM specific test.
|
||||
|
||||
[ $arch == arm64 && $runtime == vm ]
|
||||
mirrors/immutable_collections_test: Pass, Slow # http://dartbug.com/33057
|
||||
|
||||
|
|
Loading…
Reference in a new issue