Skip to content

Commit bc8afad

Browse files
alexmarkovCommit Bot
authored and
Commit Bot
committed
[vm] Cleanup old async/async*/sync* implementation from the VM
TEST=ci Issue: #48378 Change-Id: I089ba4ed5613f30eec29f0db4ac6d5d8fbffd185 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249980 Reviewed-by: Martin Kustermann <[email protected]> Reviewed-by: Slava Egorov <[email protected]> Commit-Queue: Alexander Markov <[email protected]>
1 parent 94e3dda commit bc8afad

26 files changed

+465
-1615
lines changed

runtime/tests/vm/dart/regress_flutter51298_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
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.
44

5-
// VMOptions=--async_igoto_threshold=0 --optimization_counter_threshold=10 --deterministic
5+
// VMOptions=--optimization_counter_threshold=10 --deterministic
66

77
// Regression test for https://github.com/flutter/flutter/issues/51298.
88
// This would cause a crash due to bad offsets causing entry to hit the pre-code

runtime/tests/vm/dart_2/regress_flutter51298_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
// @dart = 2.9
66

7-
// VMOptions=--async_igoto_threshold=0 --optimization_counter_threshold=10 --deterministic
7+
// VMOptions=--optimization_counter_threshold=10 --deterministic
88

99
// Regression test for https://github.com/flutter/flutter/issues/51298.
1010
// This would cause a crash due to bad offsets causing entry to hit the pre-code

runtime/vm/code_descriptors.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ class ExceptionHandlerList : public ZoneAllocated {
7878

7979
explicit ExceptionHandlerList(const Function& function)
8080
: list_(),
81-
has_async_handler_(function.IsCompactAsyncFunction() ||
82-
function.IsCompactAsyncStarFunction()) {}
81+
has_async_handler_(function.IsAsyncFunction() ||
82+
function.IsAsyncGenerator()) {}
8383

8484
intptr_t Length() const { return list_.length(); }
8585

runtime/vm/compiler/aot/precompiler.cc

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -629,8 +629,6 @@ void Precompiler::DoCompileAll() {
629629
IG->object_store()->set_simple_instance_of_true_function(null_function);
630630
IG->object_store()->set_simple_instance_of_false_function(
631631
null_function);
632-
IG->object_store()->set_async_star_move_next_helper(null_function);
633-
IG->object_store()->set_complete_on_async_return(null_function);
634632
IG->object_store()->set_async_star_stream_controller(null_class);
635633
DropMetadata();
636634
DropLibraryEntries();
@@ -1136,14 +1134,6 @@ void Precompiler::AddTypesOf(const Function& function) {
11361134
return;
11371135
}
11381136

1139-
// Preserve parents for generated bodies in async/async*/sync* functions,
1140-
// since predicates like Function::IsAsyncClosure(), etc. need that info.
1141-
if (function.is_generated_body()) {
1142-
AddRetainReason(parent_function, RetainReasons::kIsSyncAsyncFunction);
1143-
AddTypesOf(parent_function);
1144-
return;
1145-
}
1146-
11471137
// We're not retaining the parent due to this function, so wrap it with
11481138
// a weak serialization reference.
11491139
const auto& data = ClosureData::CheckedHandle(Z, function.data());
@@ -2983,10 +2973,6 @@ void Precompiler::DiscardCodeObjects() {
29832973
++codes_with_native_function_;
29842974
return;
29852975
}
2986-
if (function_.IsAsyncClosure() || function_.IsAsyncGenClosure()) {
2987-
++codes_with_async_closure_function_;
2988-
return;
2989-
}
29902976

29912977
// Retain Code objects corresponding to dynamically
29922978
// called functions.
@@ -3040,8 +3026,6 @@ void Precompiler::DiscardCodeObjects() {
30403026
codes_with_pc_descriptors_);
30413027
THR_Print(" %8" Pd " Codes with native functions\n",
30423028
codes_with_native_function_);
3043-
THR_Print(" %8" Pd " Codes with async closure functions\n",
3044-
codes_with_async_closure_function_);
30453029
THR_Print(" %8" Pd " Codes with dynamically called functions\n",
30463030
codes_with_dynamically_called_function_);
30473031
THR_Print(" %8" Pd " Codes with deferred functions\n",
@@ -3073,7 +3057,6 @@ void Precompiler::DiscardCodeObjects() {
30733057
intptr_t codes_with_exception_handlers_ = 0;
30743058
intptr_t codes_with_pc_descriptors_ = 0;
30753059
intptr_t codes_with_native_function_ = 0;
3076-
intptr_t codes_with_async_closure_function_ = 0;
30773060
intptr_t codes_with_dynamically_called_function_ = 0;
30783061
intptr_t codes_with_deferred_function_ = 0;
30793062
intptr_t codes_with_ffi_trampoline_function_ = 0;

runtime/vm/compiler/backend/il.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6836,7 +6836,7 @@ void RawStoreFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
68366836
const Code& ReturnInstr::GetReturnStub(FlowGraphCompiler* compiler) const {
68376837
const Function& function = compiler->parsed_function().function();
68386838
ASSERT(function.IsSuspendableFunction());
6839-
if (function.IsCompactAsyncFunction()) {
6839+
if (function.IsAsyncFunction()) {
68406840
if (!value()->Type()->CanBeFuture()) {
68416841
return Code::ZoneHandle(compiler->zone(),
68426842
compiler->isolate_group()
@@ -6846,11 +6846,11 @@ const Code& ReturnInstr::GetReturnStub(FlowGraphCompiler* compiler) const {
68466846
return Code::ZoneHandle(
68476847
compiler->zone(),
68486848
compiler->isolate_group()->object_store()->return_async_stub());
6849-
} else if (function.IsCompactAsyncStarFunction()) {
6849+
} else if (function.IsAsyncGenerator()) {
68506850
return Code::ZoneHandle(
68516851
compiler->zone(),
68526852
compiler->isolate_group()->object_store()->return_async_star_stub());
6853-
} else if (function.IsCompactSyncStarFunction()) {
6853+
} else if (function.IsSyncGenerator()) {
68546854
return Code::ZoneHandle(
68556855
compiler->zone(),
68566856
compiler->isolate_group()->object_store()->return_sync_star_stub());

0 commit comments

Comments
 (0)