From 2a40c2ddb572483c055ce0a2480471792ab4a6ee Mon Sep 17 00:00:00 2001 From: Ryan Macnak Date: Thu, 10 Oct 2019 10:41:24 -0700 Subject: [PATCH] Pass -Ddart.developer.causal_async_stacks=true to frontend_server invocations. (#42354) Bytecode generation will otherwise omit prologue code, causing --causal-async-stacks passed to the VM to behave inconsistently. --- packages/flutter_tools/lib/src/codegen.dart | 2 ++ packages/flutter_tools/lib/src/compile.dart | 6 ++++++ .../test/general.shard/build_system/targets/dart_test.dart | 1 + 3 files changed, 9 insertions(+) diff --git a/packages/flutter_tools/lib/src/codegen.dart b/packages/flutter_tools/lib/src/codegen.dart index 79fdb8b8d5..cdd874efa0 100644 --- a/packages/flutter_tools/lib/src/codegen.dart +++ b/packages/flutter_tools/lib/src/codegen.dart @@ -96,6 +96,7 @@ class CodeGeneratingKernelCompiler implements KernelCompiler { bool linkPlatformKernelIn = false, bool aot = false, bool enableAsserts = false, + bool causalAsyncStacks = true, bool trackWidgetCreation, List extraFrontEndOptions, bool targetProductVm = false, @@ -133,6 +134,7 @@ class CodeGeneratingKernelCompiler implements KernelCompiler { linkPlatformKernelIn: linkPlatformKernelIn, aot: aot, enableAsserts: enableAsserts, + causalAsyncStacks: causalAsyncStacks, trackWidgetCreation: trackWidgetCreation, extraFrontEndOptions: extraFrontEndOptions, targetProductVm: targetProductVm, diff --git a/packages/flutter_tools/lib/src/compile.dart b/packages/flutter_tools/lib/src/compile.dart index df8a208eac..48be6789cc 100644 --- a/packages/flutter_tools/lib/src/compile.dart +++ b/packages/flutter_tools/lib/src/compile.dart @@ -250,6 +250,7 @@ class KernelCompiler { bool linkPlatformKernelIn = false, bool aot = false, bool enableAsserts = false, + bool causalAsyncStacks = true, @required bool trackWidgetCreation, List extraFrontEndOptions, String packagesPath, @@ -286,6 +287,7 @@ class KernelCompiler { sdkRoot, '--strong', '--target=$targetModel', + '-Ddart.developer.causal_async_stacks=$causalAsyncStacks', if (enableAsserts) '--enable-asserts', if (trackWidgetCreation) '--track-widget-creation', if (!linkPlatformKernelIn) '--no-link-platform', @@ -428,6 +430,7 @@ class ResidentCompiler { ResidentCompiler( this._sdkRoot, { bool enableAsserts = false, + bool causalAsyncStacks = true, bool trackWidgetCreation = false, String packagesPath, List fileSystemRoots, @@ -439,6 +442,7 @@ class ResidentCompiler { List experimentalFlags, }) : assert(_sdkRoot != null), _enableAsserts = enableAsserts, + _causalAsyncStacks = causalAsyncStacks, _trackWidgetCreation = trackWidgetCreation, _packagesPath = packagesPath, _fileSystemRoots = fileSystemRoots, @@ -456,6 +460,7 @@ class ResidentCompiler { } final bool _enableAsserts; + final bool _causalAsyncStacks; final bool _trackWidgetCreation; final String _packagesPath; final TargetModel _targetModel; @@ -569,6 +574,7 @@ class ResidentCompiler { '--incremental', '--strong', '--target=$_targetModel', + '-Ddart.developer.causal_async_stacks=$_causalAsyncStacks', if (outputPath != null) ...[ '--output-dill', outputPath, diff --git a/packages/flutter_tools/test/general.shard/build_system/targets/dart_test.dart b/packages/flutter_tools/test/general.shard/build_system/targets/dart_test.dart index be15544eb2..87c786cf83 100644 --- a/packages/flutter_tools/test/general.shard/build_system/targets/dart_test.dart +++ b/packages/flutter_tools/test/general.shard/build_system/targets/dart_test.dart @@ -392,6 +392,7 @@ class FakeKernelCompiler implements KernelCompiler { bool linkPlatformKernelIn = false, bool aot = false, bool enableAsserts = false, + bool causalAsyncStacks = true, bool trackWidgetCreation, List extraFrontEndOptions, String packagesPath,