[vm] Cleanup --lazy-async-stacks VM option

This option was enabled by default in https://dart-review.googlesource.com/c/sdk/+/149288
This change removes old logic behind --no-lazy-async-stacks
and makes --lazy-async-stacks/--no-lazy-async-stacks options no-op.

TEST=ci

Change-Id: I5726690e90e78dd2ac37d8c5944e388042fc3acf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247780
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
This commit is contained in:
Alexander Markov 2022-06-10 13:41:24 +00:00 committed by Commit Bot
parent 90a45668d5
commit de43a7c16a
81 changed files with 133 additions and 805 deletions

View file

@ -1,20 +1,18 @@
// Copyright (c) 2019, 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=--lazy-async-stacks
import 'dart:developer';
import 'common/service_test_common.dart';
import 'common/test_helper.dart';
const LINE_A = 20;
const LINE_B = 21;
const LINE_C = 26;
const LINE_D = 28;
const LINE_E = 31;
const LINE_F = 34;
const LINE_G = 36;
const LINE_A = 18;
const LINE_B = 19;
const LINE_C = 24;
const LINE_D = 26;
const LINE_E = 29;
const LINE_F = 32;
const LINE_G = 34;
helper() async {
print('helper'); // LINE_A.

View file

@ -1,17 +1,15 @@
// Copyright (c) 2019, 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=--lazy-async-stacks
import 'dart:developer';
import 'common/service_test_common.dart';
import 'common/test_helper.dart';
const LINE_A = 17;
const LINE_B = 18;
const LINE_C = 23;
const LINE_D = 24;
const LINE_A = 15;
const LINE_B = 16;
const LINE_C = 21;
const LINE_D = 22;
helper() async {
print('helper'); // LINE_A.

View file

@ -1,18 +1,16 @@
// Copyright (c) 2019, 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=--lazy-async-stacks
import 'dart:developer';
import 'common/service_test_common.dart';
import 'common/test_helper.dart';
const LINE_A = 18;
const LINE_B = 19;
const LINE_C = 24;
const LINE_D = 25;
const LINE_E = 26;
const LINE_A = 16;
const LINE_B = 17;
const LINE_C = 22;
const LINE_D = 23;
const LINE_E = 24;
helper() async {
print('helper'); // LINE_A.

View file

@ -1,20 +1,18 @@
// Copyright (c) 2019, 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=--lazy-async-stacks
import 'dart:developer';
import 'common/service_test_common.dart';
import 'common/test_helper.dart';
const LINE_A = 20;
const LINE_B = 21;
const LINE_C = 25;
const LINE_D = 29;
const LINE_E = 35;
const LINE_F = 36;
const LINE_G = 27;
const LINE_A = 18;
const LINE_B = 19;
const LINE_C = 23;
const LINE_D = 27;
const LINE_E = 33;
const LINE_F = 34;
const LINE_G = 25;
foobar() async* {
yield 1; // LINE_A.

View file

@ -1,22 +1,20 @@
// Copyright (c) 2019, 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=--lazy-async-stacks
import 'dart:developer';
import 'common/service_test_common.dart';
import 'common/test_helper.dart';
const LINE_A = 22;
const LINE_B = 23;
const LINE_C = 27;
const LINE_D = 31;
const LINE_E = 38;
const LINE_F = 39;
const LINE_G = 40;
const LINE_H = 29;
const LINE_I = 33;
const LINE_A = 20;
const LINE_B = 21;
const LINE_C = 25;
const LINE_D = 29;
const LINE_E = 36;
const LINE_F = 37;
const LINE_G = 38;
const LINE_H = 27;
const LINE_I = 31;
foobar() async* {
yield 1; // LINE_A.

View file

@ -1,19 +1,17 @@
// Copyright (c) 2019, 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=--lazy-async-stacks
import 'dart:developer';
import 'common/service_test_common.dart';
import 'common/test_helper.dart';
const LINE_A = 19;
const LINE_B = 20;
const LINE_C = 21;
const LINE_D = 26;
const LINE_E = 27;
const LINE_F = 28;
const LINE_A = 17;
const LINE_B = 18;
const LINE_C = 19;
const LINE_D = 24;
const LINE_E = 25;
const LINE_F = 26;
helper() async {
await null; // LINE_A.

View file

@ -2,7 +2,7 @@
// 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=--async-debugger --verbose-debug --lazy-async-stacks
// VMOptions=--async-debugger --verbose-debug
import 'dart:developer';
import 'package:test/test.dart';

View file

@ -2,7 +2,7 @@
// 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=--async-debugger --verbose-debug --lazy-async-stacks
// VMOptions=--async-debugger --verbose-debug
import 'dart:developer';
import 'package:test/test.dart';

View file

@ -2,7 +2,7 @@
// 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=--lazy-async-stacks --verbose_debug
// VMOptions=--verbose_debug
import 'dart:developer';
import 'package:test/test.dart';

View file

@ -2,7 +2,7 @@
// 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=--lazy-async-stacks --verbose_debug
// VMOptions=--verbose_debug
import 'dart:developer';
import 'package:test/test.dart';

View file

@ -2,7 +2,7 @@
// 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=--lazy-async-stacks --verbose_debug
// VMOptions=--verbose_debug
import 'dart:developer';
import 'package:test/test.dart';

View file

@ -2,7 +2,7 @@
// 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=--lazy-async-stacks --verbose_debug
// VMOptions=--verbose_debug
import 'dart:developer';
import 'package:test/test.dart';

View file

@ -17,7 +17,7 @@ import 'service_test_common.dart';
export 'service_test_common.dart' show IsolateTest, VMTest;
/// The extra arguments to use
const List<String> extraDebuggingArgs = ['--lazy-async-stacks'];
const List<String> extraDebuggingArgs = [];
/// Will be set to the http address of the VM's service protocol before
/// any tests are invoked.

View file

@ -2,7 +2,7 @@
// 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=--lazy-async-stacks --verbose_debug
// VMOptions=--verbose_debug
import 'dart:developer';

View file

@ -52,7 +52,6 @@ static void PrintUsage() {
"following default flags: \n"
"--enable_mirrors=false \n"
"--background_compilation \n"
"--lazy_async_stacks \n"
"--precompilation \n"
" \n"
"\n");
@ -157,7 +156,6 @@ int RunAnalyzer(int argc, char** argv) {
if (vm_options.count() == 0) {
vm_options.AddArgument("--enable_mirrors=false");
vm_options.AddArgument("--background_compilation");
vm_options.AddArgument("--lazy_async_stacks");
vm_options.AddArgument("--precompilation");
}

View file

@ -34,8 +34,9 @@ static StackTracePtr CreateStackTraceObject(
return StackTrace::New(code_array, pc_offset_array);
}
static StackTracePtr CurrentSyncStackTraceLazy(Thread* thread,
intptr_t skip_frames = 1) {
// Gets current stack trace for `thread`.
static StackTracePtr CurrentStackTrace(Thread* thread,
intptr_t skip_frames = 1) {
Zone* zone = thread->zone();
const auto& code_array = GrowableObjectArray::ZoneHandle(
@ -43,54 +44,19 @@ static StackTracePtr CurrentSyncStackTraceLazy(Thread* thread,
GrowableArray<uword> pc_offset_array;
// Collect the frames.
StackTraceUtils::CollectFramesLazy(thread, code_array, &pc_offset_array,
skip_frames);
StackTraceUtils::CollectFrames(thread, code_array, &pc_offset_array,
skip_frames);
return CreateStackTraceObject(zone, code_array, pc_offset_array);
}
static StackTracePtr CurrentSyncStackTrace(Thread* thread,
intptr_t skip_frames = 1) {
Zone* zone = thread->zone();
const Function& null_function = Function::ZoneHandle(zone);
// Determine how big the stack trace is.
const intptr_t stack_trace_length =
StackTraceUtils::CountFrames(thread, skip_frames, null_function, nullptr);
// Allocate once.
const Array& code_array =
Array::ZoneHandle(zone, Array::New(stack_trace_length));
const TypedData& pc_offset_array = TypedData::ZoneHandle(
zone, TypedData::New(kUintPtrCid, stack_trace_length));
// Collect the frames.
const intptr_t collected_frames_count = StackTraceUtils::CollectFrames(
thread, code_array, pc_offset_array, 0, stack_trace_length, skip_frames);
ASSERT(collected_frames_count == stack_trace_length);
return StackTrace::New(code_array, pc_offset_array);
}
// Gets current stack trace for `thread`.
static StackTracePtr CurrentStackTrace(Thread* thread,
bool for_async_function,
intptr_t skip_frames = 1) {
if (FLAG_lazy_async_stacks) {
return CurrentSyncStackTraceLazy(thread, skip_frames);
}
// Return the synchronous stack trace.
return CurrentSyncStackTrace(thread, skip_frames);
}
StackTracePtr GetStackTraceForException() {
Thread* thread = Thread::Current();
return CurrentStackTrace(thread, false, 0);
return CurrentStackTrace(thread, 0);
}
DEFINE_NATIVE_ENTRY(StackTrace_current, 0, 0) {
return CurrentStackTrace(thread, false);
return CurrentStackTrace(thread);
}
static void AppendFrames(const GrowableObjectArray& code_list,

View file

@ -2,7 +2,7 @@
// 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=--async-debugger --verbose-debug --lazy-async-stacks
// VMOptions=--async-debugger --verbose-debug
import 'dart:developer';
import 'service_test_common.dart';

View file

@ -2,7 +2,7 @@
// 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=--async-debugger --verbose-debug --lazy-async-stacks
// VMOptions=--async-debugger --verbose-debug
import 'dart:developer';
import 'service_test_common.dart';

View file

@ -2,7 +2,7 @@
// 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=--async-debugger --verbose-debug --lazy-async-stacks
// VMOptions=--async-debugger --verbose-debug
import 'dart:developer';
import 'service_test_common.dart';

View file

@ -2,7 +2,7 @@
// 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=--async-debugger --verbose-debug --lazy-async-stacks
// VMOptions=--async-debugger --verbose-debug
import 'dart:developer';
import 'service_test_common.dart';

View file

@ -2,7 +2,7 @@
// 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=--async-debugger --verbose-debug --lazy-async-stacks
// VMOptions=--async-debugger --verbose-debug
import 'dart:developer';
import 'service_test_common.dart';

View file

@ -2,7 +2,7 @@
// 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=--async-debugger --verbose-debug --lazy-async-stacks
// VMOptions=--async-debugger --verbose-debug
import 'dart:developer';
import 'service_test_common.dart';

View file

@ -2,7 +2,7 @@
// 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=--async-debugger --verbose-debug --lazy-async-stacks
// VMOptions=--async-debugger --verbose-debug
import 'dart:developer';
import 'package:observatory/models.dart' as M;

View file

@ -2,7 +2,7 @@
// 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=--async-debugger --verbose-debug --lazy-async-stacks
// VMOptions=--async-debugger --verbose-debug
import 'dart:developer';
import 'package:observatory/models.dart' as M;

View file

@ -2,7 +2,7 @@
// 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=--lazy-async-stacks --verbose_debug
// VMOptions=--verbose_debug
import 'dart:developer';
import 'package:observatory/models.dart' as M;

View file

@ -2,7 +2,7 @@
// 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=--lazy-async-stacks --verbose_debug
// VMOptions=--verbose_debug
import 'dart:developer';
import 'package:observatory/service_io.dart';

View file

@ -2,7 +2,7 @@
// 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=--lazy-async-stacks --verbose_debug
// VMOptions=--verbose_debug
import 'dart:developer';
import 'package:observatory/models.dart' as M;

View file

@ -2,7 +2,7 @@
// 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=--lazy-async-stacks --verbose_debug
// VMOptions=--verbose_debug
import 'dart:developer';
import 'package:observatory/service_io.dart';

View file

@ -2,8 +2,6 @@
// 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=--lazy-async-stacks
import 'dart:async';
import 'dart:developer';

View file

@ -1,14 +1,12 @@
// 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=--lazy-async-stacks
import 'test_helper.dart';
import 'service_test_common.dart';
import 'dart:io';
const int LINE_A = 14;
const int LINE_A = 12;
const String file = "next_through_simple_async_test.dart";
code() async { // LINE_A

View file

@ -1,14 +1,12 @@
// 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=--lazy-async-stacks
import 'test_helper.dart';
import 'service_test_common.dart';
import 'dart:io';
const int LINE_A = 14;
const int LINE_A = 12;
const String file = "next_through_simple_async_with_returns_test.dart";
code() async { // LINE_A

View file

@ -2,8 +2,8 @@
// 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=--async_debugger --lazy-async-stacks
// VMOptions=--async_debugger --lazy-async-stacks --optimization-counter-threshold=5
// VMOptions=--async_debugger
// VMOptions=--async_debugger --optimization-counter-threshold=5
import 'package:observatory/service_io.dart';
import 'package:observatory/models.dart' as M;

View file

@ -2,7 +2,7 @@
// 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=--async_debugger --lazy-async-stacks
// VMOptions=--async_debugger
import 'package:observatory/service_io.dart';
import 'package:observatory/models.dart' as M;

View file

@ -23,7 +23,7 @@ const String serviceResponseSizesDir =
const String.fromEnvironment('SERVICE_RESPONSE_SIZES_DIR');
/// The extra arguments to use
const List<String> extraDebuggingArgs = ['--lazy-async-stacks'];
const List<String> extraDebuggingArgs = [];
/// Will be set to the http address of the VM's service protocol before
/// any tests are invoked.

View file

@ -2,7 +2,7 @@
// 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=--async-debugger --verbose-debug --lazy-async-stacks
// VMOptions=--async-debugger --verbose-debug
import 'dart:developer';
import 'service_test_common.dart';

View file

@ -2,7 +2,7 @@
// 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=--async-debugger --verbose-debug --lazy-async-stacks
// VMOptions=--async-debugger --verbose-debug
import 'dart:developer';
import 'service_test_common.dart';

View file

@ -2,7 +2,7 @@
// 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=--async-debugger --verbose-debug --lazy-async-stacks
// VMOptions=--async-debugger --verbose-debug
import 'dart:developer';
import 'service_test_common.dart';

View file

@ -2,7 +2,7 @@
// 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=--async-debugger --verbose-debug --lazy-async-stacks
// VMOptions=--async-debugger --verbose-debug
import 'dart:developer';
import 'service_test_common.dart';

View file

@ -2,7 +2,7 @@
// 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=--async-debugger --verbose-debug --lazy-async-stacks
// VMOptions=--async-debugger --verbose-debug
import 'dart:developer';
import 'service_test_common.dart';

View file

@ -2,7 +2,7 @@
// 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=--async-debugger --verbose-debug --lazy-async-stacks
// VMOptions=--async-debugger --verbose-debug
import 'dart:developer';
import 'service_test_common.dart';

View file

@ -2,7 +2,7 @@
// 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=--async-debugger --verbose-debug --lazy-async-stacks
// VMOptions=--async-debugger --verbose-debug
import 'dart:developer';
import 'package:observatory_2/models.dart' as M;

View file

@ -2,7 +2,7 @@
// 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=--async-debugger --verbose-debug --lazy-async-stacks
// VMOptions=--async-debugger --verbose-debug
import 'dart:developer';
import 'package:observatory_2/models.dart' as M;

View file

@ -2,7 +2,7 @@
// 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=--lazy-async-stacks --verbose_debug
// VMOptions=--verbose_debug
import 'dart:developer';
import 'package:observatory_2/models.dart' as M;

View file

@ -2,7 +2,7 @@
// 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=--lazy-async-stacks --verbose_debug
// VMOptions=--verbose_debug
import 'dart:developer';
import 'package:observatory_2/service_io.dart';

View file

@ -2,7 +2,7 @@
// 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=--lazy-async-stacks --verbose_debug
// VMOptions=--verbose_debug
import 'dart:developer';
import 'package:observatory_2/models.dart' as M;

View file

@ -2,7 +2,7 @@
// 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=--lazy-async-stacks --verbose_debug
// VMOptions=--verbose_debug
import 'dart:developer';
import 'package:observatory_2/service_io.dart';

View file

@ -2,8 +2,6 @@
// 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=--lazy-async-stacks
import 'dart:async';
import 'dart:developer';

View file

@ -1,14 +1,12 @@
// 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=--lazy-async-stacks
import 'test_helper.dart';
import 'service_test_common.dart';
import 'dart:io';
const int LINE_A = 14;
const int LINE_A = 12;
const String file = "next_through_simple_async_test.dart";
code() async { // LINE_A

View file

@ -1,14 +1,12 @@
// 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=--lazy-async-stacks
import 'test_helper.dart';
import 'service_test_common.dart';
import 'dart:io';
const int LINE_A = 14;
const int LINE_A = 12;
const String file = "next_through_simple_async_with_returns_test.dart";
code() async { // LINE_A

View file

@ -2,8 +2,8 @@
// 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=--async_debugger --lazy-async-stacks
// VMOptions=--async_debugger --lazy-async-stacks --optimization-counter-threshold=5
// VMOptions=--async_debugger
// VMOptions=--async_debugger --optimization-counter-threshold=5
import 'package:observatory_2/service_io.dart';
import 'package:observatory_2/models.dart' as M;

View file

@ -2,7 +2,7 @@
// 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=--async_debugger --lazy-async-stacks
// VMOptions=--async_debugger
import 'package:observatory_2/service_io.dart';
import 'package:observatory_2/models.dart' as M;

View file

@ -25,7 +25,7 @@ const String serviceResponseSizesDir =
const String.fromEnvironment('SERVICE_RESPONSE_SIZES_DIR');
/// The extra arguments to use
const List<String> extraDebuggingArgs = ['--lazy-async-stacks'];
const List<String> extraDebuggingArgs = [];
/// Will be set to the http address of the VM's service protocol before
/// any tests are invoked.

View file

@ -2,7 +2,7 @@
// 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=--dwarf-stack-traces --save-debugging-info=async_lazy_debug.so --lazy-async-stacks
// VMOptions=--dwarf-stack-traces --save-debugging-info=async_lazy_debug.so
import 'dart:async';
import 'dart:io';

View file

@ -1,8 +1,6 @@
// Copyright (c) 2019, 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=--lazy-async-stacks
import 'dart:async';

View file

@ -1,17 +0,0 @@
// Copyright (c) 2020, 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=--dwarf-stack-traces --save-debugging-info=async_no_causal_debug.so --no-lazy-async-stacks
import 'dart:async';
import 'dart:io';
import 'utils.dart';
Future<void> main(List<String> args) async {
// We won't have access to the debugging info file on Android.
if (Platform.isAndroid) return;
await doTestsNoCausalNoLazy('async_no_causal_debug.so');
}

View file

@ -1,11 +0,0 @@
// Copyright (c) 2019, 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=--no-lazy-async-stacks
import 'dart:async';
import 'utils.dart';
Future<void> main(List<String> args) async => await doTestsNoCausalNoLazy();

View file

@ -1,8 +1,6 @@
// Copyright (c) 2022, 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=--lazy-async-stacks
import 'dart:async';

View file

@ -302,209 +302,6 @@ Future<void> doTestAwaitCatchError(Future f(), List<String> expectedStack,
// Test "Suites":
// ----
// For: --no-lazy-async-stacks
Future<void> doTestsNoCausalNoLazy([String? debugInfoFilename]) async {
{
final expected = const <String>[
r'^#0 throwSync \(.*/utils.dart:16(:3)?\)$',
r'^#1 allYield3 \(.*/utils.dart:39(:3)?\)$',
r'^#2 _RootZone.runUnary \(.+\)$',
// The rest are internal frames which we don't really care about.
IGNORE_REMAINING_STACK,
];
await doTestAwait(allYield, expected, debugInfoFilename);
await doTestAwaitThen(allYield, expected, debugInfoFilename);
await doTestAwaitCatchError(allYield, expected, debugInfoFilename);
}
{
final expected = const <String>[
r'^#0 throwSync \(.*/utils.dart:16(:3)?\)$',
r'^#1 noYields3 \(.*/utils.dart:54(:3)?\)$',
r'^#2 noYields2 \(.*/utils.dart:50(:9)?\)$',
r'^#3 noYields \(.*/utils.dart:46(:9)?\)$',
];
final postfix = const <String>[
r'^#5 doTestsNoCausalNoLazy ',
r'^#6 _RootZone.runUnary \(.+\)$',
// The rest are internal frames which we don't really care about.
IGNORE_REMAINING_STACK,
];
await 0; // Don't let the `await do..`s chain together.
await doTestAwait(
noYields,
expected +
const <String>[
r'^#4 doTestAwait ',
] +
postfix,
debugInfoFilename);
await 0; // Don't let the `await do..`s chain together.
await doTestAwaitThen(
noYields,
expected +
const <String>[
r'^#4 doTestAwaitThen ',
] +
postfix,
debugInfoFilename);
await 0; // Don't let the `await do..`s chain together.
await doTestAwaitCatchError(
noYields,
expected +
const <String>[
r'^#4 doTestAwaitCatchError ',
] +
postfix,
debugInfoFilename);
}
{
final expected = const <String>[
r'^#0 throwAsync \(.*/utils.dart:21(:3)?\)$',
r'^#1 _RootZone.runUnary \(.+\)$',
// The rest are internal frames which we don't really care about.
IGNORE_REMAINING_STACK,
];
await doTestAwait(mixedYields, expected, debugInfoFilename);
await doTestAwaitThen(mixedYields, expected, debugInfoFilename);
await doTestAwaitCatchError(mixedYields, expected, debugInfoFilename);
}
{
final expected = const <String>[
r'^#0 throwAsync \(.*/utils.dart:21(:3)?\)$',
r'^#1 _RootZone.runUnary \(.+\)$',
// The rest are internal frames which we don't really care about.
IGNORE_REMAINING_STACK,
];
await doTestAwait(syncSuffix, expected, debugInfoFilename);
await doTestAwaitThen(syncSuffix, expected, debugInfoFilename);
await doTestAwaitCatchError(syncSuffix, expected, debugInfoFilename);
}
{
final expected = const <String>[
r'^#0 throwAsync \(.*/utils.dart:21(:3)?\)$',
r'^#1 _RootZone.runUnary \(.+\)$',
// The rest are internal frames which we don't really care about.
IGNORE_REMAINING_STACK,
];
await doTestAwait(nonAsyncNoStack, expected, debugInfoFilename);
await doTestAwaitThen(nonAsyncNoStack, expected, debugInfoFilename);
await doTestAwaitCatchError(nonAsyncNoStack, expected, debugInfoFilename);
}
{
final expected = const <String>[
r'^#0 throwSync \(.+/utils.dart:16(:3)?\)$',
r'^#1 asyncStarThrowSync \(.+/utils.dart:112(:11)?\)$',
r'^#2 _RootZone.runUnary \(.+\)$',
// The rest are internal frames which we don't really care about.
IGNORE_REMAINING_STACK,
];
await doTestAwait(
awaitEveryAsyncStarThrowSync, expected, debugInfoFilename);
await doTestAwaitThen(
awaitEveryAsyncStarThrowSync, expected, debugInfoFilename);
await doTestAwaitCatchError(
awaitEveryAsyncStarThrowSync, expected, debugInfoFilename);
}
{
final expected = const <String>[
r'^#0 throwAsync \(.*/utils.dart:21(:3)?\)$',
r'^#1 _RootZone.runUnary \(.+\)$',
// The rest are internal frames which we don't really care about.
IGNORE_REMAINING_STACK,
];
await doTestAwait(
awaitEveryAsyncStarThrowAsync, expected, debugInfoFilename);
await doTestAwaitThen(
awaitEveryAsyncStarThrowAsync, expected, debugInfoFilename);
await doTestAwaitCatchError(
awaitEveryAsyncStarThrowAsync, expected, debugInfoFilename);
}
{
final expected = const <String>[
r'^#0 throwAsync \(.*/utils.dart:21(:3)?\)$',
r'^#1 _RootZone.runUnary \(.+\)$',
// The rest are internal frames which we don't really care about.
IGNORE_REMAINING_STACK,
];
await doTestAwait(listenAsyncStarThrowAsync, expected, debugInfoFilename);
await doTestAwaitThen(
listenAsyncStarThrowAsync, expected, debugInfoFilename);
await doTestAwaitCatchError(
listenAsyncStarThrowAsync, expected, debugInfoFilename);
}
{
final expected = const <String>[
r'#0 throwSync \(.*/utils.dart:16(:3)?\)$',
r'#1 allYield3 \(.*/utils.dart:39(:3)?\)$',
r'#2 _rootRunUnary \(.+\)$',
// The rest are internal frames which we don't really care about.
IGNORE_REMAINING_STACK,
];
await doTestAwait(customErrorZone, expected, debugInfoFilename);
await doTestAwaitThen(customErrorZone, expected, debugInfoFilename);
await doTestAwaitCatchError(customErrorZone, expected, debugInfoFilename);
}
{
final expected = const <String>[
r'#0 throwAsync \(.*/utils.dart:21(:3)?\)$',
r'^#1 _RootZone.runUnary \(.+\)$',
// The rest are internal frames which we don't really care about.
IGNORE_REMAINING_STACK,
];
await doTestAwait(awaitTimeout, expected, debugInfoFilename);
await doTestAwaitThen(awaitTimeout, expected, debugInfoFilename);
await doTestAwaitCatchError(awaitTimeout, expected, debugInfoFilename);
}
{
final expected = const <String>[
r'#0 throwAsync \(.*/utils.dart:21(:3)?\)$',
r'^#1 _RootZone.runUnary \(.+\)$',
// The rest are internal frames which we don't really care about.
IGNORE_REMAINING_STACK,
];
await doTestAwait(awaitWait, expected, debugInfoFilename);
await doTestAwaitThen(awaitWait, expected, debugInfoFilename);
await doTestAwaitCatchError(awaitWait, expected, debugInfoFilename);
}
{
final expected = const <String>[
r'^#0 throwAsync \(.*/utils.dart:21(:3)?\)$',
r'^#1 _RootZone.runUnary \(.+\)$',
// The rest are internal frames which we don't really care about.
IGNORE_REMAINING_STACK,
];
await doTestAwait(futureSyncWhenComplete, expected, debugInfoFilename);
await doTestAwaitThen(futureSyncWhenComplete, expected, debugInfoFilename);
await doTestAwaitCatchError(
futureSyncWhenComplete, expected, debugInfoFilename);
}
{
final expected = const <String>[
r'^#0 throwSync \(.*/utils.dart:16(:3)?\)$',
r'^#1 futureThen.<anonymous closure> \(.*/utils.dart:187(:5)?\)$',
r'^#2 _RootZone.runUnary \(.+\)$',
// The rest are internal frames which we don't really care about.
IGNORE_REMAINING_STACK,
];
await doTestAwait(futureThen, expected, debugInfoFilename);
await doTestAwaitThen(futureThen, expected, debugInfoFilename);
await doTestAwaitCatchError(futureThen, expected, debugInfoFilename);
}
}
// For: --lazy-async-stacks
Future<void> doTestsLazy([String? debugInfoFilename]) async {
// allYield
{

View file

@ -1,8 +1,6 @@
// Copyright (c) 2020, 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=--lazy-async-stacks
import "package:expect/expect.dart";

View file

@ -2,7 +2,7 @@
// 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=--dwarf-stack-traces --save-debugging-info=async_lazy_debug.so --lazy-async-stacks
// VMOptions=--dwarf-stack-traces --save-debugging-info=async_lazy_debug.so
// @dart = 2.9

View file

@ -1,8 +1,6 @@
// Copyright (c) 2019, 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=--lazy-async-stacks
// @dart = 2.9

View file

@ -1,19 +0,0 @@
// Copyright (c) 2020, 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=--dwarf-stack-traces --save-debugging-info=async_no_causal_debug.so --no-lazy-async-stacks
// @dart = 2.9
import 'dart:async';
import 'dart:io';
import 'utils.dart';
Future<void> main(List<String> args) async {
// We won't have access to the debugging info file on Android.
if (Platform.isAndroid) return;
await doTestsNoCausalNoLazy('async_no_causal_debug.so');
}

View file

@ -1,13 +0,0 @@
// Copyright (c) 2019, 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=--no-lazy-async-stacks
// @dart = 2.9
import 'dart:async';
import 'utils.dart';
Future<void> main(List<String> args) async => await doTestsNoCausalNoLazy();

View file

@ -1,8 +1,6 @@
// Copyright (c) 2022, 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=--lazy-async-stacks
// @dart = 2.9
import 'dart:async';

View file

@ -304,209 +304,6 @@ Future<void> doTestAwaitCatchError(Future f(), List<String> expectedStack,
// Test "Suites":
// ----
// For: --no-lazy-async-stacks
Future<void> doTestsNoCausalNoLazy([String debugInfoFilename]) async {
{
final expected = const <String>[
r'^#0 throwSync \(.*/utils.dart:18(:3)?\)$',
r'^#1 allYield3 \(.*/utils.dart:41(:3)?\)$',
r'^#2 _RootZone.runUnary \(.+\)$',
// The rest are internal frames which we don't really care about.
IGNORE_REMAINING_STACK,
];
await doTestAwait(allYield, expected, debugInfoFilename);
await doTestAwaitThen(allYield, expected, debugInfoFilename);
await doTestAwaitCatchError(allYield, expected, debugInfoFilename);
}
{
final expected = const <String>[
r'^#0 throwSync \(.*/utils.dart:18(:3)?\)$',
r'^#1 noYields3 \(.*/utils.dart:56(:3)?\)$',
r'^#2 noYields2 \(.*/utils.dart:52(:9)?\)$',
r'^#3 noYields \(.*/utils.dart:48(:9)?\)$',
];
final postfix = const <String>[
r'^#5 doTestsNoCausalNoLazy ',
r'^#6 _RootZone.runUnary ',
// The rest are internal frames which we don't really care about.
IGNORE_REMAINING_STACK,
];
await 0; // Don't let the `await do..`s chain together.
await doTestAwait(
noYields,
expected +
const <String>[
r'^#4 doTestAwait ',
] +
postfix,
debugInfoFilename);
await 0; // Don't let the `await do..`s chain together.
await doTestAwaitThen(
noYields,
expected +
const <String>[
r'^#4 doTestAwaitThen ',
] +
postfix,
debugInfoFilename);
await 0; // Don't let the `await do..`s chain together.
await doTestAwaitCatchError(
noYields,
expected +
const <String>[
r'^#4 doTestAwaitCatchError ',
] +
postfix,
debugInfoFilename);
}
{
final expected = const <String>[
r'^#0 throwAsync \(.*/utils.dart:23(:3)?\)$',
r'^#1 _RootZone.runUnary \(.+\)$',
// The rest are internal frames which we don't really care about.
IGNORE_REMAINING_STACK,
];
await doTestAwait(mixedYields, expected, debugInfoFilename);
await doTestAwaitThen(mixedYields, expected, debugInfoFilename);
await doTestAwaitCatchError(mixedYields, expected, debugInfoFilename);
}
{
final expected = const <String>[
r'^#0 throwAsync \(.*/utils.dart:23(:3)?\)$',
r'^#1 _RootZone.runUnary \(.+\)$',
// The rest are internal frames which we don't really care about.
IGNORE_REMAINING_STACK,
];
await doTestAwait(syncSuffix, expected, debugInfoFilename);
await doTestAwaitThen(syncSuffix, expected, debugInfoFilename);
await doTestAwaitCatchError(syncSuffix, expected, debugInfoFilename);
}
{
final expected = const <String>[
r'^#0 throwAsync \(.*/utils.dart:23(:3)?\)$',
r'^#1 _RootZone.runUnary \(.+\)$',
// The rest are internal frames which we don't really care about.
IGNORE_REMAINING_STACK,
];
await doTestAwait(nonAsyncNoStack, expected, debugInfoFilename);
await doTestAwaitThen(nonAsyncNoStack, expected, debugInfoFilename);
await doTestAwaitCatchError(nonAsyncNoStack, expected, debugInfoFilename);
}
{
final expected = const <String>[
r'^#0 throwSync \(.+/utils.dart:18(:3)?\)$',
r'^#1 asyncStarThrowSync \(.+/utils.dart:114(:11)?\)$',
r'^#2 _RootZone.runUnary \(.+\)$',
// The rest are internal frames which we don't really care about.
IGNORE_REMAINING_STACK,
];
await doTestAwait(
awaitEveryAsyncStarThrowSync, expected, debugInfoFilename);
await doTestAwaitThen(
awaitEveryAsyncStarThrowSync, expected, debugInfoFilename);
await doTestAwaitCatchError(
awaitEveryAsyncStarThrowSync, expected, debugInfoFilename);
}
{
final expected = const <String>[
r'^#0 throwAsync \(.*/utils.dart:23(:3)?\)$',
r'^#1 _RootZone.runUnary \(.+\)$',
// The rest are internal frames which we don't really care about.
IGNORE_REMAINING_STACK,
];
await doTestAwait(
awaitEveryAsyncStarThrowAsync, expected, debugInfoFilename);
await doTestAwaitThen(
awaitEveryAsyncStarThrowAsync, expected, debugInfoFilename);
await doTestAwaitCatchError(
awaitEveryAsyncStarThrowAsync, expected, debugInfoFilename);
}
{
final expected = const <String>[
r'^#0 throwAsync \(.*/utils.dart:23(:3)?\)$',
r'^#1 _RootZone.runUnary \(.+\)$',
// The rest are internal frames which we don't really care about.
IGNORE_REMAINING_STACK,
];
await doTestAwait(listenAsyncStarThrowAsync, expected, debugInfoFilename);
await doTestAwaitThen(
listenAsyncStarThrowAsync, expected, debugInfoFilename);
await doTestAwaitCatchError(
listenAsyncStarThrowAsync, expected, debugInfoFilename);
}
{
final expected = const <String>[
r'#0 throwSync \(.*/utils.dart:18(:3)?\)$',
r'#1 allYield3 \(.*/utils.dart:41(:3)?\)$',
r'#2 _rootRunUnary ',
// The rest are internal frames which we don't really care about.
IGNORE_REMAINING_STACK,
];
await doTestAwait(customErrorZone, expected, debugInfoFilename);
await doTestAwaitThen(customErrorZone, expected, debugInfoFilename);
await doTestAwaitCatchError(customErrorZone, expected, debugInfoFilename);
}
{
final expected = const <String>[
r'#0 throwAsync \(.*/utils.dart:23(:3)?\)$',
r'^#1 _RootZone.runUnary \(.+\)$',
// The rest are internal frames which we don't really care about.
IGNORE_REMAINING_STACK,
];
await doTestAwait(awaitTimeout, expected, debugInfoFilename);
await doTestAwaitThen(awaitTimeout, expected, debugInfoFilename);
await doTestAwaitCatchError(awaitTimeout, expected, debugInfoFilename);
}
{
final expected = const <String>[
r'#0 throwAsync \(.*/utils.dart:23(:3)?\)$',
r'^#1 _RootZone.runUnary \(.+\)$',
// The rest are internal frames which we don't really care about.
IGNORE_REMAINING_STACK,
];
await doTestAwait(awaitWait, expected, debugInfoFilename);
await doTestAwaitThen(awaitWait, expected, debugInfoFilename);
await doTestAwaitCatchError(awaitWait, expected, debugInfoFilename);
}
{
final expected = const <String>[
r'^#0 throwAsync \(.*/utils.dart:23(:3)?\)$',
r'^#1 _RootZone.runUnary \(.+\)$',
// The rest are internal frames which we don't really care about.
IGNORE_REMAINING_STACK,
];
await doTestAwait(futureSyncWhenComplete, expected, debugInfoFilename);
await doTestAwaitThen(futureSyncWhenComplete, expected, debugInfoFilename);
await doTestAwaitCatchError(
futureSyncWhenComplete, expected, debugInfoFilename);
}
{
final expected = const <String>[
r'^#0 throwSync \(.*/utils.dart:18(:3)?\)$',
r'^#1 futureThen.<anonymous closure> \(.*/utils.dart:189(:5)?\)$',
r'^#2 _RootZone.runUnary \(.+\)$',
// The rest are internal frames which we don't really care about.
IGNORE_REMAINING_STACK,
];
await doTestAwait(futureThen, expected, debugInfoFilename);
await doTestAwaitThen(futureThen, expected, debugInfoFilename);
await doTestAwaitCatchError(futureThen, expected, debugInfoFilename);
}
}
// For: --lazy-async-stacks
Future<void> doTestsLazy([String debugInfoFilename]) async {
// allYield
{

View file

@ -1,8 +1,6 @@
// Copyright (c) 2020, 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=--lazy-async-stacks
// @dart = 2.9

View file

@ -5639,7 +5639,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_lazy_async_stacks);
function.set_is_inlinable(false);
}
ASSERT(!function.IsCompactAsyncFunction());
ASSERT(!function.IsCompactAsyncStarFunction());

View file

@ -1384,7 +1384,7 @@ void ScopeBuilder::VisitVariableDeclaration() {
// Lift the special async vars out of the function body scope, into the
// outer function declaration scope.
// This way we can allocate them in the outermost context at fixed indices,
// allowing support for --lazy-async-stacks implementation to find awaiters.
// allowing support for async stack traces implementation to find awaiters.
if (name.Equals(Symbols::AwaitJumpVar()) ||
name.Equals(Symbols::AsyncFuture()) || name.Equals(Symbols::is_sync()) ||
name.Equals(Symbols::Controller())) {

View file

@ -102,7 +102,6 @@ static void PrecompilationModeHandler(bool value) {
FLAG_reorder_basic_blocks = true;
FLAG_use_field_guards = false;
FLAG_use_cha_deopt = false;
FLAG_lazy_async_stacks = true;
#if !defined(PRODUCT) && !defined(DART_PRECOMPILED_RUNTIME)
// Set flags affecting runtime accordingly for gen_snapshot.

View file

@ -1966,13 +1966,6 @@ void DebuggerStackTrace::AppendCodeFrames(Thread* thread,
}
DebuggerStackTrace* DebuggerStackTrace::CollectAsyncCausal() {
if (FLAG_lazy_async_stacks) {
return CollectAsyncLazy();
}
return nullptr;
}
DebuggerStackTrace* DebuggerStackTrace::CollectAsyncLazy() {
Thread* thread = Thread::Current();
Zone* zone = thread->zone();
Isolate* isolate = thread->isolate();
@ -1996,9 +1989,8 @@ DebuggerStackTrace* DebuggerStackTrace::CollectAsyncLazy() {
&inlined_code, &deopt_frame);
};
StackTraceUtils::CollectFramesLazy(thread, code_array, &pc_offset_array,
/*skip_frames=*/0, &on_sync_frame,
&has_async);
StackTraceUtils::CollectFrames(thread, code_array, &pc_offset_array,
/*skip_frames=*/0, &on_sync_frame, &has_async);
// If the entire stack is sync, return no (async) trace.
if (!has_async) {
@ -4072,31 +4064,29 @@ ErrorPtr Debugger::PauseStepping() {
}
// We need to manually set a synthetic breakpoint for async_op before entry.
if (FLAG_lazy_async_stacks) {
// async and async* functions always contain synthetic async_ops.
if ((frame->function().IsAsyncFunction() ||
frame->function().IsAsyncGenerator()) &&
!frame->function().IsSuspendableFunction()) {
ASSERT(!frame->GetSavedCurrentContext().IsNull());
ASSERT(frame->GetSavedCurrentContext().num_variables() >
Context::kAsyncFutureIndex);
// async and async* functions always contain synthetic async_ops.
if ((frame->function().IsAsyncFunction() ||
frame->function().IsAsyncGenerator()) &&
!frame->function().IsSuspendableFunction()) {
ASSERT(!frame->GetSavedCurrentContext().IsNull());
ASSERT(frame->GetSavedCurrentContext().num_variables() >
Context::kAsyncFutureIndex);
const Object& async_future = Object::Handle(
frame->GetSavedCurrentContext().At(Context::kAsyncFutureIndex));
const Object& async_future = Object::Handle(
frame->GetSavedCurrentContext().At(Context::kAsyncFutureIndex));
// Only set breakpoint when entering async_op the first time.
// :async_future should be uninitialised at this point:
if (async_future.IsNull()) {
const Function& async_op = Function::Handle(
ClosureFunctionsCache::GetUniqueInnerClosure(frame->function()));
if (!async_op.IsNull()) {
SetBreakpointAtAsyncOp(async_op);
// After setting the breakpoint we stop stepping and continue the
// debugger until the next breakpoint, to step over all the
// synthetic code.
Continue();
return Error::null();
}
// Only set breakpoint when entering async_op the first time.
// :async_future should be uninitialised at this point:
if (async_future.IsNull()) {
const Function& async_op = Function::Handle(
ClosureFunctionsCache::GetUniqueInnerClosure(frame->function()));
if (!async_op.IsNull()) {
SetBreakpointAtAsyncOp(async_op);
// After setting the breakpoint we stop stepping and continue the
// debugger until the next breakpoint, to step over all the
// synthetic code.
Continue();
return Error::null();
}
}
}

View file

@ -524,7 +524,6 @@ class DebuggerStackTrace : public ZoneAllocated {
Array* deopt_frame);
static DebuggerStackTrace* CollectAsyncCausal();
static DebuggerStackTrace* CollectAsyncLazy();
ZoneGrowableArray<ActivationFrame*> trace_;

View file

@ -64,7 +64,6 @@ constexpr bool FLAG_support_il_printer = false;
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(lazy_async_stacks, bool, true, "Reconstruct async stacks from listeners") \
P(lazy_dispatchers, bool, true, "Generate dispatchers lazily") \
R(dedup_instructions, true, bool, false, \
"Canonicalize instructions when precompiling.")
@ -135,6 +134,7 @@ constexpr bool FLAG_support_il_printer = false;
P(idle_duration_micros, int, 500 * kMicrosecondsPerMillisecond, \
"Allow idle tasks to run for this long.") \
P(interpret_irregexp, bool, false, "Use irregexp bytecode interpreter") \
P(lazy_async_stacks, bool, true, "Obsolete, ignored.") \
P(link_natives_lazily, bool, false, "Link native calls lazily") \
R(log_marker_tasks, false, bool, false, \
"Log debugging information for old gen GC marking tasks.") \

View file

@ -2056,17 +2056,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_lazy_async_stacks);
function.set_is_visible(false);
break;
case FunctionNodeHelper::kAsync:
function.set_modifier(UntaggedFunction::kAsync);
function.set_is_inlinable(!FLAG_lazy_async_stacks);
function.set_is_visible(!FLAG_lazy_async_stacks);
function.set_is_inlinable(false);
function.set_is_visible(false);
break;
case FunctionNodeHelper::kAsyncStar:
function.set_modifier(UntaggedFunction::kAsyncGen);
function.set_is_inlinable(!FLAG_lazy_async_stacks);
function.set_is_visible(!FLAG_lazy_async_stacks);
function.set_is_inlinable(false);
function.set_is_visible(false);
break;
default:
// no special modifier

View file

@ -627,7 +627,7 @@ void StackTraceUtils::UnwindAwaiterChain(
}
}
void StackTraceUtils::CollectFramesLazy(
void StackTraceUtils::CollectFrames(
Thread* thread,
const GrowableObjectArray& code_array,
GrowableArray<uword>* pc_offset_array,
@ -696,85 +696,4 @@ void StackTraceUtils::CollectFramesLazy(
return;
}
intptr_t StackTraceUtils::CountFrames(Thread* thread,
int skip_frames,
const Function& async_function,
bool* sync_async_end) {
Zone* zone = thread->zone();
intptr_t frame_count = 0;
DartFrameIterator frames(thread, StackFrameIterator::kNoCrossThreadIteration);
StackFrame* frame = frames.NextFrame();
ASSERT(frame != nullptr); // We expect to find a dart invocation frame.
Function& function = Function::Handle(zone);
Code& code = Code::Handle(zone);
Closure& closure = Closure::Handle(zone);
const bool async_function_is_null = async_function.IsNull();
ASSERT(async_function_is_null || sync_async_end != nullptr);
for (; frame != nullptr; frame = frames.NextFrame()) {
if (skip_frames > 0) {
skip_frames--;
continue;
}
code = frame->LookupDartCode();
function = code.function();
frame_count++;
const bool function_is_null = function.IsNull();
if (!async_function_is_null && !function_is_null &&
function.parent_function() != Function::null()) {
if (async_function.ptr() == function.parent_function()) {
if (function.IsAsyncClosure() || function.IsAsyncGenClosure()) {
ObjectPtr* last_caller_obj =
reinterpret_cast<ObjectPtr*>(frame->GetCallerSp());
closure = FindClosureInFrame(last_caller_obj, function);
if (!closure.IsNull() &&
CallerClosureFinder::IsRunningAsync(closure)) {
*sync_async_end = false;
return frame_count;
}
}
break;
}
}
}
if (!async_function_is_null) {
*sync_async_end = true;
}
return frame_count;
}
intptr_t StackTraceUtils::CollectFrames(Thread* thread,
const Array& code_array,
const TypedData& pc_offset_array,
intptr_t array_offset,
intptr_t count,
int skip_frames) {
Zone* zone = thread->zone();
DartFrameIterator frames(thread, StackFrameIterator::kNoCrossThreadIteration);
StackFrame* frame = frames.NextFrame();
ASSERT(frame != NULL); // We expect to find a dart invocation frame.
Code& code = Code::Handle(zone);
intptr_t collected_frames_count = 0;
for (; (frame != NULL) && (collected_frames_count < count);
frame = frames.NextFrame()) {
if (skip_frames > 0) {
skip_frames--;
continue;
}
code = frame->LookupDartCode();
const intptr_t pc_offset = frame->pc() - code.PayloadStart();
code_array.SetAt(array_offset, code);
pc_offset_array.SetUintPtr(array_offset * kWordSize, pc_offset);
array_offset++;
collected_frames_count++;
}
return collected_frames_count;
}
} // namespace dart

View file

@ -144,46 +144,17 @@ class StackTraceUtils : public AllStatic {
/// hit which has yielded before (i.e. is not in sync-async case).
///
/// From there on finds the closure of the async/async* frame and starts
/// traversing the listeners:
/// while (closure != null) {
/// yield_index = closure.context[Context::kAsyncJumpVarIndex]
/// pc = closure.function.code.pc_descriptors.LookupPcFromYieldIndex(
/// yield_index);
/// <emit pc in frame>
/// closure = closure.context[Context::kAsyncCompleterVarIndex]._future
/// ._resultOrListeners.callback;
/// }
/// traversing the listeners.
///
/// If [on_sync_frames] is non-nullptr, it will be called for every
/// synchronous frame which is collected.
static void CollectFramesLazy(
static void CollectFrames(
Thread* thread,
const GrowableObjectArray& code_array,
GrowableArray<uword>* pc_offset_array,
int skip_frames,
std::function<void(StackFrame*)>* on_sync_frames = nullptr,
bool* has_async = nullptr);
/// Counts the number of stack frames.
/// Skips over the first |skip_frames|.
/// If |async_function| is not null, stops at the function that has
/// |async_function| as its parent, and records in 'sync_async_end' whether
/// |async_function| was called synchronously.
static intptr_t CountFrames(Thread* thread,
int skip_frames,
const Function& async_function,
bool* sync_async_end);
/// Collects |count| frames into |code_array| and |pc_offset_array|.
/// Writing begins at |array_offset|.
/// Skips over the first |skip_frames|.
/// Returns the number of frames collected.
static intptr_t CollectFrames(Thread* thread,
const Array& code_array,
const TypedData& pc_offset_array,
intptr_t array_offset,
intptr_t count,
int skip_frames);
};
} // namespace dart

View file

@ -1,8 +1,6 @@
// 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=--lazy-async-stacks
import 'package:async_helper/async_minitest.dart';

View file

@ -1,8 +1,6 @@
// 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=--lazy-async-stacks
import 'package:async_helper/async_minitest.dart';
@ -36,8 +34,8 @@ main() async {
} catch (e, st) {
expect(
h.stringContainsInOrder(st.toString(), [
'thrower', '.dart:12', // no auto-format.
'generator', '.dart:21', // no auto-format.
'thrower', '.dart:10', // no auto-format.
'generator', '.dart:19', // no auto-format.
'<asynchronous suspension>', // no auto-format.
'foo', '.dart', // no auto-format.
'main',
@ -74,8 +72,8 @@ main() async {
} catch (e, st) {
expect(
h.stringContainsInOrder(st.toString(), [
'thrower', '.dart:12', // no auto-format.
'main.<anonymous closure>', '.dart:73', // no auto-format.
'thrower', '.dart:10', // no auto-format.
'main.<anonymous closure>', '.dart:71', // no auto-format.
]),
isTrue);
}

View file

@ -1,8 +1,6 @@
// 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=--lazy-async-stacks
// @dart = 2.9

View file

@ -1,8 +1,6 @@
// 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=--lazy-async-stacks
// @dart = 2.9
@ -38,8 +36,8 @@ main() async {
} catch (e, st) {
expect(
h.stringContainsInOrder(st.toString(), [
'thrower', '.dart:14', // no auto-format.
'generator', '.dart:23', // no auto-format.
'thrower', '.dart:12', // no auto-format.
'generator', '.dart:21', // no auto-format.
'<asynchronous suspension>', // no auto-format.
'foo', '.dart', // no auto-format.
'main',
@ -76,8 +74,8 @@ main() async {
} catch (e, st) {
expect(
h.stringContainsInOrder(st.toString(), [
'thrower', '.dart:14', // no auto-format.
'main.<anonymous closure>', '.dart:75', // no auto-format.
'thrower', '.dart:12', // no auto-format.
'main.<anonymous closure>', '.dart:73', // no auto-format.
]),
isTrue);
}

View file

@ -1,8 +1,6 @@
// 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=--lazy-async-stacks
import "package:expect/expect.dart";

View file

@ -1,8 +1,6 @@
// 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=--lazy-async-stacks
// @dart = 2.9