From c133aa8660d925279dd1460ecf990d46a595421e Mon Sep 17 00:00:00 2001 From: Martin Kustermann Date: Fri, 2 Jul 2021 14:26:46 +0000 Subject: [PATCH] Reland "[vm] Remove --causal-async-stacks flag" The flag isn't used anywhere in our tests or in embedder code. Turning it on will result in a VM startup error. We should therefore remove all uses of the flag and the flag itself. This is a unmodified reland of https://dart-review.googlesource.com/c/sdk/+/204500 after some remaining g3 usages have been fixed (the flutter roll didn't port the GN changes to BUILD changes in g3) TEST=Existing test suite. Change-Id: Ic28c9b334a0b04524ee57e2554cc8d713a83fbfb Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/204785 Reviewed-by: Martin Kustermann Commit-Queue: Martin Kustermann --- runtime/lib/stacktrace.cc | 5 ----- runtime/tests/concurrency/stress_test_list.json | 12 ++++++------ .../sync_async_start_pkg_test_test.dart | 2 +- .../sync_async_start_pkg_test_test.dart | 2 +- .../compiler/frontend/kernel_binary_flowgraph.cc | 5 +---- runtime/vm/dart.cc | 8 -------- runtime/vm/debugger.cc | 7 ++----- runtime/vm/flag_list.h | 2 -- runtime/vm/kernel_loader.cc | 15 +++++---------- tests/language/language_kernel.status | 8 ++++---- ...dart => lazy_async_exception_stack2_test.dart} | 4 ++-- ...art => lazy_async_exception_stack_helper.dart} | 0 ....dart => lazy_async_exception_stack_test.dart} | 4 ++-- tests/language_2/language_2_kernel.status | 10 +++++----- ...dart => lazy_async_exception_stack2_test.dart} | 4 ++-- ...art => lazy_async_exception_stack_helper.dart} | 0 ....dart => lazy_async_exception_stack_test.dart} | 4 ++-- ...stack_test.dart => lazy_async_stack_test.dart} | 0 tests/standalone/standalone.status | 2 +- ...stack_test.dart => lazy_async_stack_test.dart} | 0 tests/standalone_2/standalone_2.status | 2 +- 21 files changed, 35 insertions(+), 61 deletions(-) rename tests/language/vm/{causal_async_exception_stack2_test.dart => lazy_async_exception_stack2_test.dart} (95%) rename tests/language/vm/{causal_async_exception_stack_helper.dart => lazy_async_exception_stack_helper.dart} (100%) rename tests/language/vm/{causal_async_exception_stack_test.dart => lazy_async_exception_stack_test.dart} (94%) rename tests/language_2/vm/{causal_async_exception_stack2_test.dart => lazy_async_exception_stack2_test.dart} (95%) rename tests/language_2/vm/{causal_async_exception_stack_helper.dart => lazy_async_exception_stack_helper.dart} (100%) rename tests/language_2/vm/{causal_async_exception_stack_test.dart => lazy_async_exception_stack_test.dart} (94%) rename tests/standalone/{causal_async_stack_test.dart => lazy_async_stack_test.dart} (100%) rename tests/standalone_2/{causal_async_stack_test.dart => lazy_async_stack_test.dart} (100%) diff --git a/runtime/lib/stacktrace.cc b/runtime/lib/stacktrace.cc index 545a3d37589..da73ef8ae42 100644 --- a/runtime/lib/stacktrace.cc +++ b/runtime/lib/stacktrace.cc @@ -74,11 +74,6 @@ static StackTracePtr CurrentSyncStackTrace(Thread* thread, } // Gets current stack trace for `thread`. -// This functions itself handles the --causel-async-stacks case. -// For --lazy-async-stacks see `CurrentSyncStackTraceLazy`. -// For fallback see `CurrentSyncStackTrace`. -// Extracts the causal async stack from the thread if any set, then prepends -// the current sync. stack up until the current async function (if any). static StackTracePtr CurrentStackTrace(Thread* thread, bool for_async_function, intptr_t skip_frames = 1) { diff --git a/runtime/tests/concurrency/stress_test_list.json b/runtime/tests/concurrency/stress_test_list.json index 68a2c00eb73..b8f2ae60828 100644 --- a/runtime/tests/concurrency/stress_test_list.json +++ b/runtime/tests/concurrency/stress_test_list.json @@ -2799,8 +2799,8 @@ "../../../tests/language/vm/bitnot_int_test.dart", "../../../tests/language/vm/bool_check_stack_traces_test.dart", "../../../tests/language/vm/canonicalization_preserves_deopt_test.dart", - "../../../tests/language/vm/causal_async_exception_stack2_test.dart", - "../../../tests/language/vm/causal_async_exception_stack_test.dart", + "../../../tests/language/vm/lazy_async_exception_stack2_test.dart", + "../../../tests/language/vm/lazy_async_exception_stack_test.dart", "../../../tests/language/vm/checked_smi_comparison_test.dart", "../../../tests/language/vm/checked_smi_op_test.dart", "../../../tests/language/vm/clamp_37868_test.dart", @@ -3223,7 +3223,7 @@ "../../../tests/standalone/assert_assignable_canon_test.dart", "../../../tests/standalone/byte_array_view_optimized_test.dart", "../../../tests/standalone/bytedata_test.dart", - "../../../tests/standalone/causal_async_stack_test.dart", + "../../../tests/standalone/lazy_async_stack_test.dart", "../../../tests/standalone/check_class_cha_test.dart", "../../../tests/standalone/check_null_cha_test.dart", "../../../tests/standalone/constant_left_shift_test.dart", @@ -6149,8 +6149,8 @@ "../../../tests/language_2/vm/await_synchronous_future_test.dart", "../../../tests/language_2/vm/bitnot_int_test.dart", "../../../tests/language_2/vm/canonicalization_preserves_deopt_test.dart", - "../../../tests/language_2/vm/causal_async_exception_stack2_test.dart", - "../../../tests/language_2/vm/causal_async_exception_stack_test.dart", + "../../../tests/language_2/vm/lazy_async_exception_stack2_test.dart", + "../../../tests/language_2/vm/lazy_async_exception_stack_test.dart", "../../../tests/language_2/vm/checked_smi_comparison_test.dart", "../../../tests/language_2/vm/checked_smi_op_test.dart", "../../../tests/language_2/vm/clamp_37868_test.dart", @@ -6559,7 +6559,7 @@ "../../../tests/standalone_2/assert_assignable_canon_test.dart", "../../../tests/standalone_2/byte_array_view_optimized_test.dart", "../../../tests/standalone_2/bytedata_test.dart", - "../../../tests/standalone_2/causal_async_stack_test.dart", + "../../../tests/standalone_2/lazy_async_stack_test.dart", "../../../tests/standalone_2/check_class_cha_test.dart", "../../../tests/standalone_2/check_null_cha_test.dart", "../../../tests/standalone_2/constant_left_shift_test.dart", diff --git a/runtime/tests/vm/dart/causal_stacks/sync_async_start_pkg_test_test.dart b/runtime/tests/vm/dart/causal_stacks/sync_async_start_pkg_test_test.dart index e2bcd2fd769..7015fe0c85b 100644 --- a/runtime/tests/vm/dart/causal_stacks/sync_async_start_pkg_test_test.dart +++ b/runtime/tests/vm/dart/causal_stacks/sync_async_start_pkg_test_test.dart @@ -3,7 +3,7 @@ // BSD-style license that can be found in the LICENSE file. // // This test ensures that "pkg:stack_trace" (used by "pkg:test") doesn't break -// when causal async stacks are enabled by dropping frames below a synchronous +// when lazy async stacks are enabled by dropping frames below a synchronous // start to an async function. import "package:test/test.dart"; diff --git a/runtime/tests/vm/dart_2/causal_stacks/sync_async_start_pkg_test_test.dart b/runtime/tests/vm/dart_2/causal_stacks/sync_async_start_pkg_test_test.dart index e2bcd2fd769..7015fe0c85b 100644 --- a/runtime/tests/vm/dart_2/causal_stacks/sync_async_start_pkg_test_test.dart +++ b/runtime/tests/vm/dart_2/causal_stacks/sync_async_start_pkg_test_test.dart @@ -3,7 +3,7 @@ // BSD-style license that can be found in the LICENSE file. // // This test ensures that "pkg:stack_trace" (used by "pkg:test") doesn't break -// when causal async stacks are enabled by dropping frames below a synchronous +// when lazy async stacks are enabled by dropping frames below a synchronous // start to an async function. import "package:test/test.dart"; diff --git a/runtime/vm/compiler/frontend/kernel_binary_flowgraph.cc b/runtime/vm/compiler/frontend/kernel_binary_flowgraph.cc index c36110e178e..7a07552660b 100644 --- a/runtime/vm/compiler/frontend/kernel_binary_flowgraph.cc +++ b/runtime/vm/compiler/frontend/kernel_binary_flowgraph.cc @@ -5320,11 +5320,9 @@ Fragment StreamingFlowGraphBuilder::BuildFunctionNode( break; case FunctionNodeHelper::kAsync: function.set_modifier(UntaggedFunction::kAsync); - function.set_is_inlinable(!FLAG_causal_async_stacks); break; case FunctionNodeHelper::kAsyncStar: function.set_modifier(UntaggedFunction::kAsyncGen); - function.set_is_inlinable(!FLAG_causal_async_stacks); break; default: // no special modifier @@ -5343,8 +5341,7 @@ Fragment StreamingFlowGraphBuilder::BuildFunctionNode( } // Note: Is..() methods use the modifiers set above, so order matters. if (function.IsAsyncClosure() || function.IsAsyncGenClosure()) { - function.set_is_inlinable(!FLAG_causal_async_stacks && - !FLAG_lazy_async_stacks); + function.set_is_inlinable(!FLAG_lazy_async_stacks); } function.set_end_token_pos(function_node_helper.end_position_); diff --git a/runtime/vm/dart.cc b/runtime/vm/dart.cc index 4a634d4e862..b2601a53bd9 100644 --- a/runtime/vm/dart.cc +++ b/runtime/vm/dart.cc @@ -221,14 +221,6 @@ char* Dart::Init(const uint8_t* vm_isolate_snapshot, return error; } } - if (FLAG_causal_async_stacks && FLAG_lazy_async_stacks) { - return Utils::StrDup( - "To use --lazy-async-stacks, please disable --causal-async-stacks!"); - } - // TODO(cskau): Remove once flag deprecation has been completed. - if (FLAG_causal_async_stacks) { - return Utils::StrDup("--causal-async-stacks is deprecated!"); - } UntaggedFrame::Init(); diff --git a/runtime/vm/debugger.cc b/runtime/vm/debugger.cc index 8f0ed32a017..71d09e7d795 100644 --- a/runtime/vm/debugger.cc +++ b/runtime/vm/debugger.cc @@ -1903,10 +1903,7 @@ DebuggerStackTrace* DebuggerStackTrace::CollectAsyncCausal() { if (FLAG_lazy_async_stacks) { return CollectAsyncLazy(); } - if (!FLAG_causal_async_stacks) { - return nullptr; - } - UNREACHABLE(); // FLAG_causal_async_stacks is deprecated. + return nullptr; } DebuggerStackTrace* DebuggerStackTrace::CollectAsyncLazy() { @@ -1979,7 +1976,7 @@ DebuggerStackTrace* DebuggerStackTrace::CollectAsyncLazy() { DebuggerStackTrace* DebuggerStackTrace::CollectAwaiterReturn() { #if defined(DART_PRECOMPILED_RUNTIME) - // Causal async stacks are not supported in the AOT runtime. + // AOT does not support debugging. ASSERT(!FLAG_async_debugger); return nullptr; #else diff --git a/runtime/vm/flag_list.h b/runtime/vm/flag_list.h index 86ede9750cb..7e7a7732ec6 100644 --- a/runtime/vm/flag_list.h +++ b/runtime/vm/flag_list.h @@ -58,12 +58,10 @@ constexpr bool FLAG_support_il_printer = false; // // The syntax used is the same as that for FLAG_LIST below, as these flags are // automatically included in FLAG_LIST. -// TODO(cskau): Remove causal_async_stacks when deprecated. #define VM_GLOBAL_FLAG_LIST(P, R, C, D) \ P(code_comments, bool, false, "Include comments into code and disassembly.") \ P(dwarf_stack_traces_mode, bool, false, \ "Use --[no-]dwarf-stack-traces instead.") \ - P(causal_async_stacks, bool, false, "DEPRECATED: Improved async stacks") \ P(lazy_async_stacks, bool, true, "Reconstruct async stacks from listeners") \ P(lazy_dispatchers, bool, true, "Generate dispatchers lazily") \ P(use_bare_instructions, bool, true, "Enable bare instructions mode.") \ diff --git a/runtime/vm/kernel_loader.cc b/runtime/vm/kernel_loader.cc index dc3596cff5d..d6cbc64a2a4 100644 --- a/runtime/vm/kernel_loader.cc +++ b/runtime/vm/kernel_loader.cc @@ -2014,22 +2014,17 @@ void KernelLoader::LoadProcedure(const Library& library, switch (function_node_helper.dart_async_marker_) { case FunctionNodeHelper::kSyncStar: function.set_modifier(UntaggedFunction::kSyncGen); - function.set_is_visible(!FLAG_causal_async_stacks && - !FLAG_lazy_async_stacks); + function.set_is_visible(!FLAG_lazy_async_stacks); break; case FunctionNodeHelper::kAsync: function.set_modifier(UntaggedFunction::kAsync); - function.set_is_inlinable(!FLAG_causal_async_stacks && - !FLAG_lazy_async_stacks); - function.set_is_visible(!FLAG_causal_async_stacks && - !FLAG_lazy_async_stacks); + function.set_is_inlinable(!FLAG_lazy_async_stacks); + function.set_is_visible(!FLAG_lazy_async_stacks); break; case FunctionNodeHelper::kAsyncStar: function.set_modifier(UntaggedFunction::kAsyncGen); - function.set_is_inlinable(!FLAG_causal_async_stacks && - !FLAG_lazy_async_stacks); - function.set_is_visible(!FLAG_causal_async_stacks && - !FLAG_lazy_async_stacks); + function.set_is_inlinable(!FLAG_lazy_async_stacks); + function.set_is_visible(!FLAG_lazy_async_stacks); break; default: // no special modifier diff --git a/tests/language/language_kernel.status b/tests/language/language_kernel.status index a0fb2d71b80..acd118f031b 100644 --- a/tests/language/language_kernel.status +++ b/tests/language/language_kernel.status @@ -228,8 +228,8 @@ enum/private_test/01: Crash # Issue 34606 unsorted/inference_enum_list_test: Skip # Issue 35885 [ $compiler == dartk && $mode == product && $runtime == vm ] -vm/causal_async_exception_stack2_test: SkipByDesign -vm/causal_async_exception_stack_test: SkipByDesign +vm/lazy_async_exception_stack2_test: SkipByDesign +vm/lazy_async_exception_stack_test: SkipByDesign # ===== dartk + vm status lines ===== [ $compiler == dartk && $runtime == vm ] @@ -277,9 +277,9 @@ null_test/none: SkipByDesign optimize/deopt_inlined_function_lazy_test: Skip # Incompatible flag: --deoptimize-alot unsorted/hello_dart_test: Skip # Incompatible flag: --compile_all unsorted/invocation_mirror2_test: SkipByDesign -vm/causal_async_exception_stack2_test: SkipByDesign -vm/causal_async_exception_stack_test: SkipByDesign vm/closure_memory_retention_test: Skip # KernelVM bug: Hits OOM +vm/lazy_async_exception_stack2_test: SkipByDesign +vm/lazy_async_exception_stack_test: SkipByDesign vm/reflect_core_vm_test: SkipByDesign vm/regress_27671_test: Skip # Unsupported vm/regress_29145_test: Skip # Issue 29145 diff --git a/tests/language/vm/causal_async_exception_stack2_test.dart b/tests/language/vm/lazy_async_exception_stack2_test.dart similarity index 95% rename from tests/language/vm/causal_async_exception_stack2_test.dart rename to tests/language/vm/lazy_async_exception_stack2_test.dart index e3ddda0f735..bd9b8d5307d 100644 --- a/tests/language/vm/causal_async_exception_stack2_test.dart +++ b/tests/language/vm/lazy_async_exception_stack2_test.dart @@ -6,7 +6,7 @@ import 'package:async_helper/async_minitest.dart'; -import 'causal_async_exception_stack_helper.dart' as h; +import 'lazy_async_exception_stack_helper.dart' as h; foo3() async => throw "foo"; bar3() async => throw "bar"; @@ -93,7 +93,7 @@ test2() async { } main() async { - test('causal async exception stack', () async { + test('lazy async exception stack', () async { await test1(); await test2(); }); diff --git a/tests/language/vm/causal_async_exception_stack_helper.dart b/tests/language/vm/lazy_async_exception_stack_helper.dart similarity index 100% rename from tests/language/vm/causal_async_exception_stack_helper.dart rename to tests/language/vm/lazy_async_exception_stack_helper.dart diff --git a/tests/language/vm/causal_async_exception_stack_test.dart b/tests/language/vm/lazy_async_exception_stack_test.dart similarity index 94% rename from tests/language/vm/causal_async_exception_stack_test.dart rename to tests/language/vm/lazy_async_exception_stack_test.dart index e9df0a7aad1..9b9705ee190 100644 --- a/tests/language/vm/causal_async_exception_stack_test.dart +++ b/tests/language/vm/lazy_async_exception_stack_test.dart @@ -6,7 +6,7 @@ import 'package:async_helper/async_minitest.dart'; -import 'causal_async_exception_stack_helper.dart' as h; +import 'lazy_async_exception_stack_helper.dart' as h; thrower() async { throw 'oops'; @@ -29,7 +29,7 @@ foo() async { main() async { // Test async and async*. - test('causal async exception stack', () async { + test('lazy async exception stack', () async { try { await foo(); fail("Did not throw"); diff --git a/tests/language_2/language_2_kernel.status b/tests/language_2/language_2_kernel.status index 9b5f4030ce2..1db04b4e219 100644 --- a/tests/language_2/language_2_kernel.status +++ b/tests/language_2/language_2_kernel.status @@ -48,8 +48,8 @@ enum/private_test/01: Crash # Issue 34606 unsorted/inference_enum_list_test: Skip # Issue 35885 [ $compiler == dartk && $mode == product && $runtime == vm ] -vm/causal_async_exception_stack2_test: SkipByDesign -vm/causal_async_exception_stack_test: SkipByDesign +vm/lazy_async_exception_stack2_test: SkipByDesign +vm/lazy_async_exception_stack_test: SkipByDesign # ===== dartk + vm status lines ===== [ $compiler == dartk && $runtime == vm ] @@ -91,9 +91,9 @@ null_test/none: SkipByDesign optimize/deopt_inlined_function_lazy_test: Skip # Incompatible flag: --deoptimize-alot unsorted/hello_dart_test: Skip # Incompatible flag: --compile_all unsorted/invocation_mirror2_test: SkipByDesign -vm/causal_async_exception_stack2_test: SkipByDesign -vm/causal_async_exception_stack_test: SkipByDesign vm/closure_memory_retention_test: Skip # KernelVM bug: Hits OOM +vm/lazy_async_exception_stack2_test: SkipByDesign +vm/lazy_async_exception_stack_test: SkipByDesign vm/reflect_core_vm_test: SkipByDesign vm/regress_27671_test: Skip # Unsupported vm/regress_29145_test: Skip # Issue 29145 @@ -118,4 +118,4 @@ unsorted/disassemble_test: Slow, Pass optimize/deopt_inlined_function_lazy_test: Skip [ $mode == debug && ($hot_reload || $hot_reload_rollback) ] -regress/regress41983_test: Pass, Slow \ No newline at end of file +regress/regress41983_test: Pass, Slow diff --git a/tests/language_2/vm/causal_async_exception_stack2_test.dart b/tests/language_2/vm/lazy_async_exception_stack2_test.dart similarity index 95% rename from tests/language_2/vm/causal_async_exception_stack2_test.dart rename to tests/language_2/vm/lazy_async_exception_stack2_test.dart index 6e21580c12b..81df6ce02b8 100644 --- a/tests/language_2/vm/causal_async_exception_stack2_test.dart +++ b/tests/language_2/vm/lazy_async_exception_stack2_test.dart @@ -8,7 +8,7 @@ import 'package:async_helper/async_minitest.dart'; -import 'causal_async_exception_stack_helper.dart' as h; +import 'lazy_async_exception_stack_helper.dart' as h; foo3() async => throw "foo"; bar3() async => throw "bar"; @@ -95,7 +95,7 @@ test2() async { } main() async { - test('causal async exception stack', () async { + test('lazy async exception stack', () async { await test1(); await test2(); }); diff --git a/tests/language_2/vm/causal_async_exception_stack_helper.dart b/tests/language_2/vm/lazy_async_exception_stack_helper.dart similarity index 100% rename from tests/language_2/vm/causal_async_exception_stack_helper.dart rename to tests/language_2/vm/lazy_async_exception_stack_helper.dart diff --git a/tests/language_2/vm/causal_async_exception_stack_test.dart b/tests/language_2/vm/lazy_async_exception_stack_test.dart similarity index 94% rename from tests/language_2/vm/causal_async_exception_stack_test.dart rename to tests/language_2/vm/lazy_async_exception_stack_test.dart index 8afe38f8228..46ee9ff010a 100644 --- a/tests/language_2/vm/causal_async_exception_stack_test.dart +++ b/tests/language_2/vm/lazy_async_exception_stack_test.dart @@ -8,7 +8,7 @@ import 'package:async_helper/async_minitest.dart'; -import 'causal_async_exception_stack_helper.dart' as h; +import 'lazy_async_exception_stack_helper.dart' as h; thrower() async { throw 'oops'; @@ -31,7 +31,7 @@ foo() async { main() async { // Test async and async*. - test('causal async exception stack', () async { + test('lazy async exception stack', () async { try { await foo(); fail("Did not throw"); diff --git a/tests/standalone/causal_async_stack_test.dart b/tests/standalone/lazy_async_stack_test.dart similarity index 100% rename from tests/standalone/causal_async_stack_test.dart rename to tests/standalone/lazy_async_stack_test.dart diff --git a/tests/standalone/standalone.status b/tests/standalone/standalone.status index f2d93f5f3c8..9f629991fec 100644 --- a/tests/standalone/standalone.status +++ b/tests/standalone/standalone.status @@ -41,7 +41,7 @@ io/socket_sigpipe_test: SkipByDesign # Spawns server process using Platform.exec deferred_transitive_import_error_test: Skip [ $compiler == dartkp ] -causal_async_stack_test: Skip # Flaky. +lazy_async_stack_test: Skip # Flaky. [ $mode == product ] io/stdio_implicit_close_test: Skip # SkipByDesign diff --git a/tests/standalone_2/causal_async_stack_test.dart b/tests/standalone_2/lazy_async_stack_test.dart similarity index 100% rename from tests/standalone_2/causal_async_stack_test.dart rename to tests/standalone_2/lazy_async_stack_test.dart diff --git a/tests/standalone_2/standalone_2.status b/tests/standalone_2/standalone_2.status index becc44891ff..6a27a9c9116 100644 --- a/tests/standalone_2/standalone_2.status +++ b/tests/standalone_2/standalone_2.status @@ -41,7 +41,7 @@ io/socket_sigpipe_test: SkipByDesign # Spawns server process using Platform.exec deferred_transitive_import_error_test: Skip [ $compiler == dartkp ] -causal_async_stack_test: Skip # Flaky. +lazy_async_stack_test: Skip # Flaky. [ $mode == product ] io/stdio_implicit_close_test: Skip # SkipByDesign