From c4b3af83b0950566fb57c40cc481611caef4dc15 Mon Sep 17 00:00:00 2001 From: "anton.bashirov" Date: Sun, 1 Sep 2024 23:38:01 +0400 Subject: [PATCH 01/35] fibers --- sdk/lib/_internal/js_dev_runtime/patch/fiber_patch.dart | 2 +- sdk/lib/_internal/js_runtime/lib/fiber_patch.dart | 2 +- sdk/lib/_internal/vm/lib/fiber_patch.dart | 2 +- sdk/lib/_internal/wasm/lib/fiber_patch.dart | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sdk/lib/_internal/js_dev_runtime/patch/fiber_patch.dart b/sdk/lib/_internal/js_dev_runtime/patch/fiber_patch.dart index a6de2b4b515c..6c78557261b9 100644 --- a/sdk/lib/_internal/js_dev_runtime/patch/fiber_patch.dart +++ b/sdk/lib/_internal/js_dev_runtime/patch/fiber_patch.dart @@ -7,7 +7,7 @@ class Fiber { FiberState get state => _state; var _state = FiberState.created; @patch - Fiber._({required int size, required void Function() entry, required String name}) : this.name = name {} + Fiber._({required int size, required void Function() entry, required String name}) : this.name = name; @patch void start() { throw UnsupportedError("Fiber.start"); } @patch diff --git a/sdk/lib/_internal/js_runtime/lib/fiber_patch.dart b/sdk/lib/_internal/js_runtime/lib/fiber_patch.dart index a6de2b4b515c..6c78557261b9 100644 --- a/sdk/lib/_internal/js_runtime/lib/fiber_patch.dart +++ b/sdk/lib/_internal/js_runtime/lib/fiber_patch.dart @@ -7,7 +7,7 @@ class Fiber { FiberState get state => _state; var _state = FiberState.created; @patch - Fiber._({required int size, required void Function() entry, required String name}) : this.name = name {} + Fiber._({required int size, required void Function() entry, required String name}) : this.name = name; @patch void start() { throw UnsupportedError("Fiber.start"); } @patch diff --git a/sdk/lib/_internal/vm/lib/fiber_patch.dart b/sdk/lib/_internal/vm/lib/fiber_patch.dart index 03f0c3bf1482..e511920c5490 100644 --- a/sdk/lib/_internal/vm/lib/fiber_patch.dart +++ b/sdk/lib/_internal/vm/lib/fiber_patch.dart @@ -35,7 +35,7 @@ class Fiber { @pragma("vm:prefer-inline") Fiber._({required int size, required void Function() entry, required String name}) : this.name = name, - _current = _Coroutine._(size, entry) {} + _current = _Coroutine._(size, entry); @patch @pragma("vm:prefer-inline") diff --git a/sdk/lib/_internal/wasm/lib/fiber_patch.dart b/sdk/lib/_internal/wasm/lib/fiber_patch.dart index a6de2b4b515c..6c78557261b9 100644 --- a/sdk/lib/_internal/wasm/lib/fiber_patch.dart +++ b/sdk/lib/_internal/wasm/lib/fiber_patch.dart @@ -7,7 +7,7 @@ class Fiber { FiberState get state => _state; var _state = FiberState.created; @patch - Fiber._({required int size, required void Function() entry, required String name}) : this.name = name {} + Fiber._({required int size, required void Function() entry, required String name}) : this.name = name; @patch void start() { throw UnsupportedError("Fiber.start"); } @patch From 6aea018c2a13da029a10e42fa9713bce84112193 Mon Sep 17 00:00:00 2001 From: "anton.bashirov" Date: Sun, 1 Sep 2024 23:47:12 +0400 Subject: [PATCH 02/35] fibers --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index d32fe4df470e..2a9ed9bdc747 100644 --- a/.gitignore +++ b/.gitignore @@ -117,4 +117,5 @@ build/ build-sdk-debug.sh build-sdk.sh *.exe -*.aot \ No newline at end of file +*.aot +*.S \ No newline at end of file From 1df4d62aca81c018f2f4a2f9a97a174977391f3f Mon Sep 17 00:00:00 2001 From: "anton.bashirov" Date: Mon, 2 Sep 2024 00:06:05 +0400 Subject: [PATCH 03/35] fiber --- runtime/vm/compiler/backend/il.cc | 7 +++++++ sdk.code-workspace | 3 +++ 2 files changed, 10 insertions(+) diff --git a/runtime/vm/compiler/backend/il.cc b/runtime/vm/compiler/backend/il.cc index e501c32fb2e1..3beb0556694f 100644 --- a/runtime/vm/compiler/backend/il.cc +++ b/runtime/vm/compiler/backend/il.cc @@ -8637,6 +8637,13 @@ void CoroutineTransferInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ PopRegister(PP); __ PopRegister(FPREG); + // __ RestoreCodePointer(); + // if (FLAG_precompiled_mode) { + // __ movq(PP, Address(THR, target::Thread::global_object_pool_offset())); + // } else { + // __ LoadPoolPointer(PP); + // } + __ LoadFieldFromOffset(kToStackLimit, kToCoroutine, Coroutine::stack_limit_offset()); __ StoreToOffset(kToStackLimit, THR, Thread::stack_limit_offset()); __ StoreToOffset(kToCoroutine, THR, Thread::coroutine_offset()); diff --git a/sdk.code-workspace b/sdk.code-workspace index 20163f56fbdf..d901d2cefe1d 100644 --- a/sdk.code-workspace +++ b/sdk.code-workspace @@ -49,6 +49,9 @@ "clangd.arguments": [ "--compile-commands-dir=out/DebugX64" ], + "files.exclude": { + "**/*.S": true, + }, "dart.analysisExcludedFolders": [ // These "tests" folders include invalid Dart code which // will show as analyzer warnings/errors we don't intend to fix. From fe97c4829e9bc92feb39dacc85f6e0519d0894fb Mon Sep 17 00:00:00 2001 From: "anton.bashirov" Date: Mon, 2 Sep 2024 00:23:33 +0400 Subject: [PATCH 04/35] fibers --- runtime/vm/compiler/backend/il.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/runtime/vm/compiler/backend/il.cc b/runtime/vm/compiler/backend/il.cc index 3beb0556694f..e2cb31711bac 100644 --- a/runtime/vm/compiler/backend/il.cc +++ b/runtime/vm/compiler/backend/il.cc @@ -8637,6 +8637,9 @@ void CoroutineTransferInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ PopRegister(PP); __ PopRegister(FPREG); + // __ movq(Address(THR, target::Thread::top_exit_frame_info_offset()), + // Immediate(0)); + // // Restore the pool pointer. // __ RestoreCodePointer(); // if (FLAG_precompiled_mode) { // __ movq(PP, Address(THR, target::Thread::global_object_pool_offset())); From b2af980fc7ee48ac8bb60b356d97ef6c6507175f Mon Sep 17 00:00:00 2001 From: "anton.bashirov" Date: Tue, 3 Sep 2024 00:51:17 +0400 Subject: [PATCH 05/35] fibers --- runtime/vm/compiler/backend/il.cc | 62 +++++++++++-------------------- runtime/vm/stack_frame.cc | 3 ++ 2 files changed, 24 insertions(+), 41 deletions(-) diff --git a/runtime/vm/compiler/backend/il.cc b/runtime/vm/compiler/backend/il.cc index e2cb31711bac..00984b27da1c 100644 --- a/runtime/vm/compiler/backend/il.cc +++ b/runtime/vm/compiler/backend/il.cc @@ -8575,29 +8575,22 @@ void CoroutineInitializeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ Drop(1); __ LeaveFrame(); - __ PushRegister(FPREG); - __ PushRegister(PP); - __ PushRegister(CODE_REG); - __ PushRegister(FUNCTION_REG); - - __ EnterFrame(0); + __ set_constant_pool_allowed(false); + __ EnterDartFrame(0); __ LoadFieldFromOffset(SPREG, kCoroutine, Coroutine::stack_base_offset()); __ PushRegister(FPREG); - + __ LoadCompressedFieldFromOffset(FUNCTION_REG, kCoroutine, Coroutine::entry_offset()); if (!FLAG_precompiled_mode) { __ LoadCompressedFieldFromOffset(CODE_REG, FUNCTION_REG, Function::code_offset()); __ LoadImmediate(ARGS_DESC_REG, 0); } __ Call(compiler::FieldAddress(FUNCTION_REG, Function::entry_point_offset())); - - __ PopRegister(FPREG); - __ LeaveFrame(); - - __ PopRegister(FUNCTION_REG); - __ PopRegister(CODE_REG); - __ PopRegister(PP); + __ PopRegister(FPREG); + if (!FLAG_precompiled_mode) __ RestoreCodePointer(); + __ LeaveDartFrame(); + __ set_constant_pool_allowed(true); __ EnterFrame(0); __ PushObject(compiler::NullObject()); @@ -8625,27 +8618,16 @@ void CoroutineTransferInstr::EmitNativeCode(FlowGraphCompiler* compiler) { #if defined(TARGET_ARCH_ARM) || defined(TARGET_ARCH_ARM64) SPILLS_LR_TO_FRAME({}); #endif + if (!FLAG_precompiled_mode) __ PushRegister(CODE_REG); + if (!FLAG_precompiled_mode) __ PushRegister(FUNCTION_REG); __ PushRegister(FPREG); - __ PushRegister(PP); - __ PushRegister(CODE_REG); - __ PushRegister(FUNCTION_REG); __ StoreFieldToOffset(SPREG, kFromCoroutine, Coroutine::stack_base_offset()); __ LoadFieldFromOffset(SPREG, kToCoroutine, Coroutine::stack_base_offset()); - __ PopRegister(FUNCTION_REG); - __ PopRegister(CODE_REG); - __ PopRegister(PP); __ PopRegister(FPREG); - - // __ movq(Address(THR, target::Thread::top_exit_frame_info_offset()), - // Immediate(0)); - // // Restore the pool pointer. - // __ RestoreCodePointer(); - // if (FLAG_precompiled_mode) { - // __ movq(PP, Address(THR, target::Thread::global_object_pool_offset())); - // } else { - // __ LoadPoolPointer(PP); - // } + if (!FLAG_precompiled_mode) __ PopRegister(FUNCTION_REG); + if (!FLAG_precompiled_mode) __ PopRegister(CODE_REG); + if (FLAG_precompiled_mode) { __ movq(PP, compiler::Address(THR, Thread::global_object_pool_offset())); } else { __ LoadPoolPointer(PP); } __ LoadFieldFromOffset(kToStackLimit, kToCoroutine, Coroutine::stack_limit_offset()); __ StoreToOffset(kToStackLimit, THR, Thread::stack_limit_offset()); @@ -8673,12 +8655,10 @@ void CoroutineForkInstr::EmitNativeCode(FlowGraphCompiler* compiler) { #if defined(TARGET_ARCH_ARM) || defined(TARGET_ARCH_ARM64) SPILLS_LR_TO_FRAME({}); #endif - __ PushRegister(FPREG); - __ PushRegister(PP); - __ PushRegister(CODE_REG); - __ PushRegister(FUNCTION_REG); + __ set_constant_pool_allowed(false); + __ EnterDartFrame(0); + __ StoreFieldToOffset(SPREG, kCallerCoroutine, Coroutine::stack_base_offset()); - __ StoreFieldToOffset(kCallerCoroutine, kForkedCoroutine, Coroutine::caller_offset()); __ LoadFieldFromOffset(kStackLimit, kForkedCoroutine, Coroutine::stack_limit_offset()); @@ -8694,18 +8674,18 @@ void CoroutineForkInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ LoadImmediate(ARGS_DESC_REG, 0); } __ Call(compiler::FieldAddress(FUNCTION_REG, Function::entry_point_offset())); - + __ PopRegister(kForkedCoroutine); __ LoadFieldFromOffset(kCallerCoroutine, kForkedCoroutine, Coroutine::caller_offset()); __ LoadFieldFromOffset(SPREG, kCallerCoroutine, Coroutine::stack_base_offset()); - __ PopRegister(FUNCTION_REG); - __ PopRegister(CODE_REG); - __ PopRegister(PP); - __ PopRegister(FPREG); - + __ LoadFieldFromOffset(kStackLimit, kCallerCoroutine, Coroutine::stack_limit_offset()); __ StoreToOffset(kStackLimit, THR, Thread::stack_limit_offset()); __ StoreToOffset(kCallerCoroutine, THR, Thread::coroutine_offset()); + + if (!FLAG_precompiled_mode) __ RestoreCodePointer(); + __ LeaveDartFrame(); + __ set_constant_pool_allowed(true); } Definition* SuspendInstr::Canonicalize(FlowGraph* flow_graph) { diff --git a/runtime/vm/stack_frame.cc b/runtime/vm/stack_frame.cc index b89c87e1aa60..fdfde179bfb1 100644 --- a/runtime/vm/stack_frame.cc +++ b/runtime/vm/stack_frame.cc @@ -355,6 +355,9 @@ CodePtr StackFrame::GetCodeObject() const { NoSafepointScope no_safepoint; CodePtr code = ReversePc::Lookup(isolate_group(), pc(), /*is_return_address=*/true); + if (code != Code::null()) { + ASSERT(code != Code::null()); + } ASSERT(code != Code::null()); return code; } From 52eeab510c73a3e1b34644faee1aa06e18dcb97e Mon Sep 17 00:00:00 2001 From: "anton.bashirov" Date: Tue, 3 Sep 2024 01:07:12 +0400 Subject: [PATCH 06/35] fibers --- runtime/vm/compiler/backend/il.cc | 11 +++++++++-- runtime/vm/stack_frame.cc | 3 --- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/runtime/vm/compiler/backend/il.cc b/runtime/vm/compiler/backend/il.cc index 00984b27da1c..30f4c1e7abf7 100644 --- a/runtime/vm/compiler/backend/il.cc +++ b/runtime/vm/compiler/backend/il.cc @@ -8580,6 +8580,8 @@ void CoroutineInitializeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ LoadFieldFromOffset(SPREG, kCoroutine, Coroutine::stack_base_offset()); __ PushRegister(FPREG); + __ movq(compiler::Address(THR, Thread::top_exit_frame_info_offset()), FPREG); + __ LoadCompressedFieldFromOffset(FUNCTION_REG, kCoroutine, Coroutine::entry_offset()); if (!FLAG_precompiled_mode) { __ LoadCompressedFieldFromOffset(CODE_REG, FUNCTION_REG, Function::code_offset()); @@ -8587,6 +8589,8 @@ void CoroutineInitializeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } __ Call(compiler::FieldAddress(FUNCTION_REG, Function::entry_point_offset())); + __ movq(compiler::Address(THR, Thread::top_exit_frame_info_offset()), compiler::Immediate(0)); + __ PopRegister(FPREG); if (!FLAG_precompiled_mode) __ RestoreCodePointer(); __ LeaveDartFrame(); @@ -8655,9 +8659,11 @@ void CoroutineForkInstr::EmitNativeCode(FlowGraphCompiler* compiler) { #if defined(TARGET_ARCH_ARM) || defined(TARGET_ARCH_ARM64) SPILLS_LR_TO_FRAME({}); #endif + __ movq(compiler::Address(THR, Thread::top_exit_frame_info_offset()), FPREG); + __ set_constant_pool_allowed(false); __ EnterDartFrame(0); - + __ StoreFieldToOffset(SPREG, kCallerCoroutine, Coroutine::stack_base_offset()); __ StoreFieldToOffset(kCallerCoroutine, kForkedCoroutine, Coroutine::caller_offset()); @@ -8674,7 +8680,6 @@ void CoroutineForkInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ LoadImmediate(ARGS_DESC_REG, 0); } __ Call(compiler::FieldAddress(FUNCTION_REG, Function::entry_point_offset())); - __ PopRegister(kForkedCoroutine); __ LoadFieldFromOffset(kCallerCoroutine, kForkedCoroutine, Coroutine::caller_offset()); __ LoadFieldFromOffset(SPREG, kCallerCoroutine, Coroutine::stack_base_offset()); @@ -8686,6 +8691,8 @@ void CoroutineForkInstr::EmitNativeCode(FlowGraphCompiler* compiler) { if (!FLAG_precompiled_mode) __ RestoreCodePointer(); __ LeaveDartFrame(); __ set_constant_pool_allowed(true); + + __ movq(compiler::Address(THR, Thread::top_exit_frame_info_offset()), FPREG); } Definition* SuspendInstr::Canonicalize(FlowGraph* flow_graph) { diff --git a/runtime/vm/stack_frame.cc b/runtime/vm/stack_frame.cc index fdfde179bfb1..b89c87e1aa60 100644 --- a/runtime/vm/stack_frame.cc +++ b/runtime/vm/stack_frame.cc @@ -355,9 +355,6 @@ CodePtr StackFrame::GetCodeObject() const { NoSafepointScope no_safepoint; CodePtr code = ReversePc::Lookup(isolate_group(), pc(), /*is_return_address=*/true); - if (code != Code::null()) { - ASSERT(code != Code::null()); - } ASSERT(code != Code::null()); return code; } From e3846a2ce65d978d0ffe93f863a2a814a8ac6eae Mon Sep 17 00:00:00 2001 From: "anton.bashirov" Date: Tue, 3 Sep 2024 01:24:21 +0400 Subject: [PATCH 07/35] fibers --- runtime/lib/fiber.cc | 4 ++-- runtime/vm/compiler/backend/il.cc | 20 ++++++++++++-------- runtime/vm/object.cc | 1 - 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/runtime/lib/fiber.cc b/runtime/lib/fiber.cc index 94af8388eecf..5d04d76c8d44 100644 --- a/runtime/lib/fiber.cc +++ b/runtime/lib/fiber.cc @@ -12,7 +12,7 @@ namespace dart { DEFINE_NATIVE_ENTRY(Coroutine_factory, 0, 3) { GET_NON_NULL_NATIVE_ARGUMENT(Smi, size, arguments->NativeArgAt(1)); GET_NON_NULL_NATIVE_ARGUMENT(Closure, entry, arguments->NativeArgAt(2)); - void* stack = VirtualMemory::Allocate(size.Value() * kWordSize, false, false, "coroutine-stack")->address(); - return Coroutine::New((void**)stack + size.Value(), size.Value(), Function::Handle(entry.function()).ptr()); + uword stack = VirtualMemory::Allocate(size.Value() * kWordSize, false, false, "coroutine-stack")->end(); + return Coroutine::New((void**)stack , size.Value(), Function::Handle(entry.function()).ptr()); } } // namespace dart diff --git a/runtime/vm/compiler/backend/il.cc b/runtime/vm/compiler/backend/il.cc index 30f4c1e7abf7..041cef06ca78 100644 --- a/runtime/vm/compiler/backend/il.cc +++ b/runtime/vm/compiler/backend/il.cc @@ -8579,9 +8579,10 @@ void CoroutineInitializeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ EnterDartFrame(0); __ LoadFieldFromOffset(SPREG, kCoroutine, Coroutine::stack_base_offset()); __ PushRegister(FPREG); + __ pushq(compiler::Address(THR, Thread::top_exit_frame_info_offset())); - __ movq(compiler::Address(THR, Thread::top_exit_frame_info_offset()), FPREG); - + __ movq(compiler::Address(THR, Thread::top_exit_frame_info_offset()), SPREG); + __ LoadCompressedFieldFromOffset(FUNCTION_REG, kCoroutine, Coroutine::entry_offset()); if (!FLAG_precompiled_mode) { __ LoadCompressedFieldFromOffset(CODE_REG, FUNCTION_REG, Function::code_offset()); @@ -8589,8 +8590,7 @@ void CoroutineInitializeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } __ Call(compiler::FieldAddress(FUNCTION_REG, Function::entry_point_offset())); - __ movq(compiler::Address(THR, Thread::top_exit_frame_info_offset()), compiler::Immediate(0)); - + __ popq(compiler::Address(THR, Thread::top_exit_frame_info_offset())); __ PopRegister(FPREG); if (!FLAG_precompiled_mode) __ RestoreCodePointer(); __ LeaveDartFrame(); @@ -8622,6 +8622,7 @@ void CoroutineTransferInstr::EmitNativeCode(FlowGraphCompiler* compiler) { #if defined(TARGET_ARCH_ARM) || defined(TARGET_ARCH_ARM64) SPILLS_LR_TO_FRAME({}); #endif + __ pushq(compiler::Address(THR, Thread::top_exit_frame_info_offset())); if (!FLAG_precompiled_mode) __ PushRegister(CODE_REG); if (!FLAG_precompiled_mode) __ PushRegister(FUNCTION_REG); __ PushRegister(FPREG); @@ -8632,6 +8633,7 @@ void CoroutineTransferInstr::EmitNativeCode(FlowGraphCompiler* compiler) { if (!FLAG_precompiled_mode) __ PopRegister(FUNCTION_REG); if (!FLAG_precompiled_mode) __ PopRegister(CODE_REG); if (FLAG_precompiled_mode) { __ movq(PP, compiler::Address(THR, Thread::global_object_pool_offset())); } else { __ LoadPoolPointer(PP); } + __ popq(compiler::Address(THR, Thread::top_exit_frame_info_offset())); __ LoadFieldFromOffset(kToStackLimit, kToCoroutine, Coroutine::stack_limit_offset()); __ StoreToOffset(kToStackLimit, THR, Thread::stack_limit_offset()); @@ -8659,8 +8661,6 @@ void CoroutineForkInstr::EmitNativeCode(FlowGraphCompiler* compiler) { #if defined(TARGET_ARCH_ARM) || defined(TARGET_ARCH_ARM64) SPILLS_LR_TO_FRAME({}); #endif - __ movq(compiler::Address(THR, Thread::top_exit_frame_info_offset()), FPREG); - __ set_constant_pool_allowed(false); __ EnterDartFrame(0); @@ -8673,6 +8673,9 @@ void CoroutineForkInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ LoadFieldFromOffset(SPREG, kForkedCoroutine, Coroutine::stack_base_offset()); __ PushRegister(kForkedCoroutine); + __ pushq(compiler::Address(THR, Thread::top_exit_frame_info_offset())); + + __ movq(compiler::Address(THR, Thread::top_exit_frame_info_offset()), SPREG); __ LoadCompressedFieldFromOffset(FUNCTION_REG, kForkedCoroutine, Coroutine::entry_offset()); if (!FLAG_precompiled_mode) { @@ -8680,7 +8683,10 @@ void CoroutineForkInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ LoadImmediate(ARGS_DESC_REG, 0); } __ Call(compiler::FieldAddress(FUNCTION_REG, Function::entry_point_offset())); + + __ popq(compiler::Address(THR, Thread::top_exit_frame_info_offset())); __ PopRegister(kForkedCoroutine); + __ LoadFieldFromOffset(kCallerCoroutine, kForkedCoroutine, Coroutine::caller_offset()); __ LoadFieldFromOffset(SPREG, kCallerCoroutine, Coroutine::stack_base_offset()); @@ -8691,8 +8697,6 @@ void CoroutineForkInstr::EmitNativeCode(FlowGraphCompiler* compiler) { if (!FLAG_precompiled_mode) __ RestoreCodePointer(); __ LeaveDartFrame(); __ set_constant_pool_allowed(true); - - __ movq(compiler::Address(THR, Thread::top_exit_frame_info_offset()), FPREG); } Definition* SuspendInstr::Canonicalize(FlowGraph* flow_graph) { diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc index 1e6f0bd44fdc..93e65f6e8333 100644 --- a/runtime/vm/object.cc +++ b/runtime/vm/object.cc @@ -26632,7 +26632,6 @@ CodePtr SuspendState::GetCodeObject() const { CoroutinePtr Coroutine::New(void** stack_base, uintptr_t stack_size, FunctionPtr entry) { const auto& coroutine = Coroutine::Handle(Object::Allocate(Heap::kOld)); - *(stack_base--) = 0; NoSafepointScope no_safepoint; coroutine.StoreNonPointer(&coroutine.untag()->stack_base_, (uword)stack_base); coroutine.StoreNonPointer(&coroutine.untag()->stack_limit_, (uword)stack_base - stack_size); From 88681a40e256a51c6f8b8aa1f53eb5445a34e11b Mon Sep 17 00:00:00 2001 From: "anton.bashirov" Date: Tue, 3 Sep 2024 01:29:54 +0400 Subject: [PATCH 08/35] fibers --- runtime/vm/compiler/backend/il.cc | 78 +++++++++++++++---------------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/runtime/vm/compiler/backend/il.cc b/runtime/vm/compiler/backend/il.cc index 041cef06ca78..f86c0c6c28fd 100644 --- a/runtime/vm/compiler/backend/il.cc +++ b/runtime/vm/compiler/backend/il.cc @@ -8603,45 +8603,6 @@ void CoroutineInitializeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ LeaveFrame(); } -LocationSummary* CoroutineTransferInstr::MakeLocationSummary( - Zone* zone, - bool opt) const { - const intptr_t kNumInputs = 2; - const intptr_t kNumTemps = 0; - LocationSummary* locs = new (zone) LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kCall); - locs->set_in(0, Location::RegisterLocation(CoroutineTransferABI::kFromCoroutineReg)); - locs->set_in(1, Location::RegisterLocation(CoroutineTransferABI::kToCoroutineReg)); - return locs; -} - -void CoroutineTransferInstr::EmitNativeCode(FlowGraphCompiler* compiler) { - const Register kFromCoroutine = CoroutineTransferABI::kFromCoroutineReg; - const Register kToCoroutine = CoroutineTransferABI::kToCoroutineReg; - const Register kToStackLimit = CoroutineTransferABI::kToStackLimitReg; - -#if defined(TARGET_ARCH_ARM) || defined(TARGET_ARCH_ARM64) - SPILLS_LR_TO_FRAME({}); -#endif - __ pushq(compiler::Address(THR, Thread::top_exit_frame_info_offset())); - if (!FLAG_precompiled_mode) __ PushRegister(CODE_REG); - if (!FLAG_precompiled_mode) __ PushRegister(FUNCTION_REG); - __ PushRegister(FPREG); - __ StoreFieldToOffset(SPREG, kFromCoroutine, Coroutine::stack_base_offset()); - - __ LoadFieldFromOffset(SPREG, kToCoroutine, Coroutine::stack_base_offset()); - __ PopRegister(FPREG); - if (!FLAG_precompiled_mode) __ PopRegister(FUNCTION_REG); - if (!FLAG_precompiled_mode) __ PopRegister(CODE_REG); - if (FLAG_precompiled_mode) { __ movq(PP, compiler::Address(THR, Thread::global_object_pool_offset())); } else { __ LoadPoolPointer(PP); } - __ popq(compiler::Address(THR, Thread::top_exit_frame_info_offset())); - - __ LoadFieldFromOffset(kToStackLimit, kToCoroutine, Coroutine::stack_limit_offset()); - __ StoreToOffset(kToStackLimit, THR, Thread::stack_limit_offset()); - __ StoreToOffset(kToCoroutine, THR, Thread::coroutine_offset()); - - __ StoreFieldToOffset(kFromCoroutine, kToCoroutine, Coroutine::caller_offset()); -} - LocationSummary* CoroutineForkInstr::MakeLocationSummary( Zone* zone, bool opt) const { @@ -8699,6 +8660,45 @@ void CoroutineForkInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ set_constant_pool_allowed(true); } +LocationSummary* CoroutineTransferInstr::MakeLocationSummary( + Zone* zone, + bool opt) const { + const intptr_t kNumInputs = 2; + const intptr_t kNumTemps = 0; + LocationSummary* locs = new (zone) LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kCall); + locs->set_in(0, Location::RegisterLocation(CoroutineTransferABI::kFromCoroutineReg)); + locs->set_in(1, Location::RegisterLocation(CoroutineTransferABI::kToCoroutineReg)); + return locs; +} + +void CoroutineTransferInstr::EmitNativeCode(FlowGraphCompiler* compiler) { + const Register kFromCoroutine = CoroutineTransferABI::kFromCoroutineReg; + const Register kToCoroutine = CoroutineTransferABI::kToCoroutineReg; + const Register kToStackLimit = CoroutineTransferABI::kToStackLimitReg; + +#if defined(TARGET_ARCH_ARM) || defined(TARGET_ARCH_ARM64) + SPILLS_LR_TO_FRAME({}); +#endif + __ pushq(compiler::Address(THR, Thread::top_exit_frame_info_offset())); + if (!FLAG_precompiled_mode) __ PushRegister(CODE_REG); + if (!FLAG_precompiled_mode) __ PushRegister(FUNCTION_REG); + __ PushRegister(FPREG); + __ StoreFieldToOffset(SPREG, kFromCoroutine, Coroutine::stack_base_offset()); + + __ LoadFieldFromOffset(SPREG, kToCoroutine, Coroutine::stack_base_offset()); + __ PopRegister(FPREG); + if (!FLAG_precompiled_mode) __ PopRegister(FUNCTION_REG); + if (!FLAG_precompiled_mode) __ PopRegister(CODE_REG); + if (FLAG_precompiled_mode) { __ movq(PP, compiler::Address(THR, Thread::global_object_pool_offset())); } else { __ LoadPoolPointer(PP); } + __ popq(compiler::Address(THR, Thread::top_exit_frame_info_offset())); + + __ LoadFieldFromOffset(kToStackLimit, kToCoroutine, Coroutine::stack_limit_offset()); + __ StoreToOffset(kToStackLimit, THR, Thread::stack_limit_offset()); + __ StoreToOffset(kToCoroutine, THR, Thread::coroutine_offset()); + + __ StoreFieldToOffset(kFromCoroutine, kToCoroutine, Coroutine::caller_offset()); +} + Definition* SuspendInstr::Canonicalize(FlowGraph* flow_graph) { if (stub_id() == StubId::kAwaitWithTypeCheck && !operand()->Type()->CanBeFuture()) { From 9160f9e10e2bda9669bc0529170452d9ce0ea06d Mon Sep 17 00:00:00 2001 From: "anton.bashirov" Date: Tue, 3 Sep 2024 01:34:13 +0400 Subject: [PATCH 09/35] fibers --- runtime/lib/fiber.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/runtime/lib/fiber.cc b/runtime/lib/fiber.cc index 5d04d76c8d44..d49c9fa2579d 100644 --- a/runtime/lib/fiber.cc +++ b/runtime/lib/fiber.cc @@ -2,6 +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. +#include #include "vm/bootstrap_natives.h" #include "vm/compiler/runtime_api.h" @@ -12,7 +13,7 @@ namespace dart { DEFINE_NATIVE_ENTRY(Coroutine_factory, 0, 3) { GET_NON_NULL_NATIVE_ARGUMENT(Smi, size, arguments->NativeArgAt(1)); GET_NON_NULL_NATIVE_ARGUMENT(Closure, entry, arguments->NativeArgAt(2)); - uword stack = VirtualMemory::Allocate(size.Value() * kWordSize, false, false, "coroutine-stack")->end(); - return Coroutine::New((void**)stack , size.Value(), Function::Handle(entry.function()).ptr()); + void** stack_base = (void**)((uintptr_t)mmap(0, size.Value() * sizeof(word), PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0) + size.Value()); + return Coroutine::New(stack_base , size.Value(), Function::Handle(entry.function()).ptr()); } } // namespace dart From 24841b522b721154ecb7418d6135bc6fcefbef32 Mon Sep 17 00:00:00 2001 From: "anton.bashirov" Date: Tue, 3 Sep 2024 22:24:59 +0400 Subject: [PATCH 10/35] fibers --- runtime/vm/compiler/backend/il.cc | 46 ++++++++++++++++--------------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/runtime/vm/compiler/backend/il.cc b/runtime/vm/compiler/backend/il.cc index f86c0c6c28fd..e45a96729e8a 100644 --- a/runtime/vm/compiler/backend/il.cc +++ b/runtime/vm/compiler/backend/il.cc @@ -8578,9 +8578,9 @@ void CoroutineInitializeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ set_constant_pool_allowed(false); __ EnterDartFrame(0); __ LoadFieldFromOffset(SPREG, kCoroutine, Coroutine::stack_base_offset()); + __ PushRegister(FPREG); - __ pushq(compiler::Address(THR, Thread::top_exit_frame_info_offset())); - + __ pushq(compiler::Address(THR, Thread::top_exit_frame_info_offset())); __ movq(compiler::Address(THR, Thread::top_exit_frame_info_offset()), SPREG); __ LoadCompressedFieldFromOffset(FUNCTION_REG, kCoroutine, Coroutine::entry_offset()); @@ -8592,6 +8592,7 @@ void CoroutineInitializeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ popq(compiler::Address(THR, Thread::top_exit_frame_info_offset())); __ PopRegister(FPREG); + if (!FLAG_precompiled_mode) __ RestoreCodePointer(); __ LeaveDartFrame(); __ set_constant_pool_allowed(true); @@ -8622,21 +8623,21 @@ void CoroutineForkInstr::EmitNativeCode(FlowGraphCompiler* compiler) { #if defined(TARGET_ARCH_ARM) || defined(TARGET_ARCH_ARM64) SPILLS_LR_TO_FRAME({}); #endif - __ set_constant_pool_allowed(false); - __ EnterDartFrame(0); - - __ StoreFieldToOffset(SPREG, kCallerCoroutine, Coroutine::stack_base_offset()); __ StoreFieldToOffset(kCallerCoroutine, kForkedCoroutine, Coroutine::caller_offset()); __ LoadFieldFromOffset(kStackLimit, kForkedCoroutine, Coroutine::stack_limit_offset()); __ StoreToOffset(kStackLimit, THR, Thread::stack_limit_offset()); __ StoreToOffset(kForkedCoroutine, THR, Thread::coroutine_offset()); - __ LoadFieldFromOffset(SPREG, kForkedCoroutine, Coroutine::stack_base_offset()); - __ PushRegister(kForkedCoroutine); + __ set_constant_pool_allowed(false); + __ EnterDartFrame(0); + __ PushRegister(FPREG); __ pushq(compiler::Address(THR, Thread::top_exit_frame_info_offset())); + __ StoreFieldToOffset(SPREG, kCallerCoroutine, Coroutine::stack_base_offset()); - __ movq(compiler::Address(THR, Thread::top_exit_frame_info_offset()), SPREG); + __ LoadFieldFromOffset(SPREG, kForkedCoroutine, Coroutine::stack_base_offset()); + + __ PushRegister(kForkedCoroutine); __ LoadCompressedFieldFromOffset(FUNCTION_REG, kForkedCoroutine, Coroutine::entry_offset()); if (!FLAG_precompiled_mode) { @@ -8645,19 +8646,20 @@ void CoroutineForkInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } __ Call(compiler::FieldAddress(FUNCTION_REG, Function::entry_point_offset())); - __ popq(compiler::Address(THR, Thread::top_exit_frame_info_offset())); __ PopRegister(kForkedCoroutine); - __ LoadFieldFromOffset(kCallerCoroutine, kForkedCoroutine, Coroutine::caller_offset()); + __ LoadFieldFromOffset(SPREG, kCallerCoroutine, Coroutine::stack_base_offset()); - __ LoadFieldFromOffset(kStackLimit, kCallerCoroutine, Coroutine::stack_limit_offset()); - __ StoreToOffset(kStackLimit, THR, Thread::stack_limit_offset()); - __ StoreToOffset(kCallerCoroutine, THR, Thread::coroutine_offset()); - + __ popq(compiler::Address(THR, Thread::top_exit_frame_info_offset())); + __ PopRegister(FPREG); if (!FLAG_precompiled_mode) __ RestoreCodePointer(); __ LeaveDartFrame(); __ set_constant_pool_allowed(true); + + __ LoadFieldFromOffset(kStackLimit, kCallerCoroutine, Coroutine::stack_limit_offset()); + __ StoreToOffset(kStackLimit, THR, Thread::stack_limit_offset()); + __ StoreToOffset(kCallerCoroutine, THR, Thread::coroutine_offset()); } LocationSummary* CoroutineTransferInstr::MakeLocationSummary( @@ -8679,18 +8681,18 @@ void CoroutineTransferInstr::EmitNativeCode(FlowGraphCompiler* compiler) { #if defined(TARGET_ARCH_ARM) || defined(TARGET_ARCH_ARM64) SPILLS_LR_TO_FRAME({}); #endif - __ pushq(compiler::Address(THR, Thread::top_exit_frame_info_offset())); - if (!FLAG_precompiled_mode) __ PushRegister(CODE_REG); - if (!FLAG_precompiled_mode) __ PushRegister(FUNCTION_REG); + __ set_constant_pool_allowed(false); + __ EnterDartFrame(0); __ PushRegister(FPREG); + __ pushq(compiler::Address(THR, Thread::top_exit_frame_info_offset())); __ StoreFieldToOffset(SPREG, kFromCoroutine, Coroutine::stack_base_offset()); __ LoadFieldFromOffset(SPREG, kToCoroutine, Coroutine::stack_base_offset()); - __ PopRegister(FPREG); - if (!FLAG_precompiled_mode) __ PopRegister(FUNCTION_REG); - if (!FLAG_precompiled_mode) __ PopRegister(CODE_REG); - if (FLAG_precompiled_mode) { __ movq(PP, compiler::Address(THR, Thread::global_object_pool_offset())); } else { __ LoadPoolPointer(PP); } __ popq(compiler::Address(THR, Thread::top_exit_frame_info_offset())); + __ PopRegister(FPREG); + if (!FLAG_precompiled_mode) __ RestoreCodePointer(); + __ LeaveDartFrame(); + __ set_constant_pool_allowed(true); __ LoadFieldFromOffset(kToStackLimit, kToCoroutine, Coroutine::stack_limit_offset()); __ StoreToOffset(kToStackLimit, THR, Thread::stack_limit_offset()); From 20b8682ea77adb285fe103e138f22e3f603101ca Mon Sep 17 00:00:00 2001 From: "anton.bashirov" Date: Tue, 3 Sep 2024 22:34:37 +0400 Subject: [PATCH 11/35] fibers --- runtime/vm/compiler/backend/il.cc | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/runtime/vm/compiler/backend/il.cc b/runtime/vm/compiler/backend/il.cc index e45a96729e8a..91152bca6ae3 100644 --- a/runtime/vm/compiler/backend/il.cc +++ b/runtime/vm/compiler/backend/il.cc @@ -8578,7 +8578,6 @@ void CoroutineInitializeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ set_constant_pool_allowed(false); __ EnterDartFrame(0); __ LoadFieldFromOffset(SPREG, kCoroutine, Coroutine::stack_base_offset()); - __ PushRegister(FPREG); __ pushq(compiler::Address(THR, Thread::top_exit_frame_info_offset())); __ movq(compiler::Address(THR, Thread::top_exit_frame_info_offset()), SPREG); @@ -8592,7 +8591,6 @@ void CoroutineInitializeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ popq(compiler::Address(THR, Thread::top_exit_frame_info_offset())); __ PopRegister(FPREG); - if (!FLAG_precompiled_mode) __ RestoreCodePointer(); __ LeaveDartFrame(); __ set_constant_pool_allowed(true); @@ -8636,7 +8634,7 @@ void CoroutineForkInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ StoreFieldToOffset(SPREG, kCallerCoroutine, Coroutine::stack_base_offset()); __ LoadFieldFromOffset(SPREG, kForkedCoroutine, Coroutine::stack_base_offset()); - + __ movq(compiler::Address(THR, Thread::top_exit_frame_info_offset()), SPREG); __ PushRegister(kForkedCoroutine); __ LoadCompressedFieldFromOffset(FUNCTION_REG, kForkedCoroutine, Coroutine::entry_offset()); @@ -8650,7 +8648,6 @@ void CoroutineForkInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ LoadFieldFromOffset(kCallerCoroutine, kForkedCoroutine, Coroutine::caller_offset()); __ LoadFieldFromOffset(SPREG, kCallerCoroutine, Coroutine::stack_base_offset()); - __ popq(compiler::Address(THR, Thread::top_exit_frame_info_offset())); __ PopRegister(FPREG); if (!FLAG_precompiled_mode) __ RestoreCodePointer(); From 7ad21e0afb5fcf71c24697922f19109d8e5b9a18 Mon Sep 17 00:00:00 2001 From: "anton.bashirov" Date: Tue, 3 Sep 2024 23:16:19 +0400 Subject: [PATCH 12/35] fibers --- .gitignore | 1 + runtime/lib/fiber.cc | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 2a9ed9bdc747..7f9c4ce17fd9 100644 --- a/.gitignore +++ b/.gitignore @@ -116,6 +116,7 @@ doc/api/ build/ build-sdk-debug.sh build-sdk.sh +build-fiber-test.sh *.exe *.aot *.S \ No newline at end of file diff --git a/runtime/lib/fiber.cc b/runtime/lib/fiber.cc index d49c9fa2579d..5a0d71b56f00 100644 --- a/runtime/lib/fiber.cc +++ b/runtime/lib/fiber.cc @@ -7,7 +7,6 @@ #include "vm/compiler/runtime_api.h" #include "vm/native_entry.h" -#include "vm/virtual_memory.h" namespace dart { DEFINE_NATIVE_ENTRY(Coroutine_factory, 0, 3) { From db844efa9f7ad4eb84b8eabeb64ebe111331b591 Mon Sep 17 00:00:00 2001 From: "anton.bashirov" Date: Tue, 3 Sep 2024 23:54:44 +0400 Subject: [PATCH 13/35] fiber --- runtime/vm/compiler/backend/il.cc | 4 ++++ runtime/vm/runtime_entry.cc | 2 +- runtime/vm/stack_frame.cc | 4 ++++ tests/lib/fiber/fiber_test.dart | 9 ++++++--- 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/runtime/vm/compiler/backend/il.cc b/runtime/vm/compiler/backend/il.cc index 91152bca6ae3..5bca783b052f 100644 --- a/runtime/vm/compiler/backend/il.cc +++ b/runtime/vm/compiler/backend/il.cc @@ -8577,6 +8577,7 @@ void CoroutineInitializeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ set_constant_pool_allowed(false); __ EnterDartFrame(0); + __ LoadFieldFromOffset(SPREG, kCoroutine, Coroutine::stack_base_offset()); __ PushRegister(FPREG); __ pushq(compiler::Address(THR, Thread::top_exit_frame_info_offset())); @@ -8592,6 +8593,8 @@ void CoroutineInitializeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ popq(compiler::Address(THR, Thread::top_exit_frame_info_offset())); __ PopRegister(FPREG); if (!FLAG_precompiled_mode) __ RestoreCodePointer(); + __ StoreFieldToOffset(SPREG, kCoroutine, Coroutine::stack_base_offset()); + __ LeaveDartFrame(); __ set_constant_pool_allowed(true); @@ -8645,6 +8648,7 @@ void CoroutineForkInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ Call(compiler::FieldAddress(FUNCTION_REG, Function::entry_point_offset())); __ PopRegister(kForkedCoroutine); + __ StoreFieldToOffset(SPREG, kForkedCoroutine, Coroutine::stack_base_offset()); __ LoadFieldFromOffset(kCallerCoroutine, kForkedCoroutine, Coroutine::caller_offset()); __ LoadFieldFromOffset(SPREG, kCallerCoroutine, Coroutine::stack_base_offset()); diff --git a/runtime/vm/runtime_entry.cc b/runtime/vm/runtime_entry.cc index 445d84839b0f..5a425a1cdf66 100644 --- a/runtime/vm/runtime_entry.cc +++ b/runtime/vm/runtime_entry.cc @@ -110,7 +110,7 @@ DEFINE_FLAG(bool, "Enable specializing megamorphic calls from unoptimized code."); DEFINE_FLAG(bool, verbose_stack_overflow, - false, + true, "Print additional details about stack overflow."); DECLARE_FLAG(int, reload_every); diff --git a/runtime/vm/stack_frame.cc b/runtime/vm/stack_frame.cc index b89c87e1aa60..a01430ef9afa 100644 --- a/runtime/vm/stack_frame.cc +++ b/runtime/vm/stack_frame.cc @@ -3,6 +3,7 @@ // BSD-style license that can be found in the LICENSE file. #include "vm/stack_frame.h" +#include #include "platform/memory_sanitizer.h" #include "vm/code_descriptors.h" @@ -305,6 +306,9 @@ void StackFrame::VisitObjectPointers(ObjectPointerVisitor* visitor) { // tagged pointers, so fall through. #if defined(DEBUG) if (FLAG_precompiled_mode) { + if (!IsStubFrame()) { + raise(SIGINT); + } ASSERT(IsStubFrame()); } else { ASSERT(!code.is_optimized() || diff --git a/tests/lib/fiber/fiber_test.dart b/tests/lib/fiber/fiber_test.dart index 3d8fc78ea82f..34a11ac82dd6 100644 --- a/tests/lib/fiber/fiber_test.dart +++ b/tests/lib/fiber/fiber_test.dart @@ -7,9 +7,12 @@ final childFiber = Fiber.child(entry: childEntry, name: "child"); var commonState = ""; void main() { - print("before start"); - mainFiber.start(); - print("after start"); + while (true) { + commonState = ""; + print("before start"); + mainFiber.start(); + print("after start"); + } } void mainEntry() { From a69401c6aa5d1651ba0893075906e4d6fe6e931f Mon Sep 17 00:00:00 2001 From: "anton.bashirov" Date: Wed, 4 Sep 2024 00:00:08 +0400 Subject: [PATCH 14/35] fibers --- runtime/vm/compiler/backend/il.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/runtime/vm/compiler/backend/il.cc b/runtime/vm/compiler/backend/il.cc index 5bca783b052f..b7d8663b6569 100644 --- a/runtime/vm/compiler/backend/il.cc +++ b/runtime/vm/compiler/backend/il.cc @@ -8579,6 +8579,7 @@ void CoroutineInitializeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ EnterDartFrame(0); __ LoadFieldFromOffset(SPREG, kCoroutine, Coroutine::stack_base_offset()); + __ PushRegister(kCoroutine); __ PushRegister(FPREG); __ pushq(compiler::Address(THR, Thread::top_exit_frame_info_offset())); __ movq(compiler::Address(THR, Thread::top_exit_frame_info_offset()), SPREG); @@ -8593,6 +8594,7 @@ void CoroutineInitializeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ popq(compiler::Address(THR, Thread::top_exit_frame_info_offset())); __ PopRegister(FPREG); if (!FLAG_precompiled_mode) __ RestoreCodePointer(); + __ PopRegister(kCoroutine); __ StoreFieldToOffset(SPREG, kCoroutine, Coroutine::stack_base_offset()); __ LeaveDartFrame(); From ef5daae1d0d2bb537350a800ccc33c02d4af3cd7 Mon Sep 17 00:00:00 2001 From: "anton.bashirov" Date: Wed, 4 Sep 2024 02:00:01 +0400 Subject: [PATCH 15/35] fibers --- runtime/lib/fiber.cc | 8 ++++++-- runtime/vm/compiler/backend/il.cc | 3 +++ runtime/vm/virtual_memory.h | 1 + runtime/vm/virtual_memory_posix.cc | 13 +++++++++++++ 4 files changed, 23 insertions(+), 2 deletions(-) diff --git a/runtime/lib/fiber.cc b/runtime/lib/fiber.cc index 5a0d71b56f00..ccb35105e880 100644 --- a/runtime/lib/fiber.cc +++ b/runtime/lib/fiber.cc @@ -7,12 +7,16 @@ #include "vm/compiler/runtime_api.h" #include "vm/native_entry.h" +#include "vm/virtual_memory.h" namespace dart { DEFINE_NATIVE_ENTRY(Coroutine_factory, 0, 3) { GET_NON_NULL_NATIVE_ARGUMENT(Smi, size, arguments->NativeArgAt(1)); GET_NON_NULL_NATIVE_ARGUMENT(Closure, entry, arguments->NativeArgAt(2)); - void** stack_base = (void**)((uintptr_t)mmap(0, size.Value() * sizeof(word), PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0) + size.Value()); - return Coroutine::New(stack_base , size.Value(), Function::Handle(entry.function()).ptr()); + VirtualMemory* stack_memory = VirtualMemory::AllocateStack(size.Value() * kWordSize); + uintptr_t stack_size = stack_memory->size(); + void** stack_base = (void**)stack_memory->address() + stack_size; + ASSERT(Utils::IsAligned(stack_base, OS::ActivationFrameAlignment())); + return Coroutine::New(stack_base, stack_size, Function::Handle(entry.function()).ptr()); } } // namespace dart diff --git a/runtime/vm/compiler/backend/il.cc b/runtime/vm/compiler/backend/il.cc index b7d8663b6569..e38b936a2a1e 100644 --- a/runtime/vm/compiler/backend/il.cc +++ b/runtime/vm/compiler/backend/il.cc @@ -8594,6 +8594,7 @@ void CoroutineInitializeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ popq(compiler::Address(THR, Thread::top_exit_frame_info_offset())); __ PopRegister(FPREG); if (!FLAG_precompiled_mode) __ RestoreCodePointer(); + if (FLAG_precompiled_mode) __ movq(PP, compiler::Address(THR, Thread::global_object_pool_offset())); __ PopRegister(kCoroutine); __ StoreFieldToOffset(SPREG, kCoroutine, Coroutine::stack_base_offset()); @@ -8657,6 +8658,7 @@ void CoroutineForkInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ popq(compiler::Address(THR, Thread::top_exit_frame_info_offset())); __ PopRegister(FPREG); if (!FLAG_precompiled_mode) __ RestoreCodePointer(); + if (FLAG_precompiled_mode) __ movq(PP, compiler::Address(THR, Thread::global_object_pool_offset())); __ LeaveDartFrame(); __ set_constant_pool_allowed(true); @@ -8694,6 +8696,7 @@ void CoroutineTransferInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ popq(compiler::Address(THR, Thread::top_exit_frame_info_offset())); __ PopRegister(FPREG); if (!FLAG_precompiled_mode) __ RestoreCodePointer(); + if (FLAG_precompiled_mode) __ movq(PP, compiler::Address(THR, Thread::global_object_pool_offset())); __ LeaveDartFrame(); __ set_constant_pool_allowed(true); diff --git a/runtime/vm/virtual_memory.h b/runtime/vm/virtual_memory.h index 7ee27f27233f..d5742034397b 100644 --- a/runtime/vm/virtual_memory.h +++ b/runtime/vm/virtual_memory.h @@ -92,6 +92,7 @@ class VirtualMemory { bool vm_owns_region() const { return reserved_.pointer() != nullptr; } static VirtualMemory* ForImagePage(void* pointer, uword size); + static VirtualMemory* AllocateStack(intptr_t size); private: static intptr_t CalculatePageSize(); diff --git a/runtime/vm/virtual_memory_posix.cc b/runtime/vm/virtual_memory_posix.cc index 07d4dd537dcd..3e656a39af7e 100644 --- a/runtime/vm/virtual_memory_posix.cc +++ b/runtime/vm/virtual_memory_posix.cc @@ -334,6 +334,19 @@ VirtualMemory* VirtualMemory::Reserve(intptr_t size, intptr_t alignment) { return new VirtualMemory(region, region); } +VirtualMemory* VirtualMemory::AllocateStack(intptr_t size) { + intptr_t alignment = OS::ActivationFrameAlignment(); + intptr_t allocated_size = size; + void* address = + GenericMapAligned(nullptr, PROT_EXEC | PROT_READ | PROT_WRITE, size, alignment, allocated_size, MAP_PRIVATE | MAP_ANONYMOUS | MAP_NORESERVE); + if (address == nullptr) { + return nullptr; + } + MemoryRegion region(address, size); + return new VirtualMemory(region, region); + +} + void VirtualMemory::Commit(void* address, intptr_t size) { ASSERT(Utils::IsAligned(address, PageSize())); ASSERT(Utils::IsAligned(size, PageSize())); From 8496644dbb239d83ac993c56524a36542e703cf0 Mon Sep 17 00:00:00 2001 From: "anton.bashirov" Date: Wed, 4 Sep 2024 12:09:31 +0400 Subject: [PATCH 16/35] fibers --- runtime/lib/fiber.cc | 1 + tests/lib/fiber/fiber_test.dart | 2 ++ 2 files changed, 3 insertions(+) diff --git a/runtime/lib/fiber.cc b/runtime/lib/fiber.cc index ccb35105e880..ce4258e39249 100644 --- a/runtime/lib/fiber.cc +++ b/runtime/lib/fiber.cc @@ -17,6 +17,7 @@ DEFINE_NATIVE_ENTRY(Coroutine_factory, 0, 3) { uintptr_t stack_size = stack_memory->size(); void** stack_base = (void**)stack_memory->address() + stack_size; ASSERT(Utils::IsAligned(stack_base, OS::ActivationFrameAlignment())); + ASSERT(Utils::IsAligned(stack_base-8, OS::ActivationFrameAlignment())); return Coroutine::New(stack_base, stack_size, Function::Handle(entry.function()).ptr()); } } // namespace dart diff --git a/tests/lib/fiber/fiber_test.dart b/tests/lib/fiber/fiber_test.dart index 34a11ac82dd6..ddb78421ad57 100644 --- a/tests/lib/fiber/fiber_test.dart +++ b/tests/lib/fiber/fiber_test.dart @@ -18,6 +18,7 @@ void main() { void mainEntry() { print("main: entry"); commonState += "main -> "; + print("main: after commonState +="); mainFiber.fork(childFiber); commonState += "main -> "; print("main: after child transfer"); @@ -28,6 +29,7 @@ void mainEntry() { void childEntry() { print("child: entry"); commonState += "child -> "; + print("child: after commonState +="); childFiber.transfer(mainFiber); print("child: after main transfer"); commonState += "child"; From 9cb8912797fb2324a4c3cd7cdde854c3a7ca2a6f Mon Sep 17 00:00:00 2001 From: "anton.bashirov" Date: Wed, 4 Sep 2024 12:40:51 +0400 Subject: [PATCH 17/35] fibers --- runtime/lib/fiber.cc | 2 -- runtime/vm/virtual_memory_posix.cc | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/runtime/lib/fiber.cc b/runtime/lib/fiber.cc index ce4258e39249..8e6c0b0f2f56 100644 --- a/runtime/lib/fiber.cc +++ b/runtime/lib/fiber.cc @@ -16,8 +16,6 @@ DEFINE_NATIVE_ENTRY(Coroutine_factory, 0, 3) { VirtualMemory* stack_memory = VirtualMemory::AllocateStack(size.Value() * kWordSize); uintptr_t stack_size = stack_memory->size(); void** stack_base = (void**)stack_memory->address() + stack_size; - ASSERT(Utils::IsAligned(stack_base, OS::ActivationFrameAlignment())); - ASSERT(Utils::IsAligned(stack_base-8, OS::ActivationFrameAlignment())); return Coroutine::New(stack_base, stack_size, Function::Handle(entry.function()).ptr()); } } // namespace dart diff --git a/runtime/vm/virtual_memory_posix.cc b/runtime/vm/virtual_memory_posix.cc index 3e656a39af7e..ec082404e2a4 100644 --- a/runtime/vm/virtual_memory_posix.cc +++ b/runtime/vm/virtual_memory_posix.cc @@ -338,7 +338,7 @@ VirtualMemory* VirtualMemory::AllocateStack(intptr_t size) { intptr_t alignment = OS::ActivationFrameAlignment(); intptr_t allocated_size = size; void* address = - GenericMapAligned(nullptr, PROT_EXEC | PROT_READ | PROT_WRITE, size, alignment, allocated_size, MAP_PRIVATE | MAP_ANONYMOUS | MAP_NORESERVE); + GenericMapAligned(nullptr, PROT_EXEC | PROT_READ | PROT_WRITE, size, alignment, allocated_size, MAP_PRIVATE | MAP_ANONYMOUS); if (address == nullptr) { return nullptr; } From b4ac8532a6bd39af3cc2f5688a25f38f7adffbc1 Mon Sep 17 00:00:00 2001 From: "anton.bashirov" Date: Wed, 4 Sep 2024 12:42:29 +0400 Subject: [PATCH 18/35] fibers --- tests/lib/fiber/fiber_test.dart | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/lib/fiber/fiber_test.dart b/tests/lib/fiber/fiber_test.dart index ddb78421ad57..34a11ac82dd6 100644 --- a/tests/lib/fiber/fiber_test.dart +++ b/tests/lib/fiber/fiber_test.dart @@ -18,7 +18,6 @@ void main() { void mainEntry() { print("main: entry"); commonState += "main -> "; - print("main: after commonState +="); mainFiber.fork(childFiber); commonState += "main -> "; print("main: after child transfer"); @@ -29,7 +28,6 @@ void mainEntry() { void childEntry() { print("child: entry"); commonState += "child -> "; - print("child: after commonState +="); childFiber.transfer(mainFiber); print("child: after main transfer"); commonState += "child"; From 9806396c9f003cee707883e2fb168ae89e7a83b2 Mon Sep 17 00:00:00 2001 From: "anton.bashirov" Date: Wed, 4 Sep 2024 22:38:27 +0400 Subject: [PATCH 19/35] fibers --- runtime/vm/compiler/backend/il.cc | 8 -------- 1 file changed, 8 deletions(-) diff --git a/runtime/vm/compiler/backend/il.cc b/runtime/vm/compiler/backend/il.cc index e38b936a2a1e..49e13e58096e 100644 --- a/runtime/vm/compiler/backend/il.cc +++ b/runtime/vm/compiler/backend/il.cc @@ -8633,8 +8633,6 @@ void CoroutineForkInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ StoreToOffset(kStackLimit, THR, Thread::stack_limit_offset()); __ StoreToOffset(kForkedCoroutine, THR, Thread::coroutine_offset()); - __ set_constant_pool_allowed(false); - __ EnterDartFrame(0); __ PushRegister(FPREG); __ pushq(compiler::Address(THR, Thread::top_exit_frame_info_offset())); __ StoreFieldToOffset(SPREG, kCallerCoroutine, Coroutine::stack_base_offset()); @@ -8659,8 +8657,6 @@ void CoroutineForkInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ PopRegister(FPREG); if (!FLAG_precompiled_mode) __ RestoreCodePointer(); if (FLAG_precompiled_mode) __ movq(PP, compiler::Address(THR, Thread::global_object_pool_offset())); - __ LeaveDartFrame(); - __ set_constant_pool_allowed(true); __ LoadFieldFromOffset(kStackLimit, kCallerCoroutine, Coroutine::stack_limit_offset()); __ StoreToOffset(kStackLimit, THR, Thread::stack_limit_offset()); @@ -8686,8 +8682,6 @@ void CoroutineTransferInstr::EmitNativeCode(FlowGraphCompiler* compiler) { #if defined(TARGET_ARCH_ARM) || defined(TARGET_ARCH_ARM64) SPILLS_LR_TO_FRAME({}); #endif - __ set_constant_pool_allowed(false); - __ EnterDartFrame(0); __ PushRegister(FPREG); __ pushq(compiler::Address(THR, Thread::top_exit_frame_info_offset())); __ StoreFieldToOffset(SPREG, kFromCoroutine, Coroutine::stack_base_offset()); @@ -8697,8 +8691,6 @@ void CoroutineTransferInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ PopRegister(FPREG); if (!FLAG_precompiled_mode) __ RestoreCodePointer(); if (FLAG_precompiled_mode) __ movq(PP, compiler::Address(THR, Thread::global_object_pool_offset())); - __ LeaveDartFrame(); - __ set_constant_pool_allowed(true); __ LoadFieldFromOffset(kToStackLimit, kToCoroutine, Coroutine::stack_limit_offset()); __ StoreToOffset(kToStackLimit, THR, Thread::stack_limit_offset()); From 4c1455a9d90618e6fbdbed2b2f2563fa2bd344dd Mon Sep 17 00:00:00 2001 From: "anton.bashirov" Date: Wed, 4 Sep 2024 23:25:24 +0400 Subject: [PATCH 20/35] fibers --- runtime/vm/compiler/backend/il.cc | 16 ++++++++-------- runtime/vm/compiler/backend/il.h | 12 ++++++------ runtime/vm/constants_x64.h | 2 -- 3 files changed, 14 insertions(+), 16 deletions(-) diff --git a/runtime/vm/compiler/backend/il.cc b/runtime/vm/compiler/backend/il.cc index 49e13e58096e..273bd81110d8 100644 --- a/runtime/vm/compiler/backend/il.cc +++ b/runtime/vm/compiler/backend/il.cc @@ -8581,8 +8581,8 @@ void CoroutineInitializeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ LoadFieldFromOffset(SPREG, kCoroutine, Coroutine::stack_base_offset()); __ PushRegister(kCoroutine); __ PushRegister(FPREG); - __ pushq(compiler::Address(THR, Thread::top_exit_frame_info_offset())); - __ movq(compiler::Address(THR, Thread::top_exit_frame_info_offset()), SPREG); + // __ pushq(compiler::Address(THR, Thread::top_exit_frame_info_offset())); + // __ movq(compiler::Address(THR, Thread::top_exit_frame_info_offset()), SPREG); __ LoadCompressedFieldFromOffset(FUNCTION_REG, kCoroutine, Coroutine::entry_offset()); if (!FLAG_precompiled_mode) { @@ -8591,7 +8591,7 @@ void CoroutineInitializeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } __ Call(compiler::FieldAddress(FUNCTION_REG, Function::entry_point_offset())); - __ popq(compiler::Address(THR, Thread::top_exit_frame_info_offset())); +// __ popq(compiler::Address(THR, Thread::top_exit_frame_info_offset())); __ PopRegister(FPREG); if (!FLAG_precompiled_mode) __ RestoreCodePointer(); if (FLAG_precompiled_mode) __ movq(PP, compiler::Address(THR, Thread::global_object_pool_offset())); @@ -8634,11 +8634,11 @@ void CoroutineForkInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ StoreToOffset(kForkedCoroutine, THR, Thread::coroutine_offset()); __ PushRegister(FPREG); - __ pushq(compiler::Address(THR, Thread::top_exit_frame_info_offset())); +// __ pushq(compiler::Address(THR, Thread::top_exit_frame_info_offset())); __ StoreFieldToOffset(SPREG, kCallerCoroutine, Coroutine::stack_base_offset()); __ LoadFieldFromOffset(SPREG, kForkedCoroutine, Coroutine::stack_base_offset()); - __ movq(compiler::Address(THR, Thread::top_exit_frame_info_offset()), SPREG); +// __ movq(compiler::Address(THR, Thread::top_exit_frame_info_offset()), SPREG); __ PushRegister(kForkedCoroutine); __ LoadCompressedFieldFromOffset(FUNCTION_REG, kForkedCoroutine, Coroutine::entry_offset()); @@ -8653,7 +8653,7 @@ void CoroutineForkInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ LoadFieldFromOffset(kCallerCoroutine, kForkedCoroutine, Coroutine::caller_offset()); __ LoadFieldFromOffset(SPREG, kCallerCoroutine, Coroutine::stack_base_offset()); - __ popq(compiler::Address(THR, Thread::top_exit_frame_info_offset())); +// __ popq(compiler::Address(THR, Thread::top_exit_frame_info_offset())); __ PopRegister(FPREG); if (!FLAG_precompiled_mode) __ RestoreCodePointer(); if (FLAG_precompiled_mode) __ movq(PP, compiler::Address(THR, Thread::global_object_pool_offset())); @@ -8683,11 +8683,11 @@ void CoroutineTransferInstr::EmitNativeCode(FlowGraphCompiler* compiler) { SPILLS_LR_TO_FRAME({}); #endif __ PushRegister(FPREG); - __ pushq(compiler::Address(THR, Thread::top_exit_frame_info_offset())); +// __ pushq(compiler::Address(THR, Thread::top_exit_frame_info_offset())); __ StoreFieldToOffset(SPREG, kFromCoroutine, Coroutine::stack_base_offset()); __ LoadFieldFromOffset(SPREG, kToCoroutine, Coroutine::stack_base_offset()); - __ popq(compiler::Address(THR, Thread::top_exit_frame_info_offset())); +// __ popq(compiler::Address(THR, Thread::top_exit_frame_info_offset())); __ PopRegister(FPREG); if (!FLAG_precompiled_mode) __ RestoreCodePointer(); if (FLAG_precompiled_mode) __ movq(PP, compiler::Address(THR, Thread::global_object_pool_offset())); diff --git a/runtime/vm/compiler/backend/il.h b/runtime/vm/compiler/backend/il.h index f639bf799341..816344916da8 100644 --- a/runtime/vm/compiler/backend/il.h +++ b/runtime/vm/compiler/backend/il.h @@ -11476,7 +11476,7 @@ class Call1ArgStubInstr : public TemplateDefinition<1, Throws> { DISALLOW_COPY_AND_ASSIGN(Call1ArgStubInstr); }; -class CoroutineInitializeInstr : public TemplateInstruction<1, NoThrow> { +class CoroutineInitializeInstr : public TemplateInstruction<1, Throws> { public: CoroutineInitializeInstr(Value* root, intptr_t deopt_id) : TemplateInstruction(InstructionSource(TokenPosition::kNoSource), @@ -11487,7 +11487,7 @@ class CoroutineInitializeInstr : public TemplateInstruction<1, NoThrow> { Value* root() const { return inputs_[0]; } virtual bool CanCallDart() const { return true; } virtual bool ComputeCanDeoptimize() const { return false; } - virtual bool ComputeCanDeoptimizeAfterCall() const { return true; } + virtual bool ComputeCanDeoptimizeAfterCall() const { return !CompilerState::Current().is_aot(); } virtual bool HasUnknownSideEffects() const { return true; } virtual intptr_t NumberOfInputsConsumedBeforeCall() const { return InputCount(); @@ -11501,7 +11501,7 @@ class CoroutineInitializeInstr : public TemplateInstruction<1, NoThrow> { DISALLOW_COPY_AND_ASSIGN(CoroutineInitializeInstr); }; -class CoroutineTransferInstr : public TemplateInstruction<2, NoThrow> { +class CoroutineTransferInstr : public TemplateInstruction<2, Throws> { public: CoroutineTransferInstr(Value* from, Value* to, intptr_t deopt_id) : TemplateInstruction(InstructionSource(TokenPosition::kNoSource), @@ -11515,7 +11515,7 @@ class CoroutineTransferInstr : public TemplateInstruction<2, NoThrow> { virtual bool CanCallDart() const { return true; } virtual bool ComputeCanDeoptimize() const { return false; } - virtual bool ComputeCanDeoptimizeAfterCall() const { return true; } + virtual bool ComputeCanDeoptimizeAfterCall() const { return !CompilerState::Current().is_aot(); } virtual bool HasUnknownSideEffects() const { return true; } virtual intptr_t NumberOfInputsConsumedBeforeCall() const { return InputCount(); @@ -11529,7 +11529,7 @@ class CoroutineTransferInstr : public TemplateInstruction<2, NoThrow> { DISALLOW_COPY_AND_ASSIGN(CoroutineTransferInstr); }; -class CoroutineForkInstr : public TemplateInstruction<2, NoThrow> { +class CoroutineForkInstr : public TemplateInstruction<2, Throws> { public: CoroutineForkInstr(Value* from, Value* to, intptr_t deopt_id) : TemplateInstruction(InstructionSource(TokenPosition::kNoSource), @@ -11543,7 +11543,7 @@ class CoroutineForkInstr : public TemplateInstruction<2, NoThrow> { virtual bool CanCallDart() const { return true; } virtual bool ComputeCanDeoptimize() const { return false; } - virtual bool ComputeCanDeoptimizeAfterCall() const { return true; } + virtual bool ComputeCanDeoptimizeAfterCall() const { return !CompilerState::Current().is_aot(); } virtual bool HasUnknownSideEffects() const { return true; } virtual intptr_t NumberOfInputsConsumedBeforeCall() const { return InputCount(); diff --git a/runtime/vm/constants_x64.h b/runtime/vm/constants_x64.h index c142b12132fa..235f1e327009 100644 --- a/runtime/vm/constants_x64.h +++ b/runtime/vm/constants_x64.h @@ -390,14 +390,12 @@ struct SuspendStubABI { struct CoroutineInitializeABI { static constexpr Register kCoroutineReg = RDI; - static constexpr Register kEntryReg = RCX; }; struct CoroutineForkABI { static constexpr Register kCallerCoroutineReg = RDI; static constexpr Register kForkedCoroutineReg = RSI; static constexpr Register kStackLimitReg = RDX; - static constexpr Register kForkedEntryReg = RCX; }; struct CoroutineTransferABI { From 921787ec41d6b365225d85b2f3539a10169c9137 Mon Sep 17 00:00:00 2001 From: "anton.bashirov" Date: Wed, 4 Sep 2024 23:32:55 +0400 Subject: [PATCH 21/35] fibers --- runtime/lib/fiber.cc | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/runtime/lib/fiber.cc b/runtime/lib/fiber.cc index 8e6c0b0f2f56..dafcd8ae0a79 100644 --- a/runtime/lib/fiber.cc +++ b/runtime/lib/fiber.cc @@ -3,19 +3,18 @@ // BSD-style license that can be found in the LICENSE file. #include +#include "platform/globals.h" #include "vm/bootstrap_natives.h" #include "vm/compiler/runtime_api.h" #include "vm/native_entry.h" -#include "vm/virtual_memory.h" namespace dart { DEFINE_NATIVE_ENTRY(Coroutine_factory, 0, 3) { GET_NON_NULL_NATIVE_ARGUMENT(Smi, size, arguments->NativeArgAt(1)); GET_NON_NULL_NATIVE_ARGUMENT(Closure, entry, arguments->NativeArgAt(2)); - VirtualMemory* stack_memory = VirtualMemory::AllocateStack(size.Value() * kWordSize); - uintptr_t stack_size = stack_memory->size(); - void** stack_base = (void**)stack_memory->address() + stack_size; - return Coroutine::New(stack_base, stack_size, Function::Handle(entry.function()).ptr()); + uintptr_t stack_size = size.Value(); + void** stack_base = (void**)((uintptr_t)mmap(0, stack_size * kWordSize, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0) + stack_size); + return Coroutine::New(stack_base , stack_size, Function::Handle(entry.function()).ptr()); } } // namespace dart From fa9fa85f67e0b958933000d73cdcd4f405295b25 Mon Sep 17 00:00:00 2001 From: "anton.bashirov" Date: Thu, 5 Sep 2024 01:22:17 +0400 Subject: [PATCH 22/35] fibers --- runtime/lib/fiber.cc | 2 +- runtime/lib/string.cc | 3 +++ runtime/vm/heap/heap.cc | 1 + runtime/vm/object.cc | 9 ++++++++- tests/lib/fiber/fiber_test.dart | 11 ++++++----- 5 files changed, 19 insertions(+), 7 deletions(-) diff --git a/runtime/lib/fiber.cc b/runtime/lib/fiber.cc index dafcd8ae0a79..d3469ea288a3 100644 --- a/runtime/lib/fiber.cc +++ b/runtime/lib/fiber.cc @@ -13,7 +13,7 @@ namespace dart { DEFINE_NATIVE_ENTRY(Coroutine_factory, 0, 3) { GET_NON_NULL_NATIVE_ARGUMENT(Smi, size, arguments->NativeArgAt(1)); GET_NON_NULL_NATIVE_ARGUMENT(Closure, entry, arguments->NativeArgAt(2)); - uintptr_t stack_size = size.Value(); + intptr_t stack_size = size.Value(); void** stack_base = (void**)((uintptr_t)mmap(0, stack_size * kWordSize, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0) + stack_size); return Coroutine::New(stack_base , stack_size, Function::Handle(entry.function()).ptr()); } diff --git a/runtime/lib/string.cc b/runtime/lib/string.cc index 71f7c65e523d..014c7a1bb920 100644 --- a/runtime/lib/string.cc +++ b/runtime/lib/string.cc @@ -2,6 +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. +#include #include "vm/bootstrap_natives.h" #include "include/dart_api.h" @@ -451,7 +452,9 @@ DEFINE_NATIVE_ENTRY(String_charAt, 0, 2) { DEFINE_NATIVE_ENTRY(String_concat, 0, 2) { const String& receiver = String::CheckedHandle(zone, arguments->NativeArgAt(0)); + OS::Print("String_concat \n"); GET_NON_NULL_NATIVE_ARGUMENT(String, b, arguments->NativeArgAt(1)); + OS::Print("String_concat after arg\n"); return String::Concat(receiver, b); } diff --git a/runtime/vm/heap/heap.cc b/runtime/vm/heap/heap.cc index c9713c0cc799..910e618a0bb5 100644 --- a/runtime/vm/heap/heap.cc +++ b/runtime/vm/heap/heap.cc @@ -78,6 +78,7 @@ Heap::~Heap() { uword Heap::AllocateNew(Thread* thread, intptr_t size) { ASSERT(thread->no_safepoint_scope_depth() == 0); + PrintSizes(); CollectForDebugging(thread); uword addr = new_space_.TryAllocate(thread, size); if (LIKELY(addr != 0)) { diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc index 93e65f6e8333..9be2544798c7 100644 --- a/runtime/vm/object.cc +++ b/runtime/vm/object.cc @@ -2784,7 +2784,6 @@ ObjectPtr Object::Allocate(intptr_t cls_id, ASSERT(thread->no_safepoint_scope_depth() == 0); ASSERT(thread->no_callback_scope_depth() == 0); Heap* heap = thread->heap(); - uword address = heap->Allocate(thread, size, space); if (UNLIKELY(address == 0)) { // SuspendLongJumpScope during Dart entry ensures that if a longjmp base is @@ -24059,7 +24058,9 @@ StringPtr String::Concat(const String& str1, const String& str2, Heap::Space space) { ASSERT(!str1.IsNull() && !str2.IsNull()); + OS::Print("String_concat concat start: %s, %s\n", str1.ToCString(), str2.ToCString()); intptr_t char_size = Utils::Maximum(str1.CharSize(), str2.CharSize()); + OS::Print("String_concat char size: %d\n", (int)char_size); if (char_size == kTwoByteChar) { return TwoByteString::Concat(str1, str2, space); } @@ -24486,8 +24487,11 @@ OneByteStringPtr OneByteString::Concat(const String& str1, intptr_t len2 = str2.Length(); intptr_t len = len1 + len2; const String& result = String::Handle(OneByteString::New(len, space)); + OS::Print("String_concat 1b result\n"); String::Copy(result, 0, str1, 0, len1); + OS::Print("String_concat 1b str1 copy\n"); String::Copy(result, len1, str2, 0, len2); + OS::Print("String_concat 1b str2 copy\n"); return OneByteString::raw(result); } @@ -24665,8 +24669,11 @@ TwoByteStringPtr TwoByteString::Concat(const String& str1, intptr_t len2 = str2.Length(); intptr_t len = len1 + len2; const String& result = String::Handle(TwoByteString::New(len, space)); + OS::Print("String_concat 2b result\n"); String::Copy(result, 0, str1, 0, len1); + OS::Print("String_concat 2b str1.copy\n"); String::Copy(result, len1, str2, 0, len2); + OS::Print("String_concat after concat\n"); return TwoByteString::raw(result); } diff --git a/tests/lib/fiber/fiber_test.dart b/tests/lib/fiber/fiber_test.dart index 34a11ac82dd6..257385304080 100644 --- a/tests/lib/fiber/fiber_test.dart +++ b/tests/lib/fiber/fiber_test.dart @@ -8,7 +8,7 @@ var commonState = ""; void main() { while (true) { - commonState = ""; +// commonState = ""; print("before start"); mainFiber.start(); print("after start"); @@ -17,9 +17,10 @@ void main() { void mainEntry() { print("main: entry"); - commonState += "main -> "; +// commonState += "main -> "; mainFiber.fork(childFiber); - commonState += "main -> "; + print("main: after child fork"); +// commonState += "main -> "; print("main: after child transfer"); mainFiber.transfer(childFiber); print(commonState); @@ -27,8 +28,8 @@ void mainEntry() { void childEntry() { print("child: entry"); - commonState += "child -> "; +// commonState += "child -> "; childFiber.transfer(mainFiber); print("child: after main transfer"); - commonState += "child"; +// commonState += "child"; } From fadb936d012d1c6dd802bbf10cd8dbeea5d758fb Mon Sep 17 00:00:00 2001 From: "anton.bashirov" Date: Thu, 5 Sep 2024 23:15:39 +0400 Subject: [PATCH 23/35] fibers --- runtime/lib/string.cc | 2 -- runtime/vm/compiler/backend/il.cc | 16 ++++++++-------- runtime/vm/heap/heap.cc | 1 - runtime/vm/object.cc | 9 +-------- runtime/vm/stack_frame.cc | 3 --- tests/lib/fiber/fiber_test.dart | 12 +++++++----- 6 files changed, 16 insertions(+), 27 deletions(-) diff --git a/runtime/lib/string.cc b/runtime/lib/string.cc index 014c7a1bb920..d04734684968 100644 --- a/runtime/lib/string.cc +++ b/runtime/lib/string.cc @@ -452,9 +452,7 @@ DEFINE_NATIVE_ENTRY(String_charAt, 0, 2) { DEFINE_NATIVE_ENTRY(String_concat, 0, 2) { const String& receiver = String::CheckedHandle(zone, arguments->NativeArgAt(0)); - OS::Print("String_concat \n"); GET_NON_NULL_NATIVE_ARGUMENT(String, b, arguments->NativeArgAt(1)); - OS::Print("String_concat after arg\n"); return String::Concat(receiver, b); } diff --git a/runtime/vm/compiler/backend/il.cc b/runtime/vm/compiler/backend/il.cc index 273bd81110d8..49e13e58096e 100644 --- a/runtime/vm/compiler/backend/il.cc +++ b/runtime/vm/compiler/backend/il.cc @@ -8581,8 +8581,8 @@ void CoroutineInitializeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ LoadFieldFromOffset(SPREG, kCoroutine, Coroutine::stack_base_offset()); __ PushRegister(kCoroutine); __ PushRegister(FPREG); - // __ pushq(compiler::Address(THR, Thread::top_exit_frame_info_offset())); - // __ movq(compiler::Address(THR, Thread::top_exit_frame_info_offset()), SPREG); + __ pushq(compiler::Address(THR, Thread::top_exit_frame_info_offset())); + __ movq(compiler::Address(THR, Thread::top_exit_frame_info_offset()), SPREG); __ LoadCompressedFieldFromOffset(FUNCTION_REG, kCoroutine, Coroutine::entry_offset()); if (!FLAG_precompiled_mode) { @@ -8591,7 +8591,7 @@ void CoroutineInitializeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } __ Call(compiler::FieldAddress(FUNCTION_REG, Function::entry_point_offset())); -// __ popq(compiler::Address(THR, Thread::top_exit_frame_info_offset())); + __ popq(compiler::Address(THR, Thread::top_exit_frame_info_offset())); __ PopRegister(FPREG); if (!FLAG_precompiled_mode) __ RestoreCodePointer(); if (FLAG_precompiled_mode) __ movq(PP, compiler::Address(THR, Thread::global_object_pool_offset())); @@ -8634,11 +8634,11 @@ void CoroutineForkInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ StoreToOffset(kForkedCoroutine, THR, Thread::coroutine_offset()); __ PushRegister(FPREG); -// __ pushq(compiler::Address(THR, Thread::top_exit_frame_info_offset())); + __ pushq(compiler::Address(THR, Thread::top_exit_frame_info_offset())); __ StoreFieldToOffset(SPREG, kCallerCoroutine, Coroutine::stack_base_offset()); __ LoadFieldFromOffset(SPREG, kForkedCoroutine, Coroutine::stack_base_offset()); -// __ movq(compiler::Address(THR, Thread::top_exit_frame_info_offset()), SPREG); + __ movq(compiler::Address(THR, Thread::top_exit_frame_info_offset()), SPREG); __ PushRegister(kForkedCoroutine); __ LoadCompressedFieldFromOffset(FUNCTION_REG, kForkedCoroutine, Coroutine::entry_offset()); @@ -8653,7 +8653,7 @@ void CoroutineForkInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ LoadFieldFromOffset(kCallerCoroutine, kForkedCoroutine, Coroutine::caller_offset()); __ LoadFieldFromOffset(SPREG, kCallerCoroutine, Coroutine::stack_base_offset()); -// __ popq(compiler::Address(THR, Thread::top_exit_frame_info_offset())); + __ popq(compiler::Address(THR, Thread::top_exit_frame_info_offset())); __ PopRegister(FPREG); if (!FLAG_precompiled_mode) __ RestoreCodePointer(); if (FLAG_precompiled_mode) __ movq(PP, compiler::Address(THR, Thread::global_object_pool_offset())); @@ -8683,11 +8683,11 @@ void CoroutineTransferInstr::EmitNativeCode(FlowGraphCompiler* compiler) { SPILLS_LR_TO_FRAME({}); #endif __ PushRegister(FPREG); -// __ pushq(compiler::Address(THR, Thread::top_exit_frame_info_offset())); + __ pushq(compiler::Address(THR, Thread::top_exit_frame_info_offset())); __ StoreFieldToOffset(SPREG, kFromCoroutine, Coroutine::stack_base_offset()); __ LoadFieldFromOffset(SPREG, kToCoroutine, Coroutine::stack_base_offset()); -// __ popq(compiler::Address(THR, Thread::top_exit_frame_info_offset())); + __ popq(compiler::Address(THR, Thread::top_exit_frame_info_offset())); __ PopRegister(FPREG); if (!FLAG_precompiled_mode) __ RestoreCodePointer(); if (FLAG_precompiled_mode) __ movq(PP, compiler::Address(THR, Thread::global_object_pool_offset())); diff --git a/runtime/vm/heap/heap.cc b/runtime/vm/heap/heap.cc index 910e618a0bb5..c9713c0cc799 100644 --- a/runtime/vm/heap/heap.cc +++ b/runtime/vm/heap/heap.cc @@ -78,7 +78,6 @@ Heap::~Heap() { uword Heap::AllocateNew(Thread* thread, intptr_t size) { ASSERT(thread->no_safepoint_scope_depth() == 0); - PrintSizes(); CollectForDebugging(thread); uword addr = new_space_.TryAllocate(thread, size); if (LIKELY(addr != 0)) { diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc index 9be2544798c7..97c04185fbef 100644 --- a/runtime/vm/object.cc +++ b/runtime/vm/object.cc @@ -24058,9 +24058,7 @@ StringPtr String::Concat(const String& str1, const String& str2, Heap::Space space) { ASSERT(!str1.IsNull() && !str2.IsNull()); - OS::Print("String_concat concat start: %s, %s\n", str1.ToCString(), str2.ToCString()); intptr_t char_size = Utils::Maximum(str1.CharSize(), str2.CharSize()); - OS::Print("String_concat char size: %d\n", (int)char_size); if (char_size == kTwoByteChar) { return TwoByteString::Concat(str1, str2, space); } @@ -24487,11 +24485,8 @@ OneByteStringPtr OneByteString::Concat(const String& str1, intptr_t len2 = str2.Length(); intptr_t len = len1 + len2; const String& result = String::Handle(OneByteString::New(len, space)); - OS::Print("String_concat 1b result\n"); String::Copy(result, 0, str1, 0, len1); - OS::Print("String_concat 1b str1 copy\n"); String::Copy(result, len1, str2, 0, len2); - OS::Print("String_concat 1b str2 copy\n"); return OneByteString::raw(result); } @@ -24669,11 +24664,8 @@ TwoByteStringPtr TwoByteString::Concat(const String& str1, intptr_t len2 = str2.Length(); intptr_t len = len1 + len2; const String& result = String::Handle(TwoByteString::New(len, space)); - OS::Print("String_concat 2b result\n"); String::Copy(result, 0, str1, 0, len1); - OS::Print("String_concat 2b str1.copy\n"); String::Copy(result, len1, str2, 0, len2); - OS::Print("String_concat after concat\n"); return TwoByteString::raw(result); } @@ -28035,3 +28027,4 @@ ArrayPtr RecordShape::GetFieldNames(Thread* thread) const { } } // namespace dart + diff --git a/runtime/vm/stack_frame.cc b/runtime/vm/stack_frame.cc index a01430ef9afa..45fec53b76f6 100644 --- a/runtime/vm/stack_frame.cc +++ b/runtime/vm/stack_frame.cc @@ -306,9 +306,6 @@ void StackFrame::VisitObjectPointers(ObjectPointerVisitor* visitor) { // tagged pointers, so fall through. #if defined(DEBUG) if (FLAG_precompiled_mode) { - if (!IsStubFrame()) { - raise(SIGINT); - } ASSERT(IsStubFrame()); } else { ASSERT(!code.is_optimized() || diff --git a/tests/lib/fiber/fiber_test.dart b/tests/lib/fiber/fiber_test.dart index 257385304080..d4526d93b099 100644 --- a/tests/lib/fiber/fiber_test.dart +++ b/tests/lib/fiber/fiber_test.dart @@ -1,5 +1,6 @@ import 'dart:fiber'; import 'dart:async'; +import 'dart:_internal'; final mainFiber = Fiber.main(entry: mainEntry); final childFiber = Fiber.child(entry: childEntry, name: "child"); @@ -8,7 +9,8 @@ var commonState = ""; void main() { while (true) { -// commonState = ""; + VMInternalsForTesting.collectAllGarbage(); + commonState = ""; print("before start"); mainFiber.start(); print("after start"); @@ -17,10 +19,10 @@ void main() { void mainEntry() { print("main: entry"); -// commonState += "main -> "; + commonState += "main -> "; mainFiber.fork(childFiber); print("main: after child fork"); -// commonState += "main -> "; + commonState += "main -> "; print("main: after child transfer"); mainFiber.transfer(childFiber); print(commonState); @@ -28,8 +30,8 @@ void mainEntry() { void childEntry() { print("child: entry"); -// commonState += "child -> "; + commonState += "child -> "; childFiber.transfer(mainFiber); print("child: after main transfer"); -// commonState += "child"; + commonState += "child"; } From 2dd2edf59e7944b63e1a2edacb0eeff64d5728bf Mon Sep 17 00:00:00 2001 From: "anton.bashirov" Date: Thu, 5 Sep 2024 23:33:10 +0400 Subject: [PATCH 24/35] fibers --- runtime/lib/string.cc | 1 - runtime/vm/stack_frame.cc | 1 - sdk/lib/_internal/js_dev_runtime/patch/fiber_patch.dart | 2 ++ sdk/lib/_internal/js_runtime/lib/fiber_patch.dart | 2 ++ sdk/lib/_internal/vm/lib/fiber_patch.dart | 7 ++++++- sdk/lib/_internal/wasm/lib/fiber_patch.dart | 2 ++ sdk/lib/fiber/fiber.dart | 2 ++ tests/lib/fiber/fiber_test.dart | 3 +-- 8 files changed, 15 insertions(+), 5 deletions(-) diff --git a/runtime/lib/string.cc b/runtime/lib/string.cc index d04734684968..71f7c65e523d 100644 --- a/runtime/lib/string.cc +++ b/runtime/lib/string.cc @@ -2,7 +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. -#include #include "vm/bootstrap_natives.h" #include "include/dart_api.h" diff --git a/runtime/vm/stack_frame.cc b/runtime/vm/stack_frame.cc index 45fec53b76f6..b89c87e1aa60 100644 --- a/runtime/vm/stack_frame.cc +++ b/runtime/vm/stack_frame.cc @@ -3,7 +3,6 @@ // BSD-style license that can be found in the LICENSE file. #include "vm/stack_frame.h" -#include #include "platform/memory_sanitizer.h" #include "vm/code_descriptors.h" diff --git a/sdk/lib/_internal/js_dev_runtime/patch/fiber_patch.dart b/sdk/lib/_internal/js_dev_runtime/patch/fiber_patch.dart index 6c78557261b9..d0ed0f458e98 100644 --- a/sdk/lib/_internal/js_dev_runtime/patch/fiber_patch.dart +++ b/sdk/lib/_internal/js_dev_runtime/patch/fiber_patch.dart @@ -14,4 +14,6 @@ class Fiber { void transfer(Fiber to) { throw UnsupportedError("Fiber.transfer"); } @patch void fork(Fiber to) { throw UnsupportedError("Fiber.fork"); } + @patch + static void idle() { throw UnsupportedError("Fiber.idle"); } } diff --git a/sdk/lib/_internal/js_runtime/lib/fiber_patch.dart b/sdk/lib/_internal/js_runtime/lib/fiber_patch.dart index 6c78557261b9..d0ed0f458e98 100644 --- a/sdk/lib/_internal/js_runtime/lib/fiber_patch.dart +++ b/sdk/lib/_internal/js_runtime/lib/fiber_patch.dart @@ -14,4 +14,6 @@ class Fiber { void transfer(Fiber to) { throw UnsupportedError("Fiber.transfer"); } @patch void fork(Fiber to) { throw UnsupportedError("Fiber.fork"); } + @patch + static void idle() { throw UnsupportedError("Fiber.idle"); } } diff --git a/sdk/lib/_internal/vm/lib/fiber_patch.dart b/sdk/lib/_internal/vm/lib/fiber_patch.dart index e511920c5490..169f495e6eaa 100644 --- a/sdk/lib/_internal/vm/lib/fiber_patch.dart +++ b/sdk/lib/_internal/vm/lib/fiber_patch.dart @@ -1,4 +1,4 @@ -import "dart:_internal" show patch; +import "dart:_internal" show patch, VMInternalsForTesting; import "dart:fiber"; import "dart:async" show FutureOr; @@ -54,4 +54,9 @@ class Fiber { void fork(Fiber to) { _coroutineFork(_current, to._current); } + + @patch + static void idle() { + VMInternalsForTesting.collectAllGarbage(); + } } diff --git a/sdk/lib/_internal/wasm/lib/fiber_patch.dart b/sdk/lib/_internal/wasm/lib/fiber_patch.dart index 6c78557261b9..d0ed0f458e98 100644 --- a/sdk/lib/_internal/wasm/lib/fiber_patch.dart +++ b/sdk/lib/_internal/wasm/lib/fiber_patch.dart @@ -14,4 +14,6 @@ class Fiber { void transfer(Fiber to) { throw UnsupportedError("Fiber.transfer"); } @patch void fork(Fiber to) { throw UnsupportedError("Fiber.fork"); } + @patch + static void idle() { throw UnsupportedError("Fiber.idle"); } } diff --git a/sdk/lib/fiber/fiber.dart b/sdk/lib/fiber/fiber.dart index 7bb23cca9598..36ba7a6a6261 100644 --- a/sdk/lib/fiber/fiber.dart +++ b/sdk/lib/fiber/fiber.dart @@ -15,6 +15,8 @@ class Fiber { final String name; static late Fiber _main; + external static void idle(); + external FiberState get state; external Fiber._({required int size, required void Function() entry, required String name}); factory Fiber.main({int size = _kDefaultStackSize, required void Function() entry}) => Fiber._(size: size, entry: entry, name: "main"); diff --git a/tests/lib/fiber/fiber_test.dart b/tests/lib/fiber/fiber_test.dart index d4526d93b099..1939f8a5eb1b 100644 --- a/tests/lib/fiber/fiber_test.dart +++ b/tests/lib/fiber/fiber_test.dart @@ -1,6 +1,5 @@ import 'dart:fiber'; import 'dart:async'; -import 'dart:_internal'; final mainFiber = Fiber.main(entry: mainEntry); final childFiber = Fiber.child(entry: childEntry, name: "child"); @@ -9,7 +8,7 @@ var commonState = ""; void main() { while (true) { - VMInternalsForTesting.collectAllGarbage(); + Fiber.idle(); commonState = ""; print("before start"); mainFiber.start(); From b45012afeca8694d93c47805bb2b7f150945c504 Mon Sep 17 00:00:00 2001 From: "anton.bashirov" Date: Fri, 6 Sep 2024 01:32:57 +0400 Subject: [PATCH 25/35] fibers --- runtime/lib/fiber.cc | 5 +- runtime/vm/compiler/backend/il.cc | 29 ++--- runtime/vm/compiler/runtime_api.h | 1 + .../vm/compiler/runtime_offsets_extracted.h | 120 +++++++++++++----- runtime/vm/compiler/runtime_offsets_list.h | 1 + runtime/vm/compiler/stub_code_compiler.cc | 16 +++ runtime/vm/constants_x64.h | 10 +- runtime/vm/object.cc | 1 + runtime/vm/object.h | 5 + runtime/vm/raw_object.h | 1 + runtime/vm/raw_object_fields.cc | 3 +- runtime/vm/stack_frame.cc | 9 +- runtime/vm/stub_code_list.h | 1 + runtime/vm/symbols.h | 1 + 14 files changed, 145 insertions(+), 58 deletions(-) diff --git a/runtime/lib/fiber.cc b/runtime/lib/fiber.cc index d3469ea288a3..6e533513e507 100644 --- a/runtime/lib/fiber.cc +++ b/runtime/lib/fiber.cc @@ -14,7 +14,8 @@ DEFINE_NATIVE_ENTRY(Coroutine_factory, 0, 3) { GET_NON_NULL_NATIVE_ARGUMENT(Smi, size, arguments->NativeArgAt(1)); GET_NON_NULL_NATIVE_ARGUMENT(Closure, entry, arguments->NativeArgAt(2)); intptr_t stack_size = size.Value(); - void** stack_base = (void**)((uintptr_t)mmap(0, stack_size * kWordSize, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0) + stack_size); - return Coroutine::New(stack_base , stack_size, Function::Handle(entry.function()).ptr()); + void** stack_base = (void**)((uintptr_t)mmap(0, stack_size * kWordSize, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0)); + memset(stack_base, 0, stack_size); + return Coroutine::New(stack_base + stack_size , stack_size, Function::Handle(entry.function()).ptr()); } } // namespace dart diff --git a/runtime/vm/compiler/backend/il.cc b/runtime/vm/compiler/backend/il.cc index 49e13e58096e..80d13cb3b03f 100644 --- a/runtime/vm/compiler/backend/il.cc +++ b/runtime/vm/compiler/backend/il.cc @@ -8579,23 +8579,17 @@ void CoroutineInitializeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ EnterDartFrame(0); __ LoadFieldFromOffset(SPREG, kCoroutine, Coroutine::stack_base_offset()); - __ PushRegister(kCoroutine); __ PushRegister(FPREG); __ pushq(compiler::Address(THR, Thread::top_exit_frame_info_offset())); - __ movq(compiler::Address(THR, Thread::top_exit_frame_info_offset()), SPREG); - __ LoadCompressedFieldFromOffset(FUNCTION_REG, kCoroutine, Coroutine::entry_offset()); - if (!FLAG_precompiled_mode) { - __ LoadCompressedFieldFromOffset(CODE_REG, FUNCTION_REG, Function::code_offset()); - __ LoadImmediate(ARGS_DESC_REG, 0); - } - __ Call(compiler::FieldAddress(FUNCTION_REG, Function::entry_point_offset())); - + __ PushRegister(kCoroutine); + compiler->EmitCallToStub(StubCode::CoroutineEntry()); + __ PopRegister(kCoroutine); + __ popq(compiler::Address(THR, Thread::top_exit_frame_info_offset())); __ PopRegister(FPREG); if (!FLAG_precompiled_mode) __ RestoreCodePointer(); if (FLAG_precompiled_mode) __ movq(PP, compiler::Address(THR, Thread::global_object_pool_offset())); - __ PopRegister(kCoroutine); __ StoreFieldToOffset(SPREG, kCoroutine, Coroutine::stack_base_offset()); __ LeaveDartFrame(); @@ -8638,17 +8632,11 @@ void CoroutineForkInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ StoreFieldToOffset(SPREG, kCallerCoroutine, Coroutine::stack_base_offset()); __ LoadFieldFromOffset(SPREG, kForkedCoroutine, Coroutine::stack_base_offset()); - __ movq(compiler::Address(THR, Thread::top_exit_frame_info_offset()), SPREG); - __ PushRegister(kForkedCoroutine); - - __ LoadCompressedFieldFromOffset(FUNCTION_REG, kForkedCoroutine, Coroutine::entry_offset()); - if (!FLAG_precompiled_mode) { - __ LoadCompressedFieldFromOffset(CODE_REG, FUNCTION_REG, Function::code_offset()); - __ LoadImmediate(ARGS_DESC_REG, 0); - } - __ Call(compiler::FieldAddress(FUNCTION_REG, Function::entry_point_offset())); + __ PushRegister(kForkedCoroutine); + compiler->EmitCallToStub(StubCode::CoroutineEntry()); __ PopRegister(kForkedCoroutine); + __ StoreFieldToOffset(SPREG, kForkedCoroutine, Coroutine::stack_base_offset()); __ LoadFieldFromOffset(kCallerCoroutine, kForkedCoroutine, Coroutine::caller_offset()); @@ -8683,11 +8671,10 @@ void CoroutineTransferInstr::EmitNativeCode(FlowGraphCompiler* compiler) { SPILLS_LR_TO_FRAME({}); #endif __ PushRegister(FPREG); - __ pushq(compiler::Address(THR, Thread::top_exit_frame_info_offset())); __ StoreFieldToOffset(SPREG, kFromCoroutine, Coroutine::stack_base_offset()); __ LoadFieldFromOffset(SPREG, kToCoroutine, Coroutine::stack_base_offset()); - __ popq(compiler::Address(THR, Thread::top_exit_frame_info_offset())); + __ MoveMemoryToMemory(compiler::Address(THR, Thread::top_exit_frame_info_offset()), compiler::Address(kToCoroutine, Coroutine::top_exit_frame_offset())); __ PopRegister(FPREG); if (!FLAG_precompiled_mode) __ RestoreCodePointer(); if (FLAG_precompiled_mode) __ movq(PP, compiler::Address(THR, Thread::global_object_pool_offset())); diff --git a/runtime/vm/compiler/runtime_api.h b/runtime/vm/compiler/runtime_api.h index 37a35915e09b..2ab834ac1f87 100644 --- a/runtime/vm/compiler/runtime_api.h +++ b/runtime/vm/compiler/runtime_api.h @@ -1040,6 +1040,7 @@ class Coroutine : public AllStatic { static word entry_offset(); static word stack_base_offset(); static word stack_limit_offset(); + static word top_exit_frame_offset(); static word InstanceSize(); FINAL_CLASS(); }; diff --git a/runtime/vm/compiler/runtime_offsets_extracted.h b/runtime/vm/compiler/runtime_offsets_extracted.h index b2f226f26967..50ca587421af 100644 --- a/runtime/vm/compiler/runtime_offsets_extracted.h +++ b/runtime/vm/compiler/runtime_offsets_extracted.h @@ -470,6 +470,8 @@ static constexpr dart::compiler::target::word Coroutine_entry_offset = 0x8; static constexpr dart::compiler::target::word Coroutine_stack_base_offset = 0xc; static constexpr dart::compiler::target::word Coroutine_stack_limit_offset = 0x10; +static constexpr dart::compiler::target::word Coroutine_top_exit_frame_offset = + 0x14; static constexpr dart::compiler::target::word Code_entry_point_offset[] = {0x4, 0xc, 0x8, 0x10}; static constexpr dart::compiler::target::word Thread_write_barrier_wrappers_thread_offset[] = { @@ -535,7 +537,7 @@ static constexpr dart::compiler::target::word Sentinel_InstanceSize = 0x4; static constexpr dart::compiler::target::word SingleTargetCache_InstanceSize = 0x14; static constexpr dart::compiler::target::word StackTrace_InstanceSize = 0x14; static constexpr dart::compiler::target::word SuspendState_HeaderSize = 0x1c; -static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x14; +static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x18; static constexpr dart::compiler::target::word String_InstanceSize = 0xc; static constexpr dart::compiler::target::word SubtypeTestCache_InstanceSize = 0x10; static constexpr dart::compiler::target::word LoadingUnit_InstanceSize = 0x14; @@ -1013,6 +1015,8 @@ static constexpr dart::compiler::target::word Coroutine_stack_base_offset = 0x18; static constexpr dart::compiler::target::word Coroutine_stack_limit_offset = 0x20; +static constexpr dart::compiler::target::word Coroutine_top_exit_frame_offset = + 0x28; static constexpr dart::compiler::target::word Code_entry_point_offset[] = {0x8, 0x18, 0x10, 0x20}; static constexpr dart::compiler::target::word Thread_write_barrier_wrappers_thread_offset[] = { @@ -1078,7 +1082,7 @@ static constexpr dart::compiler::target::word Sentinel_InstanceSize = 0x8; static constexpr dart::compiler::target::word SingleTargetCache_InstanceSize = 0x20; static constexpr dart::compiler::target::word StackTrace_InstanceSize = 0x28; static constexpr dart::compiler::target::word SuspendState_HeaderSize = 0x38; -static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x28; +static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x30; static constexpr dart::compiler::target::word String_InstanceSize = 0x10; static constexpr dart::compiler::target::word SubtypeTestCache_InstanceSize = 0x18; static constexpr dart::compiler::target::word LoadingUnit_InstanceSize = 0x28; @@ -1555,6 +1559,8 @@ static constexpr dart::compiler::target::word Coroutine_entry_offset = 0x8; static constexpr dart::compiler::target::word Coroutine_stack_base_offset = 0xc; static constexpr dart::compiler::target::word Coroutine_stack_limit_offset = 0x10; +static constexpr dart::compiler::target::word Coroutine_top_exit_frame_offset = + 0x14; static constexpr dart::compiler::target::word Code_entry_point_offset[] = {0x4, 0xc, 0x8, 0x10}; static constexpr dart::compiler::target::word Thread_write_barrier_wrappers_thread_offset[] = { @@ -1619,7 +1625,7 @@ static constexpr dart::compiler::target::word Sentinel_InstanceSize = 0x4; static constexpr dart::compiler::target::word SingleTargetCache_InstanceSize = 0x14; static constexpr dart::compiler::target::word StackTrace_InstanceSize = 0x14; static constexpr dart::compiler::target::word SuspendState_HeaderSize = 0x1c; -static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x14; +static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x18; static constexpr dart::compiler::target::word String_InstanceSize = 0xc; static constexpr dart::compiler::target::word SubtypeTestCache_InstanceSize = 0x10; static constexpr dart::compiler::target::word LoadingUnit_InstanceSize = 0x14; @@ -2097,6 +2103,8 @@ static constexpr dart::compiler::target::word Coroutine_stack_base_offset = 0x18; static constexpr dart::compiler::target::word Coroutine_stack_limit_offset = 0x20; +static constexpr dart::compiler::target::word Coroutine_top_exit_frame_offset = + 0x28; static constexpr dart::compiler::target::word Code_entry_point_offset[] = {0x8, 0x18, 0x10, 0x20}; static constexpr dart::compiler::target::word Thread_write_barrier_wrappers_thread_offset[] = { @@ -2164,7 +2172,7 @@ static constexpr dart::compiler::target::word Sentinel_InstanceSize = 0x8; static constexpr dart::compiler::target::word SingleTargetCache_InstanceSize = 0x20; static constexpr dart::compiler::target::word StackTrace_InstanceSize = 0x28; static constexpr dart::compiler::target::word SuspendState_HeaderSize = 0x38; -static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x28; +static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x30; static constexpr dart::compiler::target::word String_InstanceSize = 0x10; static constexpr dart::compiler::target::word SubtypeTestCache_InstanceSize = 0x18; static constexpr dart::compiler::target::word LoadingUnit_InstanceSize = 0x28; @@ -2643,6 +2651,8 @@ static constexpr dart::compiler::target::word Coroutine_stack_base_offset = 0x10; static constexpr dart::compiler::target::word Coroutine_stack_limit_offset = 0x18; +static constexpr dart::compiler::target::word Coroutine_top_exit_frame_offset = + 0x20; static constexpr dart::compiler::target::word Code_entry_point_offset[] = {0x8, 0x18, 0x10, 0x20}; static constexpr dart::compiler::target::word Thread_write_barrier_wrappers_thread_offset[] = { @@ -2708,7 +2718,7 @@ static constexpr dart::compiler::target::word Sentinel_InstanceSize = 0x8; static constexpr dart::compiler::target::word SingleTargetCache_InstanceSize = 0x20; static constexpr dart::compiler::target::word StackTrace_InstanceSize = 0x18; static constexpr dart::compiler::target::word SuspendState_HeaderSize = 0x30; -static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x20; +static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x28; static constexpr dart::compiler::target::word String_InstanceSize = 0x10; static constexpr dart::compiler::target::word SubtypeTestCache_InstanceSize = 0x18; static constexpr dart::compiler::target::word LoadingUnit_InstanceSize = 0x20; @@ -3187,6 +3197,8 @@ static constexpr dart::compiler::target::word Coroutine_stack_base_offset = 0x10; static constexpr dart::compiler::target::word Coroutine_stack_limit_offset = 0x18; +static constexpr dart::compiler::target::word Coroutine_top_exit_frame_offset = + 0x20; static constexpr dart::compiler::target::word Code_entry_point_offset[] = {0x8, 0x18, 0x10, 0x20}; static constexpr dart::compiler::target::word Thread_write_barrier_wrappers_thread_offset[] = { @@ -3254,7 +3266,7 @@ static constexpr dart::compiler::target::word Sentinel_InstanceSize = 0x8; static constexpr dart::compiler::target::word SingleTargetCache_InstanceSize = 0x20; static constexpr dart::compiler::target::word StackTrace_InstanceSize = 0x18; static constexpr dart::compiler::target::word SuspendState_HeaderSize = 0x30; -static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x20; +static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x28; static constexpr dart::compiler::target::word String_InstanceSize = 0x10; static constexpr dart::compiler::target::word SubtypeTestCache_InstanceSize = 0x18; static constexpr dart::compiler::target::word LoadingUnit_InstanceSize = 0x20; @@ -3731,6 +3743,8 @@ static constexpr dart::compiler::target::word Coroutine_entry_offset = 0x8; static constexpr dart::compiler::target::word Coroutine_stack_base_offset = 0xc; static constexpr dart::compiler::target::word Coroutine_stack_limit_offset = 0x10; +static constexpr dart::compiler::target::word Coroutine_top_exit_frame_offset = + 0x14; static constexpr dart::compiler::target::word Code_entry_point_offset[] = {0x4, 0xc, 0x8, 0x10}; static constexpr dart::compiler::target::word Thread_write_barrier_wrappers_thread_offset[] = { @@ -3797,7 +3811,7 @@ static constexpr dart::compiler::target::word Sentinel_InstanceSize = 0x4; static constexpr dart::compiler::target::word SingleTargetCache_InstanceSize = 0x14; static constexpr dart::compiler::target::word StackTrace_InstanceSize = 0x14; static constexpr dart::compiler::target::word SuspendState_HeaderSize = 0x1c; -static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x14; +static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x18; static constexpr dart::compiler::target::word String_InstanceSize = 0xc; static constexpr dart::compiler::target::word SubtypeTestCache_InstanceSize = 0x10; static constexpr dart::compiler::target::word LoadingUnit_InstanceSize = 0x14; @@ -4275,6 +4289,8 @@ static constexpr dart::compiler::target::word Coroutine_stack_base_offset = 0x18; static constexpr dart::compiler::target::word Coroutine_stack_limit_offset = 0x20; +static constexpr dart::compiler::target::word Coroutine_top_exit_frame_offset = + 0x28; static constexpr dart::compiler::target::word Code_entry_point_offset[] = {0x8, 0x18, 0x10, 0x20}; static constexpr dart::compiler::target::word Thread_write_barrier_wrappers_thread_offset[] = { @@ -4341,7 +4357,7 @@ static constexpr dart::compiler::target::word Sentinel_InstanceSize = 0x8; static constexpr dart::compiler::target::word SingleTargetCache_InstanceSize = 0x20; static constexpr dart::compiler::target::word StackTrace_InstanceSize = 0x28; static constexpr dart::compiler::target::word SuspendState_HeaderSize = 0x38; -static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x28; +static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x30; static constexpr dart::compiler::target::word String_InstanceSize = 0x10; static constexpr dart::compiler::target::word SubtypeTestCache_InstanceSize = 0x18; static constexpr dart::compiler::target::word LoadingUnit_InstanceSize = 0x28; @@ -4813,6 +4829,8 @@ static constexpr dart::compiler::target::word Coroutine_entry_offset = 0x8; static constexpr dart::compiler::target::word Coroutine_stack_base_offset = 0xc; static constexpr dart::compiler::target::word Coroutine_stack_limit_offset = 0x10; +static constexpr dart::compiler::target::word Coroutine_top_exit_frame_offset = + 0x14; static constexpr dart::compiler::target::word Code_entry_point_offset[] = {0x4, 0xc, 0x8, 0x10}; static constexpr dart::compiler::target::word Thread_write_barrier_wrappers_thread_offset[] = { @@ -4878,7 +4896,7 @@ static constexpr dart::compiler::target::word Sentinel_InstanceSize = 0x4; static constexpr dart::compiler::target::word SingleTargetCache_InstanceSize = 0x14; static constexpr dart::compiler::target::word StackTrace_InstanceSize = 0x14; static constexpr dart::compiler::target::word SuspendState_HeaderSize = 0x1c; -static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x14; +static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x18; static constexpr dart::compiler::target::word String_InstanceSize = 0xc; static constexpr dart::compiler::target::word SubtypeTestCache_InstanceSize = 0x10; static constexpr dart::compiler::target::word LoadingUnit_InstanceSize = 0x14; @@ -5351,6 +5369,8 @@ static constexpr dart::compiler::target::word Coroutine_stack_base_offset = 0x18; static constexpr dart::compiler::target::word Coroutine_stack_limit_offset = 0x20; +static constexpr dart::compiler::target::word Coroutine_top_exit_frame_offset = + 0x28; static constexpr dart::compiler::target::word Code_entry_point_offset[] = {0x8, 0x18, 0x10, 0x20}; static constexpr dart::compiler::target::word Thread_write_barrier_wrappers_thread_offset[] = { @@ -5416,7 +5436,7 @@ static constexpr dart::compiler::target::word Sentinel_InstanceSize = 0x8; static constexpr dart::compiler::target::word SingleTargetCache_InstanceSize = 0x20; static constexpr dart::compiler::target::word StackTrace_InstanceSize = 0x28; static constexpr dart::compiler::target::word SuspendState_HeaderSize = 0x38; -static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x28; +static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x30; static constexpr dart::compiler::target::word String_InstanceSize = 0x10; static constexpr dart::compiler::target::word SubtypeTestCache_InstanceSize = 0x18; static constexpr dart::compiler::target::word LoadingUnit_InstanceSize = 0x28; @@ -5888,6 +5908,8 @@ static constexpr dart::compiler::target::word Coroutine_entry_offset = 0x8; static constexpr dart::compiler::target::word Coroutine_stack_base_offset = 0xc; static constexpr dart::compiler::target::word Coroutine_stack_limit_offset = 0x10; +static constexpr dart::compiler::target::word Coroutine_top_exit_frame_offset = + 0x14; static constexpr dart::compiler::target::word Code_entry_point_offset[] = {0x4, 0xc, 0x8, 0x10}; static constexpr dart::compiler::target::word Thread_write_barrier_wrappers_thread_offset[] = { @@ -5952,7 +5974,7 @@ static constexpr dart::compiler::target::word Sentinel_InstanceSize = 0x4; static constexpr dart::compiler::target::word SingleTargetCache_InstanceSize = 0x14; static constexpr dart::compiler::target::word StackTrace_InstanceSize = 0x14; static constexpr dart::compiler::target::word SuspendState_HeaderSize = 0x1c; -static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x14; +static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x18; static constexpr dart::compiler::target::word String_InstanceSize = 0xc; static constexpr dart::compiler::target::word SubtypeTestCache_InstanceSize = 0x10; static constexpr dart::compiler::target::word LoadingUnit_InstanceSize = 0x14; @@ -6425,6 +6447,8 @@ static constexpr dart::compiler::target::word Coroutine_stack_base_offset = 0x18; static constexpr dart::compiler::target::word Coroutine_stack_limit_offset = 0x20; +static constexpr dart::compiler::target::word Coroutine_top_exit_frame_offset = + 0x28; static constexpr dart::compiler::target::word Code_entry_point_offset[] = {0x8, 0x18, 0x10, 0x20}; static constexpr dart::compiler::target::word Thread_write_barrier_wrappers_thread_offset[] = { @@ -6492,7 +6516,7 @@ static constexpr dart::compiler::target::word Sentinel_InstanceSize = 0x8; static constexpr dart::compiler::target::word SingleTargetCache_InstanceSize = 0x20; static constexpr dart::compiler::target::word StackTrace_InstanceSize = 0x28; static constexpr dart::compiler::target::word SuspendState_HeaderSize = 0x38; -static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x28; +static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x30; static constexpr dart::compiler::target::word String_InstanceSize = 0x10; static constexpr dart::compiler::target::word SubtypeTestCache_InstanceSize = 0x18; static constexpr dart::compiler::target::word LoadingUnit_InstanceSize = 0x28; @@ -6966,6 +6990,8 @@ static constexpr dart::compiler::target::word Coroutine_stack_base_offset = 0x10; static constexpr dart::compiler::target::word Coroutine_stack_limit_offset = 0x18; +static constexpr dart::compiler::target::word Coroutine_top_exit_frame_offset = + 0x20; static constexpr dart::compiler::target::word Code_entry_point_offset[] = {0x8, 0x18, 0x10, 0x20}; static constexpr dart::compiler::target::word Thread_write_barrier_wrappers_thread_offset[] = { @@ -7031,7 +7057,7 @@ static constexpr dart::compiler::target::word Sentinel_InstanceSize = 0x8; static constexpr dart::compiler::target::word SingleTargetCache_InstanceSize = 0x20; static constexpr dart::compiler::target::word StackTrace_InstanceSize = 0x18; static constexpr dart::compiler::target::word SuspendState_HeaderSize = 0x30; -static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x20; +static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x28; static constexpr dart::compiler::target::word String_InstanceSize = 0x10; static constexpr dart::compiler::target::word SubtypeTestCache_InstanceSize = 0x18; static constexpr dart::compiler::target::word LoadingUnit_InstanceSize = 0x20; @@ -7505,6 +7531,8 @@ static constexpr dart::compiler::target::word Coroutine_stack_base_offset = 0x10; static constexpr dart::compiler::target::word Coroutine_stack_limit_offset = 0x18; +static constexpr dart::compiler::target::word Coroutine_top_exit_frame_offset = + 0x20; static constexpr dart::compiler::target::word Code_entry_point_offset[] = {0x8, 0x18, 0x10, 0x20}; static constexpr dart::compiler::target::word Thread_write_barrier_wrappers_thread_offset[] = { @@ -7572,7 +7600,7 @@ static constexpr dart::compiler::target::word Sentinel_InstanceSize = 0x8; static constexpr dart::compiler::target::word SingleTargetCache_InstanceSize = 0x20; static constexpr dart::compiler::target::word StackTrace_InstanceSize = 0x18; static constexpr dart::compiler::target::word SuspendState_HeaderSize = 0x30; -static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x20; +static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x28; static constexpr dart::compiler::target::word String_InstanceSize = 0x10; static constexpr dart::compiler::target::word SubtypeTestCache_InstanceSize = 0x18; static constexpr dart::compiler::target::word LoadingUnit_InstanceSize = 0x20; @@ -8044,6 +8072,8 @@ static constexpr dart::compiler::target::word Coroutine_entry_offset = 0x8; static constexpr dart::compiler::target::word Coroutine_stack_base_offset = 0xc; static constexpr dart::compiler::target::word Coroutine_stack_limit_offset = 0x10; +static constexpr dart::compiler::target::word Coroutine_top_exit_frame_offset = + 0x14; static constexpr dart::compiler::target::word Code_entry_point_offset[] = {0x4, 0xc, 0x8, 0x10}; static constexpr dart::compiler::target::word Thread_write_barrier_wrappers_thread_offset[] = { @@ -8110,7 +8140,7 @@ static constexpr dart::compiler::target::word Sentinel_InstanceSize = 0x4; static constexpr dart::compiler::target::word SingleTargetCache_InstanceSize = 0x14; static constexpr dart::compiler::target::word StackTrace_InstanceSize = 0x14; static constexpr dart::compiler::target::word SuspendState_HeaderSize = 0x1c; -static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x14; +static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x18; static constexpr dart::compiler::target::word String_InstanceSize = 0xc; static constexpr dart::compiler::target::word SubtypeTestCache_InstanceSize = 0x10; static constexpr dart::compiler::target::word LoadingUnit_InstanceSize = 0x14; @@ -8583,6 +8613,8 @@ static constexpr dart::compiler::target::word Coroutine_stack_base_offset = 0x18; static constexpr dart::compiler::target::word Coroutine_stack_limit_offset = 0x20; +static constexpr dart::compiler::target::word Coroutine_top_exit_frame_offset = + 0x28; static constexpr dart::compiler::target::word Code_entry_point_offset[] = {0x8, 0x18, 0x10, 0x20}; static constexpr dart::compiler::target::word Thread_write_barrier_wrappers_thread_offset[] = { @@ -8649,7 +8681,7 @@ static constexpr dart::compiler::target::word Sentinel_InstanceSize = 0x8; static constexpr dart::compiler::target::word SingleTargetCache_InstanceSize = 0x20; static constexpr dart::compiler::target::word StackTrace_InstanceSize = 0x28; static constexpr dart::compiler::target::word SuspendState_HeaderSize = 0x38; -static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x28; +static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x30; static constexpr dart::compiler::target::word String_InstanceSize = 0x10; static constexpr dart::compiler::target::word SubtypeTestCache_InstanceSize = 0x18; static constexpr dart::compiler::target::word LoadingUnit_InstanceSize = 0x28; @@ -9136,6 +9168,8 @@ static constexpr dart::compiler::target::word AOT_Coroutine_stack_base_offset = 0xc; static constexpr dart::compiler::target::word AOT_Coroutine_stack_limit_offset = 0x10; +static constexpr dart::compiler::target::word + AOT_Coroutine_top_exit_frame_offset = 0x14; static constexpr dart::compiler::target::word AOT_Code_entry_point_offset[] = {0x4, 0xc, 0x8, 0x10}; static constexpr dart::compiler::target::word AOT_Thread_write_barrier_wrappers_thread_offset[] = { @@ -9201,7 +9235,7 @@ static constexpr dart::compiler::target::word AOT_Sentinel_InstanceSize = 0x4; static constexpr dart::compiler::target::word AOT_SingleTargetCache_InstanceSize = 0x14; static constexpr dart::compiler::target::word AOT_StackTrace_InstanceSize = 0x14; static constexpr dart::compiler::target::word AOT_SuspendState_HeaderSize = 0x18; -static constexpr dart::compiler::target::word AOT_Coroutine_InstanceSize = 0x14; +static constexpr dart::compiler::target::word AOT_Coroutine_InstanceSize = 0x18; static constexpr dart::compiler::target::word AOT_String_InstanceSize = 0xc; static constexpr dart::compiler::target::word AOT_SubtypeTestCache_InstanceSize = 0x10; static constexpr dart::compiler::target::word AOT_LoadingUnit_InstanceSize = 0x14; @@ -9688,6 +9722,8 @@ static constexpr dart::compiler::target::word AOT_Coroutine_stack_base_offset = 0x18; static constexpr dart::compiler::target::word AOT_Coroutine_stack_limit_offset = 0x20; +static constexpr dart::compiler::target::word + AOT_Coroutine_top_exit_frame_offset = 0x28; static constexpr dart::compiler::target::word AOT_Code_entry_point_offset[] = {0x8, 0x18, 0x10, 0x20}; static constexpr dart::compiler::target::word AOT_Thread_write_barrier_wrappers_thread_offset[] = { @@ -9753,7 +9789,7 @@ static constexpr dart::compiler::target::word AOT_Sentinel_InstanceSize = 0x8; static constexpr dart::compiler::target::word AOT_SingleTargetCache_InstanceSize = 0x20; static constexpr dart::compiler::target::word AOT_StackTrace_InstanceSize = 0x28; static constexpr dart::compiler::target::word AOT_SuspendState_HeaderSize = 0x30; -static constexpr dart::compiler::target::word AOT_Coroutine_InstanceSize = 0x28; +static constexpr dart::compiler::target::word AOT_Coroutine_InstanceSize = 0x30; static constexpr dart::compiler::target::word AOT_String_InstanceSize = 0x10; static constexpr dart::compiler::target::word AOT_SubtypeTestCache_InstanceSize = 0x18; static constexpr dart::compiler::target::word AOT_LoadingUnit_InstanceSize = 0x28; @@ -10245,6 +10281,8 @@ static constexpr dart::compiler::target::word AOT_Coroutine_stack_base_offset = 0x18; static constexpr dart::compiler::target::word AOT_Coroutine_stack_limit_offset = 0x20; +static constexpr dart::compiler::target::word + AOT_Coroutine_top_exit_frame_offset = 0x28; static constexpr dart::compiler::target::word AOT_Code_entry_point_offset[] = {0x8, 0x18, 0x10, 0x20}; static constexpr dart::compiler::target::word AOT_Thread_write_barrier_wrappers_thread_offset[] = { @@ -10312,7 +10350,7 @@ static constexpr dart::compiler::target::word AOT_Sentinel_InstanceSize = 0x8; static constexpr dart::compiler::target::word AOT_SingleTargetCache_InstanceSize = 0x20; static constexpr dart::compiler::target::word AOT_StackTrace_InstanceSize = 0x28; static constexpr dart::compiler::target::word AOT_SuspendState_HeaderSize = 0x30; -static constexpr dart::compiler::target::word AOT_Coroutine_InstanceSize = 0x28; +static constexpr dart::compiler::target::word AOT_Coroutine_InstanceSize = 0x30; static constexpr dart::compiler::target::word AOT_String_InstanceSize = 0x10; static constexpr dart::compiler::target::word AOT_SubtypeTestCache_InstanceSize = 0x18; static constexpr dart::compiler::target::word AOT_LoadingUnit_InstanceSize = 0x28; @@ -10803,6 +10841,8 @@ static constexpr dart::compiler::target::word AOT_Coroutine_stack_base_offset = 0x10; static constexpr dart::compiler::target::word AOT_Coroutine_stack_limit_offset = 0x18; +static constexpr dart::compiler::target::word + AOT_Coroutine_top_exit_frame_offset = 0x20; static constexpr dart::compiler::target::word AOT_Code_entry_point_offset[] = {0x8, 0x18, 0x10, 0x20}; static constexpr dart::compiler::target::word AOT_Thread_write_barrier_wrappers_thread_offset[] = { @@ -10868,7 +10908,7 @@ static constexpr dart::compiler::target::word AOT_Sentinel_InstanceSize = 0x8; static constexpr dart::compiler::target::word AOT_SingleTargetCache_InstanceSize = 0x20; static constexpr dart::compiler::target::word AOT_StackTrace_InstanceSize = 0x18; static constexpr dart::compiler::target::word AOT_SuspendState_HeaderSize = 0x28; -static constexpr dart::compiler::target::word AOT_Coroutine_InstanceSize = 0x20; +static constexpr dart::compiler::target::word AOT_Coroutine_InstanceSize = 0x28; static constexpr dart::compiler::target::word AOT_String_InstanceSize = 0x10; static constexpr dart::compiler::target::word AOT_SubtypeTestCache_InstanceSize = 0x18; static constexpr dart::compiler::target::word AOT_LoadingUnit_InstanceSize = 0x20; @@ -11356,6 +11396,8 @@ static constexpr dart::compiler::target::word AOT_Coroutine_stack_base_offset = 0x10; static constexpr dart::compiler::target::word AOT_Coroutine_stack_limit_offset = 0x18; +static constexpr dart::compiler::target::word + AOT_Coroutine_top_exit_frame_offset = 0x20; static constexpr dart::compiler::target::word AOT_Code_entry_point_offset[] = {0x8, 0x18, 0x10, 0x20}; static constexpr dart::compiler::target::word AOT_Thread_write_barrier_wrappers_thread_offset[] = { @@ -11423,7 +11465,7 @@ static constexpr dart::compiler::target::word AOT_Sentinel_InstanceSize = 0x8; static constexpr dart::compiler::target::word AOT_SingleTargetCache_InstanceSize = 0x20; static constexpr dart::compiler::target::word AOT_StackTrace_InstanceSize = 0x18; static constexpr dart::compiler::target::word AOT_SuspendState_HeaderSize = 0x28; -static constexpr dart::compiler::target::word AOT_Coroutine_InstanceSize = 0x20; +static constexpr dart::compiler::target::word AOT_Coroutine_InstanceSize = 0x28; static constexpr dart::compiler::target::word AOT_String_InstanceSize = 0x10; static constexpr dart::compiler::target::word AOT_SubtypeTestCache_InstanceSize = 0x18; static constexpr dart::compiler::target::word AOT_LoadingUnit_InstanceSize = 0x20; @@ -11910,6 +11952,8 @@ static constexpr dart::compiler::target::word AOT_Coroutine_stack_base_offset = 0xc; static constexpr dart::compiler::target::word AOT_Coroutine_stack_limit_offset = 0x10; +static constexpr dart::compiler::target::word + AOT_Coroutine_top_exit_frame_offset = 0x14; static constexpr dart::compiler::target::word AOT_Code_entry_point_offset[] = {0x4, 0xc, 0x8, 0x10}; static constexpr dart::compiler::target::word AOT_Thread_write_barrier_wrappers_thread_offset[] = { @@ -11976,7 +12020,7 @@ static constexpr dart::compiler::target::word AOT_Sentinel_InstanceSize = 0x4; static constexpr dart::compiler::target::word AOT_SingleTargetCache_InstanceSize = 0x14; static constexpr dart::compiler::target::word AOT_StackTrace_InstanceSize = 0x14; static constexpr dart::compiler::target::word AOT_SuspendState_HeaderSize = 0x18; -static constexpr dart::compiler::target::word AOT_Coroutine_InstanceSize = 0x14; +static constexpr dart::compiler::target::word AOT_Coroutine_InstanceSize = 0x18; static constexpr dart::compiler::target::word AOT_String_InstanceSize = 0xc; static constexpr dart::compiler::target::word AOT_SubtypeTestCache_InstanceSize = 0x10; static constexpr dart::compiler::target::word AOT_LoadingUnit_InstanceSize = 0x14; @@ -12463,6 +12507,8 @@ static constexpr dart::compiler::target::word AOT_Coroutine_stack_base_offset = 0x18; static constexpr dart::compiler::target::word AOT_Coroutine_stack_limit_offset = 0x20; +static constexpr dart::compiler::target::word + AOT_Coroutine_top_exit_frame_offset = 0x28; static constexpr dart::compiler::target::word AOT_Code_entry_point_offset[] = {0x8, 0x18, 0x10, 0x20}; static constexpr dart::compiler::target::word AOT_Thread_write_barrier_wrappers_thread_offset[] = { @@ -12529,7 +12575,7 @@ static constexpr dart::compiler::target::word AOT_Sentinel_InstanceSize = 0x8; static constexpr dart::compiler::target::word AOT_SingleTargetCache_InstanceSize = 0x20; static constexpr dart::compiler::target::word AOT_StackTrace_InstanceSize = 0x28; static constexpr dart::compiler::target::word AOT_SuspendState_HeaderSize = 0x30; -static constexpr dart::compiler::target::word AOT_Coroutine_InstanceSize = 0x28; +static constexpr dart::compiler::target::word AOT_Coroutine_InstanceSize = 0x30; static constexpr dart::compiler::target::word AOT_String_InstanceSize = 0x10; static constexpr dart::compiler::target::word AOT_SubtypeTestCache_InstanceSize = 0x18; static constexpr dart::compiler::target::word AOT_LoadingUnit_InstanceSize = 0x28; @@ -13011,6 +13057,8 @@ static constexpr dart::compiler::target::word AOT_Coroutine_stack_base_offset = 0xc; static constexpr dart::compiler::target::word AOT_Coroutine_stack_limit_offset = 0x10; +static constexpr dart::compiler::target::word + AOT_Coroutine_top_exit_frame_offset = 0x14; static constexpr dart::compiler::target::word AOT_Code_entry_point_offset[] = {0x4, 0xc, 0x8, 0x10}; static constexpr dart::compiler::target::word AOT_Thread_write_barrier_wrappers_thread_offset[] = { @@ -13076,7 +13124,7 @@ static constexpr dart::compiler::target::word AOT_Sentinel_InstanceSize = 0x4; static constexpr dart::compiler::target::word AOT_SingleTargetCache_InstanceSize = 0x14; static constexpr dart::compiler::target::word AOT_StackTrace_InstanceSize = 0x14; static constexpr dart::compiler::target::word AOT_SuspendState_HeaderSize = 0x18; -static constexpr dart::compiler::target::word AOT_Coroutine_InstanceSize = 0x14; +static constexpr dart::compiler::target::word AOT_Coroutine_InstanceSize = 0x18; static constexpr dart::compiler::target::word AOT_String_InstanceSize = 0xc; static constexpr dart::compiler::target::word AOT_SubtypeTestCache_InstanceSize = 0x10; static constexpr dart::compiler::target::word AOT_LoadingUnit_InstanceSize = 0x14; @@ -13558,6 +13606,8 @@ static constexpr dart::compiler::target::word AOT_Coroutine_stack_base_offset = 0x18; static constexpr dart::compiler::target::word AOT_Coroutine_stack_limit_offset = 0x20; +static constexpr dart::compiler::target::word + AOT_Coroutine_top_exit_frame_offset = 0x28; static constexpr dart::compiler::target::word AOT_Code_entry_point_offset[] = {0x8, 0x18, 0x10, 0x20}; static constexpr dart::compiler::target::word AOT_Thread_write_barrier_wrappers_thread_offset[] = { @@ -13623,7 +13673,7 @@ static constexpr dart::compiler::target::word AOT_Sentinel_InstanceSize = 0x8; static constexpr dart::compiler::target::word AOT_SingleTargetCache_InstanceSize = 0x20; static constexpr dart::compiler::target::word AOT_StackTrace_InstanceSize = 0x28; static constexpr dart::compiler::target::word AOT_SuspendState_HeaderSize = 0x30; -static constexpr dart::compiler::target::word AOT_Coroutine_InstanceSize = 0x28; +static constexpr dart::compiler::target::word AOT_Coroutine_InstanceSize = 0x30; static constexpr dart::compiler::target::word AOT_String_InstanceSize = 0x10; static constexpr dart::compiler::target::word AOT_SubtypeTestCache_InstanceSize = 0x18; static constexpr dart::compiler::target::word AOT_LoadingUnit_InstanceSize = 0x28; @@ -14110,6 +14160,8 @@ static constexpr dart::compiler::target::word AOT_Coroutine_stack_base_offset = 0x18; static constexpr dart::compiler::target::word AOT_Coroutine_stack_limit_offset = 0x20; +static constexpr dart::compiler::target::word + AOT_Coroutine_top_exit_frame_offset = 0x28; static constexpr dart::compiler::target::word AOT_Code_entry_point_offset[] = {0x8, 0x18, 0x10, 0x20}; static constexpr dart::compiler::target::word AOT_Thread_write_barrier_wrappers_thread_offset[] = { @@ -14177,7 +14229,7 @@ static constexpr dart::compiler::target::word AOT_Sentinel_InstanceSize = 0x8; static constexpr dart::compiler::target::word AOT_SingleTargetCache_InstanceSize = 0x20; static constexpr dart::compiler::target::word AOT_StackTrace_InstanceSize = 0x28; static constexpr dart::compiler::target::word AOT_SuspendState_HeaderSize = 0x30; -static constexpr dart::compiler::target::word AOT_Coroutine_InstanceSize = 0x28; +static constexpr dart::compiler::target::word AOT_Coroutine_InstanceSize = 0x30; static constexpr dart::compiler::target::word AOT_String_InstanceSize = 0x10; static constexpr dart::compiler::target::word AOT_SubtypeTestCache_InstanceSize = 0x18; static constexpr dart::compiler::target::word AOT_LoadingUnit_InstanceSize = 0x28; @@ -14660,6 +14712,8 @@ static constexpr dart::compiler::target::word AOT_Coroutine_stack_base_offset = 0x10; static constexpr dart::compiler::target::word AOT_Coroutine_stack_limit_offset = 0x18; +static constexpr dart::compiler::target::word + AOT_Coroutine_top_exit_frame_offset = 0x20; static constexpr dart::compiler::target::word AOT_Code_entry_point_offset[] = {0x8, 0x18, 0x10, 0x20}; static constexpr dart::compiler::target::word AOT_Thread_write_barrier_wrappers_thread_offset[] = { @@ -14725,7 +14779,7 @@ static constexpr dart::compiler::target::word AOT_Sentinel_InstanceSize = 0x8; static constexpr dart::compiler::target::word AOT_SingleTargetCache_InstanceSize = 0x20; static constexpr dart::compiler::target::word AOT_StackTrace_InstanceSize = 0x18; static constexpr dart::compiler::target::word AOT_SuspendState_HeaderSize = 0x28; -static constexpr dart::compiler::target::word AOT_Coroutine_InstanceSize = 0x20; +static constexpr dart::compiler::target::word AOT_Coroutine_InstanceSize = 0x28; static constexpr dart::compiler::target::word AOT_String_InstanceSize = 0x10; static constexpr dart::compiler::target::word AOT_SubtypeTestCache_InstanceSize = 0x18; static constexpr dart::compiler::target::word AOT_LoadingUnit_InstanceSize = 0x20; @@ -15208,6 +15262,8 @@ static constexpr dart::compiler::target::word AOT_Coroutine_stack_base_offset = 0x10; static constexpr dart::compiler::target::word AOT_Coroutine_stack_limit_offset = 0x18; +static constexpr dart::compiler::target::word + AOT_Coroutine_top_exit_frame_offset = 0x20; static constexpr dart::compiler::target::word AOT_Code_entry_point_offset[] = {0x8, 0x18, 0x10, 0x20}; static constexpr dart::compiler::target::word AOT_Thread_write_barrier_wrappers_thread_offset[] = { @@ -15275,7 +15331,7 @@ static constexpr dart::compiler::target::word AOT_Sentinel_InstanceSize = 0x8; static constexpr dart::compiler::target::word AOT_SingleTargetCache_InstanceSize = 0x20; static constexpr dart::compiler::target::word AOT_StackTrace_InstanceSize = 0x18; static constexpr dart::compiler::target::word AOT_SuspendState_HeaderSize = 0x28; -static constexpr dart::compiler::target::word AOT_Coroutine_InstanceSize = 0x20; +static constexpr dart::compiler::target::word AOT_Coroutine_InstanceSize = 0x28; static constexpr dart::compiler::target::word AOT_String_InstanceSize = 0x10; static constexpr dart::compiler::target::word AOT_SubtypeTestCache_InstanceSize = 0x18; static constexpr dart::compiler::target::word AOT_LoadingUnit_InstanceSize = 0x20; @@ -15757,6 +15813,8 @@ static constexpr dart::compiler::target::word AOT_Coroutine_stack_base_offset = 0xc; static constexpr dart::compiler::target::word AOT_Coroutine_stack_limit_offset = 0x10; +static constexpr dart::compiler::target::word + AOT_Coroutine_top_exit_frame_offset = 0x14; static constexpr dart::compiler::target::word AOT_Code_entry_point_offset[] = {0x4, 0xc, 0x8, 0x10}; static constexpr dart::compiler::target::word AOT_Thread_write_barrier_wrappers_thread_offset[] = { @@ -15823,7 +15881,7 @@ static constexpr dart::compiler::target::word AOT_Sentinel_InstanceSize = 0x4; static constexpr dart::compiler::target::word AOT_SingleTargetCache_InstanceSize = 0x14; static constexpr dart::compiler::target::word AOT_StackTrace_InstanceSize = 0x14; static constexpr dart::compiler::target::word AOT_SuspendState_HeaderSize = 0x18; -static constexpr dart::compiler::target::word AOT_Coroutine_InstanceSize = 0x14; +static constexpr dart::compiler::target::word AOT_Coroutine_InstanceSize = 0x18; static constexpr dart::compiler::target::word AOT_String_InstanceSize = 0xc; static constexpr dart::compiler::target::word AOT_SubtypeTestCache_InstanceSize = 0x10; static constexpr dart::compiler::target::word AOT_LoadingUnit_InstanceSize = 0x14; @@ -16305,6 +16363,8 @@ static constexpr dart::compiler::target::word AOT_Coroutine_stack_base_offset = 0x18; static constexpr dart::compiler::target::word AOT_Coroutine_stack_limit_offset = 0x20; +static constexpr dart::compiler::target::word + AOT_Coroutine_top_exit_frame_offset = 0x28; static constexpr dart::compiler::target::word AOT_Code_entry_point_offset[] = {0x8, 0x18, 0x10, 0x20}; static constexpr dart::compiler::target::word AOT_Thread_write_barrier_wrappers_thread_offset[] = { @@ -16371,7 +16431,7 @@ static constexpr dart::compiler::target::word AOT_Sentinel_InstanceSize = 0x8; static constexpr dart::compiler::target::word AOT_SingleTargetCache_InstanceSize = 0x20; static constexpr dart::compiler::target::word AOT_StackTrace_InstanceSize = 0x28; static constexpr dart::compiler::target::word AOT_SuspendState_HeaderSize = 0x30; -static constexpr dart::compiler::target::word AOT_Coroutine_InstanceSize = 0x28; +static constexpr dart::compiler::target::word AOT_Coroutine_InstanceSize = 0x30; static constexpr dart::compiler::target::word AOT_String_InstanceSize = 0x10; static constexpr dart::compiler::target::word AOT_SubtypeTestCache_InstanceSize = 0x18; static constexpr dart::compiler::target::word AOT_LoadingUnit_InstanceSize = 0x28; diff --git a/runtime/vm/compiler/runtime_offsets_list.h b/runtime/vm/compiler/runtime_offsets_list.h index 87af21c268aa..04b407d05286 100644 --- a/runtime/vm/compiler/runtime_offsets_list.h +++ b/runtime/vm/compiler/runtime_offsets_list.h @@ -404,6 +404,7 @@ FIELD(Coroutine, entry_offset) \ FIELD(Coroutine, stack_base_offset) \ FIELD(Coroutine, stack_limit_offset) \ + FIELD(Coroutine, top_exit_frame_offset) \ RANGE(Code, entry_point_offset, CodeEntryKind, CodeEntryKind::kNormal, \ CodeEntryKind::kMonomorphicUnchecked, \ [](CodeEntryKind value) { return true; }) \ diff --git a/runtime/vm/compiler/stub_code_compiler.cc b/runtime/vm/compiler/stub_code_compiler.cc index 1196e48c9da6..41864c4b04a9 100644 --- a/runtime/vm/compiler/stub_code_compiler.cc +++ b/runtime/vm/compiler/stub_code_compiler.cc @@ -3232,6 +3232,22 @@ void StubCodeCompiler::GenerateSubtypeTestCacheSearch( } #endif +void StubCodeCompiler::GenerateCoroutineEntryStub() { + const Register kCoroutine = CoroutineEntryABI::kCoroutineReg; + __ AddImmediate(FPREG, 0); + __ EnterStubFrame(); + __ movq(Address(THR, Thread::top_exit_frame_info_offset()), FPREG); + __ StoreFieldToOffset(FPREG, kCoroutine, Coroutine::top_exit_frame_offset()); + __ LoadCompressedFieldFromOffset(FUNCTION_REG, kCoroutine, Coroutine::entry_offset()); + if (!FLAG_precompiled_mode) { + __ LoadCompressedFieldFromOffset(CODE_REG, FUNCTION_REG, Function::code_offset()); + __ LoadImmediate(ARGS_DESC_REG, 0); + } + __ Call(compiler::FieldAddress(FUNCTION_REG, Function::entry_point_offset())); + __ LeaveStubFrame(); + __ Ret(); +} + // See comment on [GenerateSubtypeNTestCacheStub]. void StubCodeCompiler::GenerateSubtype1TestCacheStub() { GenerateSubtypeNTestCacheStub(assembler, 1); diff --git a/runtime/vm/constants_x64.h b/runtime/vm/constants_x64.h index 235f1e327009..7b6a9d84a6fd 100644 --- a/runtime/vm/constants_x64.h +++ b/runtime/vm/constants_x64.h @@ -388,13 +388,17 @@ struct SuspendStubABI { static constexpr intptr_t kResumePcDistance = 5; }; -struct CoroutineInitializeABI { +struct CoroutineEntryABI { static constexpr Register kCoroutineReg = RDI; }; +struct CoroutineInitializeABI { + static constexpr Register kCoroutineReg = CoroutineEntryABI::kCoroutineReg; +}; + struct CoroutineForkABI { - static constexpr Register kCallerCoroutineReg = RDI; - static constexpr Register kForkedCoroutineReg = RSI; + static constexpr Register kCallerCoroutineReg = RSI; + static constexpr Register kForkedCoroutineReg = CoroutineEntryABI::kCoroutineReg; static constexpr Register kStackLimitReg = RDX; }; diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc index 97c04185fbef..f969f20b8c92 100644 --- a/runtime/vm/object.cc +++ b/runtime/vm/object.cc @@ -26634,6 +26634,7 @@ CoroutinePtr Coroutine::New(void** stack_base, uintptr_t stack_size, FunctionPtr NoSafepointScope no_safepoint; coroutine.StoreNonPointer(&coroutine.untag()->stack_base_, (uword)stack_base); coroutine.StoreNonPointer(&coroutine.untag()->stack_limit_, (uword)stack_base - stack_size); + coroutine.StoreNonPointer(&coroutine.untag()->top_exit_frame_, 0); coroutine.StoreCompressedPointer(&coroutine.untag()->entry_, entry); coroutine.StoreCompressedPointer(&coroutine.untag()->caller_, coroutine.ptr()); return coroutine.ptr(); diff --git a/runtime/vm/object.h b/runtime/vm/object.h index 31b9fb7d2ccc..db1034ef8a90 100644 --- a/runtime/vm/object.h +++ b/runtime/vm/object.h @@ -12723,6 +12723,11 @@ class Coroutine : public Instance { return OFFSET_OF(UntaggedCoroutine, stack_limit_); } + uword top_exit_frame() const { return untag()->top_exit_frame_; } + static uword top_exit_frame_offset() { + return OFFSET_OF(UntaggedCoroutine, top_exit_frame_); + } + private: FINAL_HEAP_OBJECT_IMPLEMENTATION(Coroutine, Instance); friend class Class; diff --git a/runtime/vm/raw_object.h b/runtime/vm/raw_object.h index 8d5e4917fbfb..f3ce94973b66 100644 --- a/runtime/vm/raw_object.h +++ b/runtime/vm/raw_object.h @@ -3783,6 +3783,7 @@ class UntaggedCoroutine : public UntaggedInstance { CompressedObjectPtr* to_snapshot(Snapshot::Kind kind) { return to(); } uword stack_base_; uword stack_limit_; + uword top_exit_frame_; public: uword stack_base() const { return stack_base_; } uword stack_limit() const { return stack_limit_; } diff --git a/runtime/vm/raw_object_fields.cc b/runtime/vm/raw_object_fields.cc index 92d6b5bf8031..9361fd0e0eea 100644 --- a/runtime/vm/raw_object_fields.cc +++ b/runtime/vm/raw_object_fields.cc @@ -235,7 +235,8 @@ namespace dart { F(Coroutine, caller_) \ F(Coroutine, entry_) \ F(Coroutine, stack_base_) \ - F(Coroutine, stack_limit_) + F(Coroutine, stack_limit_) \ + F(Coroutine, top_exit_frame_) #define AOT_CLASSES_AND_FIELDS(F) diff --git a/runtime/vm/stack_frame.cc b/runtime/vm/stack_frame.cc index b89c87e1aa60..c440841c7452 100644 --- a/runtime/vm/stack_frame.cc +++ b/runtime/vm/stack_frame.cc @@ -245,13 +245,20 @@ void StackFrame::VisitObjectPointers(ObjectPointerVisitor* visitor) { } } + OS::Print("pc() = %p\n", (void*)pc()); + OS::Print("sp() = %p\n", (void*)sp()); + OS::Print("fp() = %p\n", (void*)fp()); + OS::Print("maps.IsNull() = %d\n", (int)maps.IsNull()); if (!maps.IsNull()) { // Optimized frames have a stack map. We need to visit the frame based // on the stack map. CompressedStackMaps::Iterator it( maps, global_table); const uint32_t pc_offset = pc() - code_start; - if (it.Find(pc_offset)) { + bool found = it.Find(pc_offset); + OS::Print("code_start = %p\n", (void*)code_start); + OS::Print("stack map found = %d\n", (int)found); + if (found) { ObjectPtr* first = reinterpret_cast(sp()); ObjectPtr* last = reinterpret_cast( fp() + (runtime_frame_layout.first_local_from_fp * kWordSize)); diff --git a/runtime/vm/stub_code_list.h b/runtime/vm/stub_code_list.h index 7297fcf70be7..b12018053a31 100644 --- a/runtime/vm/stub_code_list.h +++ b/runtime/vm/stub_code_list.h @@ -177,6 +177,7 @@ namespace dart { V(SuspendSyncStarAtYield) \ V(AsyncExceptionHandler) \ V(CloneSuspendState) \ + V(CoroutineEntry) \ V(FfiAsyncCallbackSend) \ V(UnknownDartCode) diff --git a/runtime/vm/symbols.h b/runtime/vm/symbols.h index 07e84bac606a..81ea7e380665 100644 --- a/runtime/vm/symbols.h +++ b/runtime/vm/symbols.h @@ -445,6 +445,7 @@ class ObjectPointerVisitor; V(_initAsync, "_initAsync") \ V(_initAsyncStar, "_initAsyncStar") \ V(_initSyncStar, "_initSyncStar") \ + V(_coroutineEntry, "_coroutineEntry") \ V(_coroutineInitialize, "_coroutineInitialize") \ V(_coroutineTransfer, "_coroutineTransfer") \ V(_coroutineFork, "_coroutineFork") \ From 98257c7ee45aa49de8766556e7285e0fe09c5e08 Mon Sep 17 00:00:00 2001 From: "anton.bashirov" Date: Fri, 6 Sep 2024 01:38:31 +0400 Subject: [PATCH 26/35] fibers --- runtime/lib/fiber.cc | 2 +- runtime/vm/compiler/backend/il.cc | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/runtime/lib/fiber.cc b/runtime/lib/fiber.cc index 6e533513e507..d84e619e6324 100644 --- a/runtime/lib/fiber.cc +++ b/runtime/lib/fiber.cc @@ -15,7 +15,7 @@ DEFINE_NATIVE_ENTRY(Coroutine_factory, 0, 3) { GET_NON_NULL_NATIVE_ARGUMENT(Closure, entry, arguments->NativeArgAt(2)); intptr_t stack_size = size.Value(); void** stack_base = (void**)((uintptr_t)mmap(0, stack_size * kWordSize, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0)); - memset(stack_base, 0, stack_size); + memset(stack_base, 0, stack_size * kWordSize); return Coroutine::New(stack_base + stack_size , stack_size, Function::Handle(entry.function()).ptr()); } } // namespace dart diff --git a/runtime/vm/compiler/backend/il.cc b/runtime/vm/compiler/backend/il.cc index 80d13cb3b03f..9ea434dd80c3 100644 --- a/runtime/vm/compiler/backend/il.cc +++ b/runtime/vm/compiler/backend/il.cc @@ -8628,7 +8628,6 @@ void CoroutineForkInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ StoreToOffset(kForkedCoroutine, THR, Thread::coroutine_offset()); __ PushRegister(FPREG); - __ pushq(compiler::Address(THR, Thread::top_exit_frame_info_offset())); __ StoreFieldToOffset(SPREG, kCallerCoroutine, Coroutine::stack_base_offset()); __ LoadFieldFromOffset(SPREG, kForkedCoroutine, Coroutine::stack_base_offset()); @@ -8641,7 +8640,7 @@ void CoroutineForkInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ LoadFieldFromOffset(kCallerCoroutine, kForkedCoroutine, Coroutine::caller_offset()); __ LoadFieldFromOffset(SPREG, kCallerCoroutine, Coroutine::stack_base_offset()); - __ popq(compiler::Address(THR, Thread::top_exit_frame_info_offset())); + __ MoveMemoryToMemory(compiler::Address(THR, Thread::top_exit_frame_info_offset()), compiler::Address(kCallerCoroutine, Coroutine::top_exit_frame_offset())); __ PopRegister(FPREG); if (!FLAG_precompiled_mode) __ RestoreCodePointer(); if (FLAG_precompiled_mode) __ movq(PP, compiler::Address(THR, Thread::global_object_pool_offset())); From d2b8fb5c4553ef859ec94ecf4825b25869fad0e8 Mon Sep 17 00:00:00 2001 From: "anton.bashirov" Date: Fri, 6 Sep 2024 02:09:43 +0400 Subject: [PATCH 27/35] fibers --- runtime/vm/compiler/stub_code_compiler.cc | 1 - runtime/vm/profiler.cc | 19 ++++++++++++++++++- runtime/vm/stack_frame.h | 4 ++-- runtime/vm/stub_code.cc | 7 +++++++ runtime/vm/stub_code.h | 3 +++ 5 files changed, 30 insertions(+), 4 deletions(-) diff --git a/runtime/vm/compiler/stub_code_compiler.cc b/runtime/vm/compiler/stub_code_compiler.cc index 41864c4b04a9..83262a8ca25a 100644 --- a/runtime/vm/compiler/stub_code_compiler.cc +++ b/runtime/vm/compiler/stub_code_compiler.cc @@ -3234,7 +3234,6 @@ void StubCodeCompiler::GenerateSubtypeTestCacheSearch( void StubCodeCompiler::GenerateCoroutineEntryStub() { const Register kCoroutine = CoroutineEntryABI::kCoroutineReg; - __ AddImmediate(FPREG, 0); __ EnterStubFrame(); __ movq(Address(THR, Thread::top_exit_frame_info_offset()), FPREG); __ StoreFieldToOffset(FPREG, kCoroutine, Coroutine::top_exit_frame_offset()); diff --git a/runtime/vm/profiler.cc b/runtime/vm/profiler.cc index e033f55a5fb3..49a84b052e58 100644 --- a/runtime/vm/profiler.cc +++ b/runtime/vm/profiler.cc @@ -1062,7 +1062,9 @@ class ProfilerDartStackWalker : public ProfilerStackWalker { const bool is_entry_frame = #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64) StubCode::InInvocationStub(Stack(0)) || - StubCode::InInvocationStub(Stack(1)); + StubCode::InInvocationStub(Stack(1)) || + StubCode::InCoroutineEntryStub(0) || + StubCode::InCoroutineEntryStub(1); #else StubCode::InInvocationStub(reinterpret_cast(lr_)); #endif @@ -1097,6 +1099,21 @@ class ProfilerDartStackWalker : public ProfilerStackWalker { RELEASE_ASSERT( !StubCode::InInvocationStub(reinterpret_cast(pc_))); } + else if (StubCode::InCoroutineEntryStub(reinterpret_cast(pc_))) { + pc_ = nullptr; + fp_ = ExitLink(); + if (fp_ == nullptr) { + break; // End of Dart stack. + } + + // Skip exit frame. + pc_ = CallerPC(); + fp_ = CallerFP(); + + // At least one frame between exit and next entry frame. + RELEASE_ASSERT( + !StubCode::InCoroutineEntryStub(reinterpret_cast(pc_))); + } if (!Append(reinterpret_cast(pc_), reinterpret_cast(fp_))) { break; // Sample is full. diff --git a/runtime/vm/stack_frame.h b/runtime/vm/stack_frame.h index 07a00a1b32e2..42a8bdac4be6 100644 --- a/runtime/vm/stack_frame.h +++ b/runtime/vm/stack_frame.h @@ -193,7 +193,7 @@ class ExitFrame : public StackFrame { // dart code. class EntryFrame : public StackFrame { public: - bool IsValid() const { return StubCode::InInvocationStub(pc()); } + bool IsValid() const { return StubCode::InInvocationStub(pc()) || StubCode::InCoroutineEntryStub(pc()); } bool IsDartFrame(bool validate = true) const { return false; } bool IsStubFrame() const { return false; } bool IsEntryFrame() const { return true; } @@ -264,7 +264,7 @@ class StackFrameIterator { } const uword pc = *(reinterpret_cast(sp_ + (kSavedPcSlotFromSp * kWordSize))); - return !StubCode::InInvocationStub(pc); + return !StubCode::InInvocationStub(pc) && !StubCode::InCoroutineEntryStub(pc); } // Get next non entry/exit frame in the set (assumes a next frame exists). diff --git a/runtime/vm/stub_code.cc b/runtime/vm/stub_code.cc index dd6181eec389..4a41629e6025 100644 --- a/runtime/vm/stub_code.cc +++ b/runtime/vm/stub_code.cc @@ -136,6 +136,13 @@ bool StubCode::InInvocationStub(uword pc) { return (pc >= entry) && (pc < (entry + size)); } +bool StubCode::InCoroutineEntryStub(uword pc) { + ASSERT(HasBeenInitialized()); + uword entry = StubCode::CoroutineEntry().EntryPoint(); + uword size = StubCode::CoroutineEntrySize(); + return (pc >= entry) && (pc < (entry + size)); +} + bool StubCode::InJumpToFrameStub(uword pc) { ASSERT(HasBeenInitialized()); uword entry = StubCode::JumpToFrame().EntryPoint(); diff --git a/runtime/vm/stub_code.h b/runtime/vm/stub_code.h index 5430b0e0cc36..e506d8de2c0a 100644 --- a/runtime/vm/stub_code.h +++ b/runtime/vm/stub_code.h @@ -49,6 +49,9 @@ class StubCode : public AllStatic { // transitioning into dart code. static bool InInvocationStub(uword pc); + // Check if specified pc is in the dart coroutine entry stub + static bool InCoroutineEntryStub(uword pc); + // Check if the specified pc is in the jump to frame stub. static bool InJumpToFrameStub(uword pc); From 422a3c8f710755c5f2918acbdadbd8b6987e8c57 Mon Sep 17 00:00:00 2001 From: "anton.bashirov" Date: Fri, 6 Sep 2024 17:29:09 +0400 Subject: [PATCH 28/35] fibers --- runtime/vm/compiler/backend/il.cc | 8 +++++++- runtime/vm/compiler/stub_code_compiler.cc | 2 -- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/runtime/vm/compiler/backend/il.cc b/runtime/vm/compiler/backend/il.cc index 9ea434dd80c3..2ca9f1ca4dbf 100644 --- a/runtime/vm/compiler/backend/il.cc +++ b/runtime/vm/compiler/backend/il.cc @@ -8578,9 +8578,12 @@ void CoroutineInitializeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ set_constant_pool_allowed(false); __ EnterDartFrame(0); + __ StoreFieldToOffset(FPREG, kCoroutine, Coroutine::top_exit_frame_offset()); + __ movq(compiler::Address(THR, Thread::top_exit_frame_info_offset()), FPREG); + __ LoadFieldFromOffset(SPREG, kCoroutine, Coroutine::stack_base_offset()); __ PushRegister(FPREG); - __ pushq(compiler::Address(THR, Thread::top_exit_frame_info_offset())); + __ pushq(compiler::Address(THR, Thread::top_exit_frame_info_offset())); __ PushRegister(kCoroutine); compiler->EmitCallToStub(StubCode::CoroutineEntry()); @@ -8627,6 +8630,9 @@ void CoroutineForkInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ StoreToOffset(kStackLimit, THR, Thread::stack_limit_offset()); __ StoreToOffset(kForkedCoroutine, THR, Thread::coroutine_offset()); + __ StoreFieldToOffset(FPREG, kForkedCoroutine, Coroutine::top_exit_frame_offset()); + __ movq(compiler::Address(THR, Thread::top_exit_frame_info_offset()), FPREG); + __ PushRegister(FPREG); __ StoreFieldToOffset(SPREG, kCallerCoroutine, Coroutine::stack_base_offset()); diff --git a/runtime/vm/compiler/stub_code_compiler.cc b/runtime/vm/compiler/stub_code_compiler.cc index 83262a8ca25a..15991dffd868 100644 --- a/runtime/vm/compiler/stub_code_compiler.cc +++ b/runtime/vm/compiler/stub_code_compiler.cc @@ -3235,8 +3235,6 @@ void StubCodeCompiler::GenerateSubtypeTestCacheSearch( void StubCodeCompiler::GenerateCoroutineEntryStub() { const Register kCoroutine = CoroutineEntryABI::kCoroutineReg; __ EnterStubFrame(); - __ movq(Address(THR, Thread::top_exit_frame_info_offset()), FPREG); - __ StoreFieldToOffset(FPREG, kCoroutine, Coroutine::top_exit_frame_offset()); __ LoadCompressedFieldFromOffset(FUNCTION_REG, kCoroutine, Coroutine::entry_offset()); if (!FLAG_precompiled_mode) { __ LoadCompressedFieldFromOffset(CODE_REG, FUNCTION_REG, Function::code_offset()); From c64e9ba17a4faff87cd9d75cca3c745ccb540989 Mon Sep 17 00:00:00 2001 From: "anton.bashirov" Date: Fri, 6 Sep 2024 18:27:15 +0400 Subject: [PATCH 29/35] fibers --- runtime/vm/compiler/backend/il.cc | 10 ---------- runtime/vm/compiler/backend/il_printer.cc | 2 +- runtime/vm/compiler/frontend/kernel_to_il.cc | 20 ++++++++++---------- runtime/vm/profiler.cc | 19 +------------------ runtime/vm/stack_frame.h | 4 ++-- runtime/vm/stub_code.cc | 7 ------- runtime/vm/stub_code.h | 3 --- 7 files changed, 14 insertions(+), 51 deletions(-) diff --git a/runtime/vm/compiler/backend/il.cc b/runtime/vm/compiler/backend/il.cc index 2ca9f1ca4dbf..d201814e1150 100644 --- a/runtime/vm/compiler/backend/il.cc +++ b/runtime/vm/compiler/backend/il.cc @@ -8578,18 +8578,13 @@ void CoroutineInitializeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ set_constant_pool_allowed(false); __ EnterDartFrame(0); - __ StoreFieldToOffset(FPREG, kCoroutine, Coroutine::top_exit_frame_offset()); - __ movq(compiler::Address(THR, Thread::top_exit_frame_info_offset()), FPREG); - __ LoadFieldFromOffset(SPREG, kCoroutine, Coroutine::stack_base_offset()); __ PushRegister(FPREG); - __ pushq(compiler::Address(THR, Thread::top_exit_frame_info_offset())); __ PushRegister(kCoroutine); compiler->EmitCallToStub(StubCode::CoroutineEntry()); __ PopRegister(kCoroutine); - __ popq(compiler::Address(THR, Thread::top_exit_frame_info_offset())); __ PopRegister(FPREG); if (!FLAG_precompiled_mode) __ RestoreCodePointer(); if (FLAG_precompiled_mode) __ movq(PP, compiler::Address(THR, Thread::global_object_pool_offset())); @@ -8630,9 +8625,6 @@ void CoroutineForkInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ StoreToOffset(kStackLimit, THR, Thread::stack_limit_offset()); __ StoreToOffset(kForkedCoroutine, THR, Thread::coroutine_offset()); - __ StoreFieldToOffset(FPREG, kForkedCoroutine, Coroutine::top_exit_frame_offset()); - __ movq(compiler::Address(THR, Thread::top_exit_frame_info_offset()), FPREG); - __ PushRegister(FPREG); __ StoreFieldToOffset(SPREG, kCallerCoroutine, Coroutine::stack_base_offset()); @@ -8646,7 +8638,6 @@ void CoroutineForkInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ LoadFieldFromOffset(kCallerCoroutine, kForkedCoroutine, Coroutine::caller_offset()); __ LoadFieldFromOffset(SPREG, kCallerCoroutine, Coroutine::stack_base_offset()); - __ MoveMemoryToMemory(compiler::Address(THR, Thread::top_exit_frame_info_offset()), compiler::Address(kCallerCoroutine, Coroutine::top_exit_frame_offset())); __ PopRegister(FPREG); if (!FLAG_precompiled_mode) __ RestoreCodePointer(); if (FLAG_precompiled_mode) __ movq(PP, compiler::Address(THR, Thread::global_object_pool_offset())); @@ -8679,7 +8670,6 @@ void CoroutineTransferInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ StoreFieldToOffset(SPREG, kFromCoroutine, Coroutine::stack_base_offset()); __ LoadFieldFromOffset(SPREG, kToCoroutine, Coroutine::stack_base_offset()); - __ MoveMemoryToMemory(compiler::Address(THR, Thread::top_exit_frame_info_offset()), compiler::Address(kToCoroutine, Coroutine::top_exit_frame_offset())); __ PopRegister(FPREG); if (!FLAG_precompiled_mode) __ RestoreCodePointer(); if (FLAG_precompiled_mode) __ movq(PP, compiler::Address(THR, Thread::global_object_pool_offset())); diff --git a/runtime/vm/compiler/backend/il_printer.cc b/runtime/vm/compiler/backend/il_printer.cc index 753cb3e7dae7..147df5536ca6 100644 --- a/runtime/vm/compiler/backend/il_printer.cc +++ b/runtime/vm/compiler/backend/il_printer.cc @@ -1579,7 +1579,7 @@ void Call1ArgStubInstr::PrintOperandsTo(BaseTextBuffer* f) const { void CoroutineInitializeInstr::PrintOperandsTo(BaseTextBuffer* f) const { const char* name = "CoroutineInitialize"; f->Printf("%s(", name); - root()->PrintTo(f); + value()->PrintTo(f); f->AddString(")"); } diff --git a/runtime/vm/compiler/frontend/kernel_to_il.cc b/runtime/vm/compiler/frontend/kernel_to_il.cc index 381e80494587..6f978a3aa0f0 100644 --- a/runtime/vm/compiler/frontend/kernel_to_il.cc +++ b/runtime/vm/compiler/frontend/kernel_to_il.cc @@ -1921,17 +1921,17 @@ FlowGraph* FlowGraphBuilder::BuildGraphOfRecognizedMethod( body += NullConstant(); break; } - case MethodRecognizer::kCoroutineTransfer: { + case MethodRecognizer::kCoroutineFork: { body += LoadLocal(parsed_function_->RawParameterVariable(0)); body += LoadLocal(parsed_function_->RawParameterVariable(1)); - body += CoroutineTransfer(); + body += CoroutineFork(); body += NullConstant(); break; } - case MethodRecognizer::kCoroutineFork: { + case MethodRecognizer::kCoroutineTransfer: { body += LoadLocal(parsed_function_->RawParameterVariable(0)); body += LoadLocal(parsed_function_->RawParameterVariable(1)); - body += CoroutineFork(); + body += CoroutineTransfer(); body += NullConstant(); break; } @@ -4771,18 +4771,18 @@ Fragment FlowGraphBuilder::CoroutineInitialize() { return Fragment(instr); } -Fragment FlowGraphBuilder::CoroutineTransfer() { - CoroutineTransferInstr* instr = - new (Z) CoroutineTransferInstr(Pop(), Pop(), GetNextDeoptId()); - return Fragment(instr); -} - Fragment FlowGraphBuilder::CoroutineFork() { CoroutineForkInstr* instr = new (Z) CoroutineForkInstr(Pop(), Pop(), GetNextDeoptId()); return Fragment(instr); } +Fragment FlowGraphBuilder::CoroutineTransfer() { + CoroutineTransferInstr* instr = + new (Z) CoroutineTransferInstr(Pop(), Pop(), GetNextDeoptId()); + return Fragment(instr); +} + Fragment FlowGraphBuilder::Suspend(TokenPosition position, SuspendInstr::StubId stub_id) { Value* type_args = diff --git a/runtime/vm/profiler.cc b/runtime/vm/profiler.cc index 49a84b052e58..e033f55a5fb3 100644 --- a/runtime/vm/profiler.cc +++ b/runtime/vm/profiler.cc @@ -1062,9 +1062,7 @@ class ProfilerDartStackWalker : public ProfilerStackWalker { const bool is_entry_frame = #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64) StubCode::InInvocationStub(Stack(0)) || - StubCode::InInvocationStub(Stack(1)) || - StubCode::InCoroutineEntryStub(0) || - StubCode::InCoroutineEntryStub(1); + StubCode::InInvocationStub(Stack(1)); #else StubCode::InInvocationStub(reinterpret_cast(lr_)); #endif @@ -1099,21 +1097,6 @@ class ProfilerDartStackWalker : public ProfilerStackWalker { RELEASE_ASSERT( !StubCode::InInvocationStub(reinterpret_cast(pc_))); } - else if (StubCode::InCoroutineEntryStub(reinterpret_cast(pc_))) { - pc_ = nullptr; - fp_ = ExitLink(); - if (fp_ == nullptr) { - break; // End of Dart stack. - } - - // Skip exit frame. - pc_ = CallerPC(); - fp_ = CallerFP(); - - // At least one frame between exit and next entry frame. - RELEASE_ASSERT( - !StubCode::InCoroutineEntryStub(reinterpret_cast(pc_))); - } if (!Append(reinterpret_cast(pc_), reinterpret_cast(fp_))) { break; // Sample is full. diff --git a/runtime/vm/stack_frame.h b/runtime/vm/stack_frame.h index 42a8bdac4be6..07a00a1b32e2 100644 --- a/runtime/vm/stack_frame.h +++ b/runtime/vm/stack_frame.h @@ -193,7 +193,7 @@ class ExitFrame : public StackFrame { // dart code. class EntryFrame : public StackFrame { public: - bool IsValid() const { return StubCode::InInvocationStub(pc()) || StubCode::InCoroutineEntryStub(pc()); } + bool IsValid() const { return StubCode::InInvocationStub(pc()); } bool IsDartFrame(bool validate = true) const { return false; } bool IsStubFrame() const { return false; } bool IsEntryFrame() const { return true; } @@ -264,7 +264,7 @@ class StackFrameIterator { } const uword pc = *(reinterpret_cast(sp_ + (kSavedPcSlotFromSp * kWordSize))); - return !StubCode::InInvocationStub(pc) && !StubCode::InCoroutineEntryStub(pc); + return !StubCode::InInvocationStub(pc); } // Get next non entry/exit frame in the set (assumes a next frame exists). diff --git a/runtime/vm/stub_code.cc b/runtime/vm/stub_code.cc index 4a41629e6025..dd6181eec389 100644 --- a/runtime/vm/stub_code.cc +++ b/runtime/vm/stub_code.cc @@ -136,13 +136,6 @@ bool StubCode::InInvocationStub(uword pc) { return (pc >= entry) && (pc < (entry + size)); } -bool StubCode::InCoroutineEntryStub(uword pc) { - ASSERT(HasBeenInitialized()); - uword entry = StubCode::CoroutineEntry().EntryPoint(); - uword size = StubCode::CoroutineEntrySize(); - return (pc >= entry) && (pc < (entry + size)); -} - bool StubCode::InJumpToFrameStub(uword pc) { ASSERT(HasBeenInitialized()); uword entry = StubCode::JumpToFrame().EntryPoint(); diff --git a/runtime/vm/stub_code.h b/runtime/vm/stub_code.h index e506d8de2c0a..5430b0e0cc36 100644 --- a/runtime/vm/stub_code.h +++ b/runtime/vm/stub_code.h @@ -49,9 +49,6 @@ class StubCode : public AllStatic { // transitioning into dart code. static bool InInvocationStub(uword pc); - // Check if specified pc is in the dart coroutine entry stub - static bool InCoroutineEntryStub(uword pc); - // Check if the specified pc is in the jump to frame stub. static bool InJumpToFrameStub(uword pc); From c99e8c5ccf5c6c9b096cc8f26749f93cdd0916e4 Mon Sep 17 00:00:00 2001 From: "anton.bashirov" Date: Fri, 6 Sep 2024 18:27:29 +0400 Subject: [PATCH 30/35] fibers --- runtime/vm/compiler/backend/il_printer.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/vm/compiler/backend/il_printer.cc b/runtime/vm/compiler/backend/il_printer.cc index 147df5536ca6..753cb3e7dae7 100644 --- a/runtime/vm/compiler/backend/il_printer.cc +++ b/runtime/vm/compiler/backend/il_printer.cc @@ -1579,7 +1579,7 @@ void Call1ArgStubInstr::PrintOperandsTo(BaseTextBuffer* f) const { void CoroutineInitializeInstr::PrintOperandsTo(BaseTextBuffer* f) const { const char* name = "CoroutineInitialize"; f->Printf("%s(", name); - value()->PrintTo(f); + root()->PrintTo(f); f->AddString(")"); } From 92a99d39f2280c892934b8c0dc94b64019d52b86 Mon Sep 17 00:00:00 2001 From: "anton.bashirov" Date: Fri, 6 Sep 2024 20:29:19 +0400 Subject: [PATCH 31/35] fibers --- runtime/vm/profiler.cc | 5 ++--- runtime/vm/stack_frame.cc | 11 +++++++++-- runtime/vm/stack_frame.h | 5 +++-- runtime/vm/stub_code.cc | 7 +++++++ runtime/vm/stub_code.h | 3 +++ runtime/vm/thread.cc | 2 +- runtime/vm/thread.h | 1 + 7 files changed, 26 insertions(+), 8 deletions(-) diff --git a/runtime/vm/profiler.cc b/runtime/vm/profiler.cc index e033f55a5fb3..4c53088cdaf7 100644 --- a/runtime/vm/profiler.cc +++ b/runtime/vm/profiler.cc @@ -374,7 +374,7 @@ static bool GetAndValidateThreadStackBounds(OSThread* os_thread, #endif // defined(USING_SIMULATOR) if (!use_simulator_stack_bounds) { - if (thread->coroutine() != nullptr) { + if (thread->has_coroutine()) { *stack_lower = thread->coroutine()->untag()->stack_limit(); *stack_upper = thread->coroutine()->untag()->stack_base(); } else { @@ -403,8 +403,7 @@ static bool GetAndValidateCurrentThreadStackBounds(uintptr_t fp, ASSERT(stack_lower != nullptr); ASSERT(stack_upper != nullptr); - if (Thread::Current() != nullptr && - Thread::Current()->coroutine() != nullptr) { + if (Thread::Current() != nullptr && Thread::Current()->has_coroutine()) { *stack_lower = Thread::Current()->coroutine()->untag()->stack_limit(); *stack_upper = Thread::Current()->coroutine()->untag()->stack_base(); } else { diff --git a/runtime/vm/stack_frame.cc b/runtime/vm/stack_frame.cc index c440841c7452..041ba7308611 100644 --- a/runtime/vm/stack_frame.cc +++ b/runtime/vm/stack_frame.cc @@ -195,6 +195,7 @@ void ExitFrame::VisitObjectPointers(ObjectPointerVisitor* visitor) { void EntryFrame::VisitObjectPointers(ObjectPointerVisitor* visitor) { ASSERT(visitor != nullptr); + if (IsCoroutine()) return; // Visit objects between SP and (FP - callee_save_area). ObjectPtr* first = reinterpret_cast(sp()); ObjectPtr* last = @@ -614,8 +615,7 @@ void StackFrameIterator::FrameSetIterator::Unpoison() { #if !defined(USING_SIMULATOR) if (fp_ == 0) return; // Note that Thread::os_thread_ is cleared when the thread is descheduled. - ASSERT((thread_->coroutine() != nullptr) || - (thread_->os_thread() == nullptr) || + ASSERT((thread_->has_coroutine()) || (thread_->os_thread() == nullptr) || ((thread_->os_thread()->stack_limit() < fp_) && (thread_->os_thread()->stack_base() > fp_))); uword lower; @@ -663,6 +663,13 @@ EntryFrame* StackFrameIterator::NextEntryFrame() { entry_.sp_ = frames_.sp_; entry_.fp_ = frames_.fp_; entry_.pc_ = frames_.pc_; + if (entry_.IsCoroutine()) { + frames_.fp_ = 0; + frames_.sp_ = 0; + frames_.pc_ = 0; + frames_.Unpoison(); + return &entry_; + } SetupNextExitFrameData(); // Setup data for next exit frame in chain. ASSERT(!validate_ || entry_.IsValid()); return &entry_; diff --git a/runtime/vm/stack_frame.h b/runtime/vm/stack_frame.h index 07a00a1b32e2..83db53abab18 100644 --- a/runtime/vm/stack_frame.h +++ b/runtime/vm/stack_frame.h @@ -193,7 +193,8 @@ class ExitFrame : public StackFrame { // dart code. class EntryFrame : public StackFrame { public: - bool IsValid() const { return StubCode::InInvocationStub(pc()); } + bool IsValid() const { return StubCode::InInvocationStub(pc()) || StubCode::InCoroutineEntryStub(pc()); } + bool IsCoroutine() const { return StubCode::InCoroutineEntryStub(pc()); } bool IsDartFrame(bool validate = true) const { return false; } bool IsStubFrame() const { return false; } bool IsEntryFrame() const { return true; } @@ -264,7 +265,7 @@ class StackFrameIterator { } const uword pc = *(reinterpret_cast(sp_ + (kSavedPcSlotFromSp * kWordSize))); - return !StubCode::InInvocationStub(pc); + return !StubCode::InInvocationStub(pc) && !StubCode::InCoroutineEntryStub(pc); } // Get next non entry/exit frame in the set (assumes a next frame exists). diff --git a/runtime/vm/stub_code.cc b/runtime/vm/stub_code.cc index dd6181eec389..4a41629e6025 100644 --- a/runtime/vm/stub_code.cc +++ b/runtime/vm/stub_code.cc @@ -136,6 +136,13 @@ bool StubCode::InInvocationStub(uword pc) { return (pc >= entry) && (pc < (entry + size)); } +bool StubCode::InCoroutineEntryStub(uword pc) { + ASSERT(HasBeenInitialized()); + uword entry = StubCode::CoroutineEntry().EntryPoint(); + uword size = StubCode::CoroutineEntrySize(); + return (pc >= entry) && (pc < (entry + size)); +} + bool StubCode::InJumpToFrameStub(uword pc) { ASSERT(HasBeenInitialized()); uword entry = StubCode::JumpToFrame().EntryPoint(); diff --git a/runtime/vm/stub_code.h b/runtime/vm/stub_code.h index 5430b0e0cc36..e506d8de2c0a 100644 --- a/runtime/vm/stub_code.h +++ b/runtime/vm/stub_code.h @@ -49,6 +49,9 @@ class StubCode : public AllStatic { // transitioning into dart code. static bool InInvocationStub(uword pc); + // Check if specified pc is in the dart coroutine entry stub + static bool InCoroutineEntryStub(uword pc); + // Check if the specified pc is in the jump to frame stub. static bool InJumpToFrameStub(uword pc); diff --git a/runtime/vm/thread.cc b/runtime/vm/thread.cc index d6a90e447777..3b1255e4eb59 100644 --- a/runtime/vm/thread.cc +++ b/runtime/vm/thread.cc @@ -551,7 +551,7 @@ void Thread::ResumeDartMutatorThreadInternal(Thread* thread) { void Thread::SuspendDartMutatorThreadInternal(Thread* thread, VMTag::VMTagId tag) { - if (thread->coroutine() != nullptr) { + if (thread->has_coroutine()) { thread->isolate()->save_coroutine(thread->SaveCoroutine()); SuspendThreadInternal(thread, tag); return; diff --git a/runtime/vm/thread.h b/runtime/vm/thread.h index 62bd7e2be5eb..d84fb9898960 100644 --- a/runtime/vm/thread.h +++ b/runtime/vm/thread.h @@ -397,6 +397,7 @@ class Thread : public ThreadState { CoroutinePtr SaveCoroutine(); void EnterCoroutine(CoroutinePtr coroutine); void ExitCoroutine(); + bool has_coroutine() const { return coroutine_ != nullptr; } CoroutinePtr coroutine() const { return coroutine_; } static intptr_t coroutine_offset() { return OFFSET_OF(Thread, coroutine_); } From 106c64e432291650fda17590048cb5c1f32a96fd Mon Sep 17 00:00:00 2001 From: "anton.bashirov" Date: Fri, 6 Sep 2024 21:51:34 +0400 Subject: [PATCH 32/35] fibers --- runtime/vm/compiler/backend/il.cc | 6 +++--- runtime/vm/object.cc | 1 - runtime/vm/stack_frame.cc | 6 ------ tests/lib/fiber/fiber_test.dart | 2 ++ 4 files changed, 5 insertions(+), 10 deletions(-) diff --git a/runtime/vm/compiler/backend/il.cc b/runtime/vm/compiler/backend/il.cc index d201814e1150..06bb7d70e7aa 100644 --- a/runtime/vm/compiler/backend/il.cc +++ b/runtime/vm/compiler/backend/il.cc @@ -8619,7 +8619,7 @@ void CoroutineForkInstr::EmitNativeCode(FlowGraphCompiler* compiler) { #if defined(TARGET_ARCH_ARM) || defined(TARGET_ARCH_ARM64) SPILLS_LR_TO_FRAME({}); #endif - __ StoreFieldToOffset(kCallerCoroutine, kForkedCoroutine, Coroutine::caller_offset()); + __ StoreCompressedIntoObjectNoBarrier(kForkedCoroutine, compiler::FieldAddress(kForkedCoroutine, Coroutine::caller_offset()), kCallerCoroutine); __ LoadFieldFromOffset(kStackLimit, kForkedCoroutine, Coroutine::stack_limit_offset()); __ StoreToOffset(kStackLimit, THR, Thread::stack_limit_offset()); @@ -8635,7 +8635,7 @@ void CoroutineForkInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ PopRegister(kForkedCoroutine); __ StoreFieldToOffset(SPREG, kForkedCoroutine, Coroutine::stack_base_offset()); - __ LoadFieldFromOffset(kCallerCoroutine, kForkedCoroutine, Coroutine::caller_offset()); + __ LoadCompressedFieldFromOffset(kCallerCoroutine, kForkedCoroutine, Coroutine::caller_offset()); __ LoadFieldFromOffset(SPREG, kCallerCoroutine, Coroutine::stack_base_offset()); __ PopRegister(FPREG); @@ -8678,7 +8678,7 @@ void CoroutineTransferInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ StoreToOffset(kToStackLimit, THR, Thread::stack_limit_offset()); __ StoreToOffset(kToCoroutine, THR, Thread::coroutine_offset()); - __ StoreFieldToOffset(kFromCoroutine, kToCoroutine, Coroutine::caller_offset()); + __ StoreCompressedIntoObjectNoBarrier(kToCoroutine, compiler::FieldAddress(kToCoroutine, Coroutine::caller_offset()), kFromCoroutine); } Definition* SuspendInstr::Canonicalize(FlowGraph* flow_graph) { diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc index f969f20b8c92..b2b29705495a 100644 --- a/runtime/vm/object.cc +++ b/runtime/vm/object.cc @@ -26631,7 +26631,6 @@ CodePtr SuspendState::GetCodeObject() const { CoroutinePtr Coroutine::New(void** stack_base, uintptr_t stack_size, FunctionPtr entry) { const auto& coroutine = Coroutine::Handle(Object::Allocate(Heap::kOld)); - NoSafepointScope no_safepoint; coroutine.StoreNonPointer(&coroutine.untag()->stack_base_, (uword)stack_base); coroutine.StoreNonPointer(&coroutine.untag()->stack_limit_, (uword)stack_base - stack_size); coroutine.StoreNonPointer(&coroutine.untag()->top_exit_frame_, 0); diff --git a/runtime/vm/stack_frame.cc b/runtime/vm/stack_frame.cc index 041ba7308611..e4f640d43ddb 100644 --- a/runtime/vm/stack_frame.cc +++ b/runtime/vm/stack_frame.cc @@ -246,10 +246,6 @@ void StackFrame::VisitObjectPointers(ObjectPointerVisitor* visitor) { } } - OS::Print("pc() = %p\n", (void*)pc()); - OS::Print("sp() = %p\n", (void*)sp()); - OS::Print("fp() = %p\n", (void*)fp()); - OS::Print("maps.IsNull() = %d\n", (int)maps.IsNull()); if (!maps.IsNull()) { // Optimized frames have a stack map. We need to visit the frame based // on the stack map. @@ -257,8 +253,6 @@ void StackFrame::VisitObjectPointers(ObjectPointerVisitor* visitor) { maps, global_table); const uint32_t pc_offset = pc() - code_start; bool found = it.Find(pc_offset); - OS::Print("code_start = %p\n", (void*)code_start); - OS::Print("stack map found = %d\n", (int)found); if (found) { ObjectPtr* first = reinterpret_cast(sp()); ObjectPtr* last = reinterpret_cast( diff --git a/tests/lib/fiber/fiber_test.dart b/tests/lib/fiber/fiber_test.dart index 1939f8a5eb1b..da387c751aa4 100644 --- a/tests/lib/fiber/fiber_test.dart +++ b/tests/lib/fiber/fiber_test.dart @@ -8,7 +8,9 @@ var commonState = ""; void main() { while (true) { + print("before idle"); Fiber.idle(); + print("after idle"); commonState = ""; print("before start"); mainFiber.start(); From db41a11fc5bb2c4f5b3f6b867ed5f2c1c069ed1f Mon Sep 17 00:00:00 2001 From: "anton.bashirov" Date: Sun, 8 Sep 2024 00:41:04 +0400 Subject: [PATCH 33/35] fiber --- runtime/lib/fiber.cc | 4 +- runtime/vm/compiler/runtime_api.h | 3 +- .../vm/compiler/runtime_offsets_extracted.h | 338 +++++++++++------- runtime/vm/compiler/runtime_offsets_list.h | 3 +- runtime/vm/constants_x64.h | 4 + runtime/vm/heap/marker.cc | 9 + runtime/vm/object.cc | 4 +- runtime/vm/object.h | 13 +- runtime/vm/raw_object.h | 3 +- runtime/vm/raw_object_fields.cc | 3 +- runtime/vm/stack_frame.cc | 26 +- runtime/vm/stack_frame.h | 5 +- tests/lib/fiber/fiber_test.dart | 18 +- 13 files changed, 266 insertions(+), 167 deletions(-) diff --git a/runtime/lib/fiber.cc b/runtime/lib/fiber.cc index d84e619e6324..f023900f4471 100644 --- a/runtime/lib/fiber.cc +++ b/runtime/lib/fiber.cc @@ -16,6 +16,8 @@ DEFINE_NATIVE_ENTRY(Coroutine_factory, 0, 3) { intptr_t stack_size = size.Value(); void** stack_base = (void**)((uintptr_t)mmap(0, stack_size * kWordSize, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0)); memset(stack_base, 0, stack_size * kWordSize); - return Coroutine::New(stack_base + stack_size , stack_size, Function::Handle(entry.function()).ptr()); + void** source_frame_space = (void**)((uintptr_t)mmap(0, stack_size * kWordSize, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0)); + memset(source_frame_space, 0, stack_size * kWordSize); + return Coroutine::New(source_frame_space, stack_base + stack_size , stack_size, Function::Handle(entry.function()).ptr()); } } // namespace dart diff --git a/runtime/vm/compiler/runtime_api.h b/runtime/vm/compiler/runtime_api.h index 2ab834ac1f87..ae43e6c8fadc 100644 --- a/runtime/vm/compiler/runtime_api.h +++ b/runtime/vm/compiler/runtime_api.h @@ -1040,7 +1040,8 @@ class Coroutine : public AllStatic { static word entry_offset(); static word stack_base_offset(); static word stack_limit_offset(); - static word top_exit_frame_offset(); + static word source_frame_size_offset(); + static word source_frame_pointer_offset(); static word InstanceSize(); FINAL_CLASS(); }; diff --git a/runtime/vm/compiler/runtime_offsets_extracted.h b/runtime/vm/compiler/runtime_offsets_extracted.h index 50ca587421af..30f2d72c5dd0 100644 --- a/runtime/vm/compiler/runtime_offsets_extracted.h +++ b/runtime/vm/compiler/runtime_offsets_extracted.h @@ -467,11 +467,14 @@ static constexpr dart::compiler::target::word WeakReference_target_offset = 0x4; static constexpr dart::compiler::target::word WeakReference_type_arguments_offset = 0x8; static constexpr dart::compiler::target::word Coroutine_caller_offset = 0x4; static constexpr dart::compiler::target::word Coroutine_entry_offset = 0x8; -static constexpr dart::compiler::target::word Coroutine_stack_base_offset = 0xc; -static constexpr dart::compiler::target::word Coroutine_stack_limit_offset = - 0x10; -static constexpr dart::compiler::target::word Coroutine_top_exit_frame_offset = +static constexpr dart::compiler::target::word Coroutine_stack_base_offset = 0x14; +static constexpr dart::compiler::target::word Coroutine_stack_limit_offset = + 0x18; +static constexpr dart::compiler::target::word + Coroutine_source_frame_pointer_offset = 0xc; +static constexpr dart::compiler::target::word + Coroutine_source_frame_size_offset = 0x10; static constexpr dart::compiler::target::word Code_entry_point_offset[] = {0x4, 0xc, 0x8, 0x10}; static constexpr dart::compiler::target::word Thread_write_barrier_wrappers_thread_offset[] = { @@ -537,7 +540,7 @@ static constexpr dart::compiler::target::word Sentinel_InstanceSize = 0x4; static constexpr dart::compiler::target::word SingleTargetCache_InstanceSize = 0x14; static constexpr dart::compiler::target::word StackTrace_InstanceSize = 0x14; static constexpr dart::compiler::target::word SuspendState_HeaderSize = 0x1c; -static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x18; +static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x1c; static constexpr dart::compiler::target::word String_InstanceSize = 0xc; static constexpr dart::compiler::target::word SubtypeTestCache_InstanceSize = 0x10; static constexpr dart::compiler::target::word LoadingUnit_InstanceSize = 0x14; @@ -1012,11 +1015,13 @@ static constexpr dart::compiler::target::word WeakReference_type_arguments_offse static constexpr dart::compiler::target::word Coroutine_caller_offset = 0x8; static constexpr dart::compiler::target::word Coroutine_entry_offset = 0x10; static constexpr dart::compiler::target::word Coroutine_stack_base_offset = - 0x18; -static constexpr dart::compiler::target::word Coroutine_stack_limit_offset = - 0x20; -static constexpr dart::compiler::target::word Coroutine_top_exit_frame_offset = 0x28; +static constexpr dart::compiler::target::word Coroutine_stack_limit_offset = + 0x30; +static constexpr dart::compiler::target::word + Coroutine_source_frame_pointer_offset = 0x18; +static constexpr dart::compiler::target::word + Coroutine_source_frame_size_offset = 0x20; static constexpr dart::compiler::target::word Code_entry_point_offset[] = {0x8, 0x18, 0x10, 0x20}; static constexpr dart::compiler::target::word Thread_write_barrier_wrappers_thread_offset[] = { @@ -1082,7 +1087,7 @@ static constexpr dart::compiler::target::word Sentinel_InstanceSize = 0x8; static constexpr dart::compiler::target::word SingleTargetCache_InstanceSize = 0x20; static constexpr dart::compiler::target::word StackTrace_InstanceSize = 0x28; static constexpr dart::compiler::target::word SuspendState_HeaderSize = 0x38; -static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x30; +static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x38; static constexpr dart::compiler::target::word String_InstanceSize = 0x10; static constexpr dart::compiler::target::word SubtypeTestCache_InstanceSize = 0x18; static constexpr dart::compiler::target::word LoadingUnit_InstanceSize = 0x28; @@ -1556,11 +1561,14 @@ static constexpr dart::compiler::target::word WeakReference_target_offset = 0x4; static constexpr dart::compiler::target::word WeakReference_type_arguments_offset = 0x8; static constexpr dart::compiler::target::word Coroutine_caller_offset = 0x4; static constexpr dart::compiler::target::word Coroutine_entry_offset = 0x8; -static constexpr dart::compiler::target::word Coroutine_stack_base_offset = 0xc; -static constexpr dart::compiler::target::word Coroutine_stack_limit_offset = - 0x10; -static constexpr dart::compiler::target::word Coroutine_top_exit_frame_offset = +static constexpr dart::compiler::target::word Coroutine_stack_base_offset = 0x14; +static constexpr dart::compiler::target::word Coroutine_stack_limit_offset = + 0x18; +static constexpr dart::compiler::target::word + Coroutine_source_frame_pointer_offset = 0xc; +static constexpr dart::compiler::target::word + Coroutine_source_frame_size_offset = 0x10; static constexpr dart::compiler::target::word Code_entry_point_offset[] = {0x4, 0xc, 0x8, 0x10}; static constexpr dart::compiler::target::word Thread_write_barrier_wrappers_thread_offset[] = { @@ -1625,7 +1633,7 @@ static constexpr dart::compiler::target::word Sentinel_InstanceSize = 0x4; static constexpr dart::compiler::target::word SingleTargetCache_InstanceSize = 0x14; static constexpr dart::compiler::target::word StackTrace_InstanceSize = 0x14; static constexpr dart::compiler::target::word SuspendState_HeaderSize = 0x1c; -static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x18; +static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x1c; static constexpr dart::compiler::target::word String_InstanceSize = 0xc; static constexpr dart::compiler::target::word SubtypeTestCache_InstanceSize = 0x10; static constexpr dart::compiler::target::word LoadingUnit_InstanceSize = 0x14; @@ -2100,11 +2108,13 @@ static constexpr dart::compiler::target::word WeakReference_type_arguments_offse static constexpr dart::compiler::target::word Coroutine_caller_offset = 0x8; static constexpr dart::compiler::target::word Coroutine_entry_offset = 0x10; static constexpr dart::compiler::target::word Coroutine_stack_base_offset = - 0x18; -static constexpr dart::compiler::target::word Coroutine_stack_limit_offset = - 0x20; -static constexpr dart::compiler::target::word Coroutine_top_exit_frame_offset = 0x28; +static constexpr dart::compiler::target::word Coroutine_stack_limit_offset = + 0x30; +static constexpr dart::compiler::target::word + Coroutine_source_frame_pointer_offset = 0x18; +static constexpr dart::compiler::target::word + Coroutine_source_frame_size_offset = 0x20; static constexpr dart::compiler::target::word Code_entry_point_offset[] = {0x8, 0x18, 0x10, 0x20}; static constexpr dart::compiler::target::word Thread_write_barrier_wrappers_thread_offset[] = { @@ -2172,7 +2182,7 @@ static constexpr dart::compiler::target::word Sentinel_InstanceSize = 0x8; static constexpr dart::compiler::target::word SingleTargetCache_InstanceSize = 0x20; static constexpr dart::compiler::target::word StackTrace_InstanceSize = 0x28; static constexpr dart::compiler::target::word SuspendState_HeaderSize = 0x38; -static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x30; +static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x38; static constexpr dart::compiler::target::word String_InstanceSize = 0x10; static constexpr dart::compiler::target::word SubtypeTestCache_InstanceSize = 0x18; static constexpr dart::compiler::target::word LoadingUnit_InstanceSize = 0x28; @@ -2648,11 +2658,13 @@ static constexpr dart::compiler::target::word WeakReference_type_arguments_offse static constexpr dart::compiler::target::word Coroutine_caller_offset = 0x8; static constexpr dart::compiler::target::word Coroutine_entry_offset = 0xc; static constexpr dart::compiler::target::word Coroutine_stack_base_offset = - 0x10; -static constexpr dart::compiler::target::word Coroutine_stack_limit_offset = - 0x18; -static constexpr dart::compiler::target::word Coroutine_top_exit_frame_offset = 0x20; +static constexpr dart::compiler::target::word Coroutine_stack_limit_offset = + 0x28; +static constexpr dart::compiler::target::word + Coroutine_source_frame_pointer_offset = 0x10; +static constexpr dart::compiler::target::word + Coroutine_source_frame_size_offset = 0x18; static constexpr dart::compiler::target::word Code_entry_point_offset[] = {0x8, 0x18, 0x10, 0x20}; static constexpr dart::compiler::target::word Thread_write_barrier_wrappers_thread_offset[] = { @@ -2718,7 +2730,7 @@ static constexpr dart::compiler::target::word Sentinel_InstanceSize = 0x8; static constexpr dart::compiler::target::word SingleTargetCache_InstanceSize = 0x20; static constexpr dart::compiler::target::word StackTrace_InstanceSize = 0x18; static constexpr dart::compiler::target::word SuspendState_HeaderSize = 0x30; -static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x28; +static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x30; static constexpr dart::compiler::target::word String_InstanceSize = 0x10; static constexpr dart::compiler::target::word SubtypeTestCache_InstanceSize = 0x18; static constexpr dart::compiler::target::word LoadingUnit_InstanceSize = 0x20; @@ -3194,11 +3206,13 @@ static constexpr dart::compiler::target::word WeakReference_type_arguments_offse static constexpr dart::compiler::target::word Coroutine_caller_offset = 0x8; static constexpr dart::compiler::target::word Coroutine_entry_offset = 0xc; static constexpr dart::compiler::target::word Coroutine_stack_base_offset = - 0x10; -static constexpr dart::compiler::target::word Coroutine_stack_limit_offset = - 0x18; -static constexpr dart::compiler::target::word Coroutine_top_exit_frame_offset = 0x20; +static constexpr dart::compiler::target::word Coroutine_stack_limit_offset = + 0x28; +static constexpr dart::compiler::target::word + Coroutine_source_frame_pointer_offset = 0x10; +static constexpr dart::compiler::target::word + Coroutine_source_frame_size_offset = 0x18; static constexpr dart::compiler::target::word Code_entry_point_offset[] = {0x8, 0x18, 0x10, 0x20}; static constexpr dart::compiler::target::word Thread_write_barrier_wrappers_thread_offset[] = { @@ -3266,7 +3280,7 @@ static constexpr dart::compiler::target::word Sentinel_InstanceSize = 0x8; static constexpr dart::compiler::target::word SingleTargetCache_InstanceSize = 0x20; static constexpr dart::compiler::target::word StackTrace_InstanceSize = 0x18; static constexpr dart::compiler::target::word SuspendState_HeaderSize = 0x30; -static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x28; +static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x30; static constexpr dart::compiler::target::word String_InstanceSize = 0x10; static constexpr dart::compiler::target::word SubtypeTestCache_InstanceSize = 0x18; static constexpr dart::compiler::target::word LoadingUnit_InstanceSize = 0x20; @@ -3740,11 +3754,14 @@ static constexpr dart::compiler::target::word WeakReference_target_offset = 0x4; static constexpr dart::compiler::target::word WeakReference_type_arguments_offset = 0x8; static constexpr dart::compiler::target::word Coroutine_caller_offset = 0x4; static constexpr dart::compiler::target::word Coroutine_entry_offset = 0x8; -static constexpr dart::compiler::target::word Coroutine_stack_base_offset = 0xc; -static constexpr dart::compiler::target::word Coroutine_stack_limit_offset = - 0x10; -static constexpr dart::compiler::target::word Coroutine_top_exit_frame_offset = +static constexpr dart::compiler::target::word Coroutine_stack_base_offset = 0x14; +static constexpr dart::compiler::target::word Coroutine_stack_limit_offset = + 0x18; +static constexpr dart::compiler::target::word + Coroutine_source_frame_pointer_offset = 0xc; +static constexpr dart::compiler::target::word + Coroutine_source_frame_size_offset = 0x10; static constexpr dart::compiler::target::word Code_entry_point_offset[] = {0x4, 0xc, 0x8, 0x10}; static constexpr dart::compiler::target::word Thread_write_barrier_wrappers_thread_offset[] = { @@ -3811,7 +3828,7 @@ static constexpr dart::compiler::target::word Sentinel_InstanceSize = 0x4; static constexpr dart::compiler::target::word SingleTargetCache_InstanceSize = 0x14; static constexpr dart::compiler::target::word StackTrace_InstanceSize = 0x14; static constexpr dart::compiler::target::word SuspendState_HeaderSize = 0x1c; -static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x18; +static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x1c; static constexpr dart::compiler::target::word String_InstanceSize = 0xc; static constexpr dart::compiler::target::word SubtypeTestCache_InstanceSize = 0x10; static constexpr dart::compiler::target::word LoadingUnit_InstanceSize = 0x14; @@ -4286,11 +4303,13 @@ static constexpr dart::compiler::target::word WeakReference_type_arguments_offse static constexpr dart::compiler::target::word Coroutine_caller_offset = 0x8; static constexpr dart::compiler::target::word Coroutine_entry_offset = 0x10; static constexpr dart::compiler::target::word Coroutine_stack_base_offset = - 0x18; -static constexpr dart::compiler::target::word Coroutine_stack_limit_offset = - 0x20; -static constexpr dart::compiler::target::word Coroutine_top_exit_frame_offset = 0x28; +static constexpr dart::compiler::target::word Coroutine_stack_limit_offset = + 0x30; +static constexpr dart::compiler::target::word + Coroutine_source_frame_pointer_offset = 0x18; +static constexpr dart::compiler::target::word + Coroutine_source_frame_size_offset = 0x20; static constexpr dart::compiler::target::word Code_entry_point_offset[] = {0x8, 0x18, 0x10, 0x20}; static constexpr dart::compiler::target::word Thread_write_barrier_wrappers_thread_offset[] = { @@ -4357,7 +4376,7 @@ static constexpr dart::compiler::target::word Sentinel_InstanceSize = 0x8; static constexpr dart::compiler::target::word SingleTargetCache_InstanceSize = 0x20; static constexpr dart::compiler::target::word StackTrace_InstanceSize = 0x28; static constexpr dart::compiler::target::word SuspendState_HeaderSize = 0x38; -static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x30; +static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x38; static constexpr dart::compiler::target::word String_InstanceSize = 0x10; static constexpr dart::compiler::target::word SubtypeTestCache_InstanceSize = 0x18; static constexpr dart::compiler::target::word LoadingUnit_InstanceSize = 0x28; @@ -4826,11 +4845,14 @@ static constexpr dart::compiler::target::word WeakReference_target_offset = 0x4; static constexpr dart::compiler::target::word WeakReference_type_arguments_offset = 0x8; static constexpr dart::compiler::target::word Coroutine_caller_offset = 0x4; static constexpr dart::compiler::target::word Coroutine_entry_offset = 0x8; -static constexpr dart::compiler::target::word Coroutine_stack_base_offset = 0xc; -static constexpr dart::compiler::target::word Coroutine_stack_limit_offset = - 0x10; -static constexpr dart::compiler::target::word Coroutine_top_exit_frame_offset = +static constexpr dart::compiler::target::word Coroutine_stack_base_offset = 0x14; +static constexpr dart::compiler::target::word Coroutine_stack_limit_offset = + 0x18; +static constexpr dart::compiler::target::word + Coroutine_source_frame_pointer_offset = 0xc; +static constexpr dart::compiler::target::word + Coroutine_source_frame_size_offset = 0x10; static constexpr dart::compiler::target::word Code_entry_point_offset[] = {0x4, 0xc, 0x8, 0x10}; static constexpr dart::compiler::target::word Thread_write_barrier_wrappers_thread_offset[] = { @@ -4896,7 +4918,7 @@ static constexpr dart::compiler::target::word Sentinel_InstanceSize = 0x4; static constexpr dart::compiler::target::word SingleTargetCache_InstanceSize = 0x14; static constexpr dart::compiler::target::word StackTrace_InstanceSize = 0x14; static constexpr dart::compiler::target::word SuspendState_HeaderSize = 0x1c; -static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x18; +static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x1c; static constexpr dart::compiler::target::word String_InstanceSize = 0xc; static constexpr dart::compiler::target::word SubtypeTestCache_InstanceSize = 0x10; static constexpr dart::compiler::target::word LoadingUnit_InstanceSize = 0x14; @@ -5366,11 +5388,13 @@ static constexpr dart::compiler::target::word WeakReference_type_arguments_offse static constexpr dart::compiler::target::word Coroutine_caller_offset = 0x8; static constexpr dart::compiler::target::word Coroutine_entry_offset = 0x10; static constexpr dart::compiler::target::word Coroutine_stack_base_offset = - 0x18; -static constexpr dart::compiler::target::word Coroutine_stack_limit_offset = - 0x20; -static constexpr dart::compiler::target::word Coroutine_top_exit_frame_offset = 0x28; +static constexpr dart::compiler::target::word Coroutine_stack_limit_offset = + 0x30; +static constexpr dart::compiler::target::word + Coroutine_source_frame_pointer_offset = 0x18; +static constexpr dart::compiler::target::word + Coroutine_source_frame_size_offset = 0x20; static constexpr dart::compiler::target::word Code_entry_point_offset[] = {0x8, 0x18, 0x10, 0x20}; static constexpr dart::compiler::target::word Thread_write_barrier_wrappers_thread_offset[] = { @@ -5436,7 +5460,7 @@ static constexpr dart::compiler::target::word Sentinel_InstanceSize = 0x8; static constexpr dart::compiler::target::word SingleTargetCache_InstanceSize = 0x20; static constexpr dart::compiler::target::word StackTrace_InstanceSize = 0x28; static constexpr dart::compiler::target::word SuspendState_HeaderSize = 0x38; -static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x30; +static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x38; static constexpr dart::compiler::target::word String_InstanceSize = 0x10; static constexpr dart::compiler::target::word SubtypeTestCache_InstanceSize = 0x18; static constexpr dart::compiler::target::word LoadingUnit_InstanceSize = 0x28; @@ -5905,11 +5929,14 @@ static constexpr dart::compiler::target::word WeakReference_target_offset = 0x4; static constexpr dart::compiler::target::word WeakReference_type_arguments_offset = 0x8; static constexpr dart::compiler::target::word Coroutine_caller_offset = 0x4; static constexpr dart::compiler::target::word Coroutine_entry_offset = 0x8; -static constexpr dart::compiler::target::word Coroutine_stack_base_offset = 0xc; -static constexpr dart::compiler::target::word Coroutine_stack_limit_offset = - 0x10; -static constexpr dart::compiler::target::word Coroutine_top_exit_frame_offset = +static constexpr dart::compiler::target::word Coroutine_stack_base_offset = 0x14; +static constexpr dart::compiler::target::word Coroutine_stack_limit_offset = + 0x18; +static constexpr dart::compiler::target::word + Coroutine_source_frame_pointer_offset = 0xc; +static constexpr dart::compiler::target::word + Coroutine_source_frame_size_offset = 0x10; static constexpr dart::compiler::target::word Code_entry_point_offset[] = {0x4, 0xc, 0x8, 0x10}; static constexpr dart::compiler::target::word Thread_write_barrier_wrappers_thread_offset[] = { @@ -5974,7 +6001,7 @@ static constexpr dart::compiler::target::word Sentinel_InstanceSize = 0x4; static constexpr dart::compiler::target::word SingleTargetCache_InstanceSize = 0x14; static constexpr dart::compiler::target::word StackTrace_InstanceSize = 0x14; static constexpr dart::compiler::target::word SuspendState_HeaderSize = 0x1c; -static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x18; +static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x1c; static constexpr dart::compiler::target::word String_InstanceSize = 0xc; static constexpr dart::compiler::target::word SubtypeTestCache_InstanceSize = 0x10; static constexpr dart::compiler::target::word LoadingUnit_InstanceSize = 0x14; @@ -6444,11 +6471,13 @@ static constexpr dart::compiler::target::word WeakReference_type_arguments_offse static constexpr dart::compiler::target::word Coroutine_caller_offset = 0x8; static constexpr dart::compiler::target::word Coroutine_entry_offset = 0x10; static constexpr dart::compiler::target::word Coroutine_stack_base_offset = - 0x18; -static constexpr dart::compiler::target::word Coroutine_stack_limit_offset = - 0x20; -static constexpr dart::compiler::target::word Coroutine_top_exit_frame_offset = 0x28; +static constexpr dart::compiler::target::word Coroutine_stack_limit_offset = + 0x30; +static constexpr dart::compiler::target::word + Coroutine_source_frame_pointer_offset = 0x18; +static constexpr dart::compiler::target::word + Coroutine_source_frame_size_offset = 0x20; static constexpr dart::compiler::target::word Code_entry_point_offset[] = {0x8, 0x18, 0x10, 0x20}; static constexpr dart::compiler::target::word Thread_write_barrier_wrappers_thread_offset[] = { @@ -6516,7 +6545,7 @@ static constexpr dart::compiler::target::word Sentinel_InstanceSize = 0x8; static constexpr dart::compiler::target::word SingleTargetCache_InstanceSize = 0x20; static constexpr dart::compiler::target::word StackTrace_InstanceSize = 0x28; static constexpr dart::compiler::target::word SuspendState_HeaderSize = 0x38; -static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x30; +static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x38; static constexpr dart::compiler::target::word String_InstanceSize = 0x10; static constexpr dart::compiler::target::word SubtypeTestCache_InstanceSize = 0x18; static constexpr dart::compiler::target::word LoadingUnit_InstanceSize = 0x28; @@ -6987,11 +7016,13 @@ static constexpr dart::compiler::target::word WeakReference_type_arguments_offse static constexpr dart::compiler::target::word Coroutine_caller_offset = 0x8; static constexpr dart::compiler::target::word Coroutine_entry_offset = 0xc; static constexpr dart::compiler::target::word Coroutine_stack_base_offset = - 0x10; -static constexpr dart::compiler::target::word Coroutine_stack_limit_offset = - 0x18; -static constexpr dart::compiler::target::word Coroutine_top_exit_frame_offset = 0x20; +static constexpr dart::compiler::target::word Coroutine_stack_limit_offset = + 0x28; +static constexpr dart::compiler::target::word + Coroutine_source_frame_pointer_offset = 0x10; +static constexpr dart::compiler::target::word + Coroutine_source_frame_size_offset = 0x18; static constexpr dart::compiler::target::word Code_entry_point_offset[] = {0x8, 0x18, 0x10, 0x20}; static constexpr dart::compiler::target::word Thread_write_barrier_wrappers_thread_offset[] = { @@ -7057,7 +7088,7 @@ static constexpr dart::compiler::target::word Sentinel_InstanceSize = 0x8; static constexpr dart::compiler::target::word SingleTargetCache_InstanceSize = 0x20; static constexpr dart::compiler::target::word StackTrace_InstanceSize = 0x18; static constexpr dart::compiler::target::word SuspendState_HeaderSize = 0x30; -static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x28; +static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x30; static constexpr dart::compiler::target::word String_InstanceSize = 0x10; static constexpr dart::compiler::target::word SubtypeTestCache_InstanceSize = 0x18; static constexpr dart::compiler::target::word LoadingUnit_InstanceSize = 0x20; @@ -7528,11 +7559,13 @@ static constexpr dart::compiler::target::word WeakReference_type_arguments_offse static constexpr dart::compiler::target::word Coroutine_caller_offset = 0x8; static constexpr dart::compiler::target::word Coroutine_entry_offset = 0xc; static constexpr dart::compiler::target::word Coroutine_stack_base_offset = - 0x10; -static constexpr dart::compiler::target::word Coroutine_stack_limit_offset = - 0x18; -static constexpr dart::compiler::target::word Coroutine_top_exit_frame_offset = 0x20; +static constexpr dart::compiler::target::word Coroutine_stack_limit_offset = + 0x28; +static constexpr dart::compiler::target::word + Coroutine_source_frame_pointer_offset = 0x10; +static constexpr dart::compiler::target::word + Coroutine_source_frame_size_offset = 0x18; static constexpr dart::compiler::target::word Code_entry_point_offset[] = {0x8, 0x18, 0x10, 0x20}; static constexpr dart::compiler::target::word Thread_write_barrier_wrappers_thread_offset[] = { @@ -7600,7 +7633,7 @@ static constexpr dart::compiler::target::word Sentinel_InstanceSize = 0x8; static constexpr dart::compiler::target::word SingleTargetCache_InstanceSize = 0x20; static constexpr dart::compiler::target::word StackTrace_InstanceSize = 0x18; static constexpr dart::compiler::target::word SuspendState_HeaderSize = 0x30; -static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x28; +static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x30; static constexpr dart::compiler::target::word String_InstanceSize = 0x10; static constexpr dart::compiler::target::word SubtypeTestCache_InstanceSize = 0x18; static constexpr dart::compiler::target::word LoadingUnit_InstanceSize = 0x20; @@ -8069,11 +8102,14 @@ static constexpr dart::compiler::target::word WeakReference_target_offset = 0x4; static constexpr dart::compiler::target::word WeakReference_type_arguments_offset = 0x8; static constexpr dart::compiler::target::word Coroutine_caller_offset = 0x4; static constexpr dart::compiler::target::word Coroutine_entry_offset = 0x8; -static constexpr dart::compiler::target::word Coroutine_stack_base_offset = 0xc; -static constexpr dart::compiler::target::word Coroutine_stack_limit_offset = - 0x10; -static constexpr dart::compiler::target::word Coroutine_top_exit_frame_offset = +static constexpr dart::compiler::target::word Coroutine_stack_base_offset = 0x14; +static constexpr dart::compiler::target::word Coroutine_stack_limit_offset = + 0x18; +static constexpr dart::compiler::target::word + Coroutine_source_frame_pointer_offset = 0xc; +static constexpr dart::compiler::target::word + Coroutine_source_frame_size_offset = 0x10; static constexpr dart::compiler::target::word Code_entry_point_offset[] = {0x4, 0xc, 0x8, 0x10}; static constexpr dart::compiler::target::word Thread_write_barrier_wrappers_thread_offset[] = { @@ -8140,7 +8176,7 @@ static constexpr dart::compiler::target::word Sentinel_InstanceSize = 0x4; static constexpr dart::compiler::target::word SingleTargetCache_InstanceSize = 0x14; static constexpr dart::compiler::target::word StackTrace_InstanceSize = 0x14; static constexpr dart::compiler::target::word SuspendState_HeaderSize = 0x1c; -static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x18; +static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x1c; static constexpr dart::compiler::target::word String_InstanceSize = 0xc; static constexpr dart::compiler::target::word SubtypeTestCache_InstanceSize = 0x10; static constexpr dart::compiler::target::word LoadingUnit_InstanceSize = 0x14; @@ -8610,11 +8646,13 @@ static constexpr dart::compiler::target::word WeakReference_type_arguments_offse static constexpr dart::compiler::target::word Coroutine_caller_offset = 0x8; static constexpr dart::compiler::target::word Coroutine_entry_offset = 0x10; static constexpr dart::compiler::target::word Coroutine_stack_base_offset = - 0x18; -static constexpr dart::compiler::target::word Coroutine_stack_limit_offset = - 0x20; -static constexpr dart::compiler::target::word Coroutine_top_exit_frame_offset = 0x28; +static constexpr dart::compiler::target::word Coroutine_stack_limit_offset = + 0x30; +static constexpr dart::compiler::target::word + Coroutine_source_frame_pointer_offset = 0x18; +static constexpr dart::compiler::target::word + Coroutine_source_frame_size_offset = 0x20; static constexpr dart::compiler::target::word Code_entry_point_offset[] = {0x8, 0x18, 0x10, 0x20}; static constexpr dart::compiler::target::word Thread_write_barrier_wrappers_thread_offset[] = { @@ -8681,7 +8719,7 @@ static constexpr dart::compiler::target::word Sentinel_InstanceSize = 0x8; static constexpr dart::compiler::target::word SingleTargetCache_InstanceSize = 0x20; static constexpr dart::compiler::target::word StackTrace_InstanceSize = 0x28; static constexpr dart::compiler::target::word SuspendState_HeaderSize = 0x38; -static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x30; +static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x38; static constexpr dart::compiler::target::word String_InstanceSize = 0x10; static constexpr dart::compiler::target::word SubtypeTestCache_InstanceSize = 0x18; static constexpr dart::compiler::target::word LoadingUnit_InstanceSize = 0x28; @@ -9165,11 +9203,13 @@ static constexpr dart::compiler::target::word AOT_WeakReference_type_arguments_o static constexpr dart::compiler::target::word AOT_Coroutine_caller_offset = 0x4; static constexpr dart::compiler::target::word AOT_Coroutine_entry_offset = 0x8; static constexpr dart::compiler::target::word AOT_Coroutine_stack_base_offset = - 0xc; + 0x14; static constexpr dart::compiler::target::word AOT_Coroutine_stack_limit_offset = - 0x10; + 0x18; static constexpr dart::compiler::target::word - AOT_Coroutine_top_exit_frame_offset = 0x14; + AOT_Coroutine_source_frame_pointer_offset = 0xc; +static constexpr dart::compiler::target::word + AOT_Coroutine_source_frame_size_offset = 0x10; static constexpr dart::compiler::target::word AOT_Code_entry_point_offset[] = {0x4, 0xc, 0x8, 0x10}; static constexpr dart::compiler::target::word AOT_Thread_write_barrier_wrappers_thread_offset[] = { @@ -9235,7 +9275,7 @@ static constexpr dart::compiler::target::word AOT_Sentinel_InstanceSize = 0x4; static constexpr dart::compiler::target::word AOT_SingleTargetCache_InstanceSize = 0x14; static constexpr dart::compiler::target::word AOT_StackTrace_InstanceSize = 0x14; static constexpr dart::compiler::target::word AOT_SuspendState_HeaderSize = 0x18; -static constexpr dart::compiler::target::word AOT_Coroutine_InstanceSize = 0x18; +static constexpr dart::compiler::target::word AOT_Coroutine_InstanceSize = 0x1c; static constexpr dart::compiler::target::word AOT_String_InstanceSize = 0xc; static constexpr dart::compiler::target::word AOT_SubtypeTestCache_InstanceSize = 0x10; static constexpr dart::compiler::target::word AOT_LoadingUnit_InstanceSize = 0x14; @@ -9719,11 +9759,13 @@ static constexpr dart::compiler::target::word AOT_WeakReference_type_arguments_o static constexpr dart::compiler::target::word AOT_Coroutine_caller_offset = 0x8; static constexpr dart::compiler::target::word AOT_Coroutine_entry_offset = 0x10; static constexpr dart::compiler::target::word AOT_Coroutine_stack_base_offset = - 0x18; + 0x28; static constexpr dart::compiler::target::word AOT_Coroutine_stack_limit_offset = - 0x20; + 0x30; +static constexpr dart::compiler::target::word + AOT_Coroutine_source_frame_pointer_offset = 0x18; static constexpr dart::compiler::target::word - AOT_Coroutine_top_exit_frame_offset = 0x28; + AOT_Coroutine_source_frame_size_offset = 0x20; static constexpr dart::compiler::target::word AOT_Code_entry_point_offset[] = {0x8, 0x18, 0x10, 0x20}; static constexpr dart::compiler::target::word AOT_Thread_write_barrier_wrappers_thread_offset[] = { @@ -9789,7 +9831,7 @@ static constexpr dart::compiler::target::word AOT_Sentinel_InstanceSize = 0x8; static constexpr dart::compiler::target::word AOT_SingleTargetCache_InstanceSize = 0x20; static constexpr dart::compiler::target::word AOT_StackTrace_InstanceSize = 0x28; static constexpr dart::compiler::target::word AOT_SuspendState_HeaderSize = 0x30; -static constexpr dart::compiler::target::word AOT_Coroutine_InstanceSize = 0x30; +static constexpr dart::compiler::target::word AOT_Coroutine_InstanceSize = 0x38; static constexpr dart::compiler::target::word AOT_String_InstanceSize = 0x10; static constexpr dart::compiler::target::word AOT_SubtypeTestCache_InstanceSize = 0x18; static constexpr dart::compiler::target::word AOT_LoadingUnit_InstanceSize = 0x28; @@ -10278,11 +10320,13 @@ static constexpr dart::compiler::target::word AOT_WeakReference_type_arguments_o static constexpr dart::compiler::target::word AOT_Coroutine_caller_offset = 0x8; static constexpr dart::compiler::target::word AOT_Coroutine_entry_offset = 0x10; static constexpr dart::compiler::target::word AOT_Coroutine_stack_base_offset = - 0x18; + 0x28; static constexpr dart::compiler::target::word AOT_Coroutine_stack_limit_offset = - 0x20; + 0x30; +static constexpr dart::compiler::target::word + AOT_Coroutine_source_frame_pointer_offset = 0x18; static constexpr dart::compiler::target::word - AOT_Coroutine_top_exit_frame_offset = 0x28; + AOT_Coroutine_source_frame_size_offset = 0x20; static constexpr dart::compiler::target::word AOT_Code_entry_point_offset[] = {0x8, 0x18, 0x10, 0x20}; static constexpr dart::compiler::target::word AOT_Thread_write_barrier_wrappers_thread_offset[] = { @@ -10350,7 +10394,7 @@ static constexpr dart::compiler::target::word AOT_Sentinel_InstanceSize = 0x8; static constexpr dart::compiler::target::word AOT_SingleTargetCache_InstanceSize = 0x20; static constexpr dart::compiler::target::word AOT_StackTrace_InstanceSize = 0x28; static constexpr dart::compiler::target::word AOT_SuspendState_HeaderSize = 0x30; -static constexpr dart::compiler::target::word AOT_Coroutine_InstanceSize = 0x30; +static constexpr dart::compiler::target::word AOT_Coroutine_InstanceSize = 0x38; static constexpr dart::compiler::target::word AOT_String_InstanceSize = 0x10; static constexpr dart::compiler::target::word AOT_SubtypeTestCache_InstanceSize = 0x18; static constexpr dart::compiler::target::word AOT_LoadingUnit_InstanceSize = 0x28; @@ -10838,11 +10882,13 @@ static constexpr dart::compiler::target::word AOT_WeakReference_type_arguments_o static constexpr dart::compiler::target::word AOT_Coroutine_caller_offset = 0x8; static constexpr dart::compiler::target::word AOT_Coroutine_entry_offset = 0xc; static constexpr dart::compiler::target::word AOT_Coroutine_stack_base_offset = - 0x10; + 0x20; static constexpr dart::compiler::target::word AOT_Coroutine_stack_limit_offset = - 0x18; + 0x28; +static constexpr dart::compiler::target::word + AOT_Coroutine_source_frame_pointer_offset = 0x10; static constexpr dart::compiler::target::word - AOT_Coroutine_top_exit_frame_offset = 0x20; + AOT_Coroutine_source_frame_size_offset = 0x18; static constexpr dart::compiler::target::word AOT_Code_entry_point_offset[] = {0x8, 0x18, 0x10, 0x20}; static constexpr dart::compiler::target::word AOT_Thread_write_barrier_wrappers_thread_offset[] = { @@ -10908,7 +10954,7 @@ static constexpr dart::compiler::target::word AOT_Sentinel_InstanceSize = 0x8; static constexpr dart::compiler::target::word AOT_SingleTargetCache_InstanceSize = 0x20; static constexpr dart::compiler::target::word AOT_StackTrace_InstanceSize = 0x18; static constexpr dart::compiler::target::word AOT_SuspendState_HeaderSize = 0x28; -static constexpr dart::compiler::target::word AOT_Coroutine_InstanceSize = 0x28; +static constexpr dart::compiler::target::word AOT_Coroutine_InstanceSize = 0x30; static constexpr dart::compiler::target::word AOT_String_InstanceSize = 0x10; static constexpr dart::compiler::target::word AOT_SubtypeTestCache_InstanceSize = 0x18; static constexpr dart::compiler::target::word AOT_LoadingUnit_InstanceSize = 0x20; @@ -11393,11 +11439,13 @@ static constexpr dart::compiler::target::word AOT_WeakReference_type_arguments_o static constexpr dart::compiler::target::word AOT_Coroutine_caller_offset = 0x8; static constexpr dart::compiler::target::word AOT_Coroutine_entry_offset = 0xc; static constexpr dart::compiler::target::word AOT_Coroutine_stack_base_offset = - 0x10; + 0x20; static constexpr dart::compiler::target::word AOT_Coroutine_stack_limit_offset = - 0x18; + 0x28; +static constexpr dart::compiler::target::word + AOT_Coroutine_source_frame_pointer_offset = 0x10; static constexpr dart::compiler::target::word - AOT_Coroutine_top_exit_frame_offset = 0x20; + AOT_Coroutine_source_frame_size_offset = 0x18; static constexpr dart::compiler::target::word AOT_Code_entry_point_offset[] = {0x8, 0x18, 0x10, 0x20}; static constexpr dart::compiler::target::word AOT_Thread_write_barrier_wrappers_thread_offset[] = { @@ -11465,7 +11513,7 @@ static constexpr dart::compiler::target::word AOT_Sentinel_InstanceSize = 0x8; static constexpr dart::compiler::target::word AOT_SingleTargetCache_InstanceSize = 0x20; static constexpr dart::compiler::target::word AOT_StackTrace_InstanceSize = 0x18; static constexpr dart::compiler::target::word AOT_SuspendState_HeaderSize = 0x28; -static constexpr dart::compiler::target::word AOT_Coroutine_InstanceSize = 0x28; +static constexpr dart::compiler::target::word AOT_Coroutine_InstanceSize = 0x30; static constexpr dart::compiler::target::word AOT_String_InstanceSize = 0x10; static constexpr dart::compiler::target::word AOT_SubtypeTestCache_InstanceSize = 0x18; static constexpr dart::compiler::target::word AOT_LoadingUnit_InstanceSize = 0x20; @@ -11949,11 +11997,13 @@ static constexpr dart::compiler::target::word AOT_WeakReference_type_arguments_o static constexpr dart::compiler::target::word AOT_Coroutine_caller_offset = 0x4; static constexpr dart::compiler::target::word AOT_Coroutine_entry_offset = 0x8; static constexpr dart::compiler::target::word AOT_Coroutine_stack_base_offset = - 0xc; + 0x14; static constexpr dart::compiler::target::word AOT_Coroutine_stack_limit_offset = - 0x10; + 0x18; +static constexpr dart::compiler::target::word + AOT_Coroutine_source_frame_pointer_offset = 0xc; static constexpr dart::compiler::target::word - AOT_Coroutine_top_exit_frame_offset = 0x14; + AOT_Coroutine_source_frame_size_offset = 0x10; static constexpr dart::compiler::target::word AOT_Code_entry_point_offset[] = {0x4, 0xc, 0x8, 0x10}; static constexpr dart::compiler::target::word AOT_Thread_write_barrier_wrappers_thread_offset[] = { @@ -12020,7 +12070,7 @@ static constexpr dart::compiler::target::word AOT_Sentinel_InstanceSize = 0x4; static constexpr dart::compiler::target::word AOT_SingleTargetCache_InstanceSize = 0x14; static constexpr dart::compiler::target::word AOT_StackTrace_InstanceSize = 0x14; static constexpr dart::compiler::target::word AOT_SuspendState_HeaderSize = 0x18; -static constexpr dart::compiler::target::word AOT_Coroutine_InstanceSize = 0x18; +static constexpr dart::compiler::target::word AOT_Coroutine_InstanceSize = 0x1c; static constexpr dart::compiler::target::word AOT_String_InstanceSize = 0xc; static constexpr dart::compiler::target::word AOT_SubtypeTestCache_InstanceSize = 0x10; static constexpr dart::compiler::target::word AOT_LoadingUnit_InstanceSize = 0x14; @@ -12504,11 +12554,13 @@ static constexpr dart::compiler::target::word AOT_WeakReference_type_arguments_o static constexpr dart::compiler::target::word AOT_Coroutine_caller_offset = 0x8; static constexpr dart::compiler::target::word AOT_Coroutine_entry_offset = 0x10; static constexpr dart::compiler::target::word AOT_Coroutine_stack_base_offset = - 0x18; + 0x28; static constexpr dart::compiler::target::word AOT_Coroutine_stack_limit_offset = - 0x20; + 0x30; static constexpr dart::compiler::target::word - AOT_Coroutine_top_exit_frame_offset = 0x28; + AOT_Coroutine_source_frame_pointer_offset = 0x18; +static constexpr dart::compiler::target::word + AOT_Coroutine_source_frame_size_offset = 0x20; static constexpr dart::compiler::target::word AOT_Code_entry_point_offset[] = {0x8, 0x18, 0x10, 0x20}; static constexpr dart::compiler::target::word AOT_Thread_write_barrier_wrappers_thread_offset[] = { @@ -12575,7 +12627,7 @@ static constexpr dart::compiler::target::word AOT_Sentinel_InstanceSize = 0x8; static constexpr dart::compiler::target::word AOT_SingleTargetCache_InstanceSize = 0x20; static constexpr dart::compiler::target::word AOT_StackTrace_InstanceSize = 0x28; static constexpr dart::compiler::target::word AOT_SuspendState_HeaderSize = 0x30; -static constexpr dart::compiler::target::word AOT_Coroutine_InstanceSize = 0x30; +static constexpr dart::compiler::target::word AOT_Coroutine_InstanceSize = 0x38; static constexpr dart::compiler::target::word AOT_String_InstanceSize = 0x10; static constexpr dart::compiler::target::word AOT_SubtypeTestCache_InstanceSize = 0x18; static constexpr dart::compiler::target::word AOT_LoadingUnit_InstanceSize = 0x28; @@ -13054,11 +13106,13 @@ static constexpr dart::compiler::target::word AOT_WeakReference_type_arguments_o static constexpr dart::compiler::target::word AOT_Coroutine_caller_offset = 0x4; static constexpr dart::compiler::target::word AOT_Coroutine_entry_offset = 0x8; static constexpr dart::compiler::target::word AOT_Coroutine_stack_base_offset = - 0xc; + 0x14; static constexpr dart::compiler::target::word AOT_Coroutine_stack_limit_offset = - 0x10; + 0x18; +static constexpr dart::compiler::target::word + AOT_Coroutine_source_frame_pointer_offset = 0xc; static constexpr dart::compiler::target::word - AOT_Coroutine_top_exit_frame_offset = 0x14; + AOT_Coroutine_source_frame_size_offset = 0x10; static constexpr dart::compiler::target::word AOT_Code_entry_point_offset[] = {0x4, 0xc, 0x8, 0x10}; static constexpr dart::compiler::target::word AOT_Thread_write_barrier_wrappers_thread_offset[] = { @@ -13124,7 +13178,7 @@ static constexpr dart::compiler::target::word AOT_Sentinel_InstanceSize = 0x4; static constexpr dart::compiler::target::word AOT_SingleTargetCache_InstanceSize = 0x14; static constexpr dart::compiler::target::word AOT_StackTrace_InstanceSize = 0x14; static constexpr dart::compiler::target::word AOT_SuspendState_HeaderSize = 0x18; -static constexpr dart::compiler::target::word AOT_Coroutine_InstanceSize = 0x18; +static constexpr dart::compiler::target::word AOT_Coroutine_InstanceSize = 0x1c; static constexpr dart::compiler::target::word AOT_String_InstanceSize = 0xc; static constexpr dart::compiler::target::word AOT_SubtypeTestCache_InstanceSize = 0x10; static constexpr dart::compiler::target::word AOT_LoadingUnit_InstanceSize = 0x14; @@ -13603,11 +13657,13 @@ static constexpr dart::compiler::target::word AOT_WeakReference_type_arguments_o static constexpr dart::compiler::target::word AOT_Coroutine_caller_offset = 0x8; static constexpr dart::compiler::target::word AOT_Coroutine_entry_offset = 0x10; static constexpr dart::compiler::target::word AOT_Coroutine_stack_base_offset = - 0x18; + 0x28; static constexpr dart::compiler::target::word AOT_Coroutine_stack_limit_offset = - 0x20; + 0x30; +static constexpr dart::compiler::target::word + AOT_Coroutine_source_frame_pointer_offset = 0x18; static constexpr dart::compiler::target::word - AOT_Coroutine_top_exit_frame_offset = 0x28; + AOT_Coroutine_source_frame_size_offset = 0x20; static constexpr dart::compiler::target::word AOT_Code_entry_point_offset[] = {0x8, 0x18, 0x10, 0x20}; static constexpr dart::compiler::target::word AOT_Thread_write_barrier_wrappers_thread_offset[] = { @@ -13673,7 +13729,7 @@ static constexpr dart::compiler::target::word AOT_Sentinel_InstanceSize = 0x8; static constexpr dart::compiler::target::word AOT_SingleTargetCache_InstanceSize = 0x20; static constexpr dart::compiler::target::word AOT_StackTrace_InstanceSize = 0x28; static constexpr dart::compiler::target::word AOT_SuspendState_HeaderSize = 0x30; -static constexpr dart::compiler::target::word AOT_Coroutine_InstanceSize = 0x30; +static constexpr dart::compiler::target::word AOT_Coroutine_InstanceSize = 0x38; static constexpr dart::compiler::target::word AOT_String_InstanceSize = 0x10; static constexpr dart::compiler::target::word AOT_SubtypeTestCache_InstanceSize = 0x18; static constexpr dart::compiler::target::word AOT_LoadingUnit_InstanceSize = 0x28; @@ -14157,11 +14213,13 @@ static constexpr dart::compiler::target::word AOT_WeakReference_type_arguments_o static constexpr dart::compiler::target::word AOT_Coroutine_caller_offset = 0x8; static constexpr dart::compiler::target::word AOT_Coroutine_entry_offset = 0x10; static constexpr dart::compiler::target::word AOT_Coroutine_stack_base_offset = - 0x18; + 0x28; static constexpr dart::compiler::target::word AOT_Coroutine_stack_limit_offset = - 0x20; + 0x30; +static constexpr dart::compiler::target::word + AOT_Coroutine_source_frame_pointer_offset = 0x18; static constexpr dart::compiler::target::word - AOT_Coroutine_top_exit_frame_offset = 0x28; + AOT_Coroutine_source_frame_size_offset = 0x20; static constexpr dart::compiler::target::word AOT_Code_entry_point_offset[] = {0x8, 0x18, 0x10, 0x20}; static constexpr dart::compiler::target::word AOT_Thread_write_barrier_wrappers_thread_offset[] = { @@ -14229,7 +14287,7 @@ static constexpr dart::compiler::target::word AOT_Sentinel_InstanceSize = 0x8; static constexpr dart::compiler::target::word AOT_SingleTargetCache_InstanceSize = 0x20; static constexpr dart::compiler::target::word AOT_StackTrace_InstanceSize = 0x28; static constexpr dart::compiler::target::word AOT_SuspendState_HeaderSize = 0x30; -static constexpr dart::compiler::target::word AOT_Coroutine_InstanceSize = 0x30; +static constexpr dart::compiler::target::word AOT_Coroutine_InstanceSize = 0x38; static constexpr dart::compiler::target::word AOT_String_InstanceSize = 0x10; static constexpr dart::compiler::target::word AOT_SubtypeTestCache_InstanceSize = 0x18; static constexpr dart::compiler::target::word AOT_LoadingUnit_InstanceSize = 0x28; @@ -14709,11 +14767,13 @@ static constexpr dart::compiler::target::word AOT_WeakReference_type_arguments_o static constexpr dart::compiler::target::word AOT_Coroutine_caller_offset = 0x8; static constexpr dart::compiler::target::word AOT_Coroutine_entry_offset = 0xc; static constexpr dart::compiler::target::word AOT_Coroutine_stack_base_offset = - 0x10; + 0x20; static constexpr dart::compiler::target::word AOT_Coroutine_stack_limit_offset = - 0x18; + 0x28; static constexpr dart::compiler::target::word - AOT_Coroutine_top_exit_frame_offset = 0x20; + AOT_Coroutine_source_frame_pointer_offset = 0x10; +static constexpr dart::compiler::target::word + AOT_Coroutine_source_frame_size_offset = 0x18; static constexpr dart::compiler::target::word AOT_Code_entry_point_offset[] = {0x8, 0x18, 0x10, 0x20}; static constexpr dart::compiler::target::word AOT_Thread_write_barrier_wrappers_thread_offset[] = { @@ -14779,7 +14839,7 @@ static constexpr dart::compiler::target::word AOT_Sentinel_InstanceSize = 0x8; static constexpr dart::compiler::target::word AOT_SingleTargetCache_InstanceSize = 0x20; static constexpr dart::compiler::target::word AOT_StackTrace_InstanceSize = 0x18; static constexpr dart::compiler::target::word AOT_SuspendState_HeaderSize = 0x28; -static constexpr dart::compiler::target::word AOT_Coroutine_InstanceSize = 0x28; +static constexpr dart::compiler::target::word AOT_Coroutine_InstanceSize = 0x30; static constexpr dart::compiler::target::word AOT_String_InstanceSize = 0x10; static constexpr dart::compiler::target::word AOT_SubtypeTestCache_InstanceSize = 0x18; static constexpr dart::compiler::target::word AOT_LoadingUnit_InstanceSize = 0x20; @@ -15259,11 +15319,13 @@ static constexpr dart::compiler::target::word AOT_WeakReference_type_arguments_o static constexpr dart::compiler::target::word AOT_Coroutine_caller_offset = 0x8; static constexpr dart::compiler::target::word AOT_Coroutine_entry_offset = 0xc; static constexpr dart::compiler::target::word AOT_Coroutine_stack_base_offset = - 0x10; + 0x20; static constexpr dart::compiler::target::word AOT_Coroutine_stack_limit_offset = - 0x18; + 0x28; static constexpr dart::compiler::target::word - AOT_Coroutine_top_exit_frame_offset = 0x20; + AOT_Coroutine_source_frame_pointer_offset = 0x10; +static constexpr dart::compiler::target::word + AOT_Coroutine_source_frame_size_offset = 0x18; static constexpr dart::compiler::target::word AOT_Code_entry_point_offset[] = {0x8, 0x18, 0x10, 0x20}; static constexpr dart::compiler::target::word AOT_Thread_write_barrier_wrappers_thread_offset[] = { @@ -15331,7 +15393,7 @@ static constexpr dart::compiler::target::word AOT_Sentinel_InstanceSize = 0x8; static constexpr dart::compiler::target::word AOT_SingleTargetCache_InstanceSize = 0x20; static constexpr dart::compiler::target::word AOT_StackTrace_InstanceSize = 0x18; static constexpr dart::compiler::target::word AOT_SuspendState_HeaderSize = 0x28; -static constexpr dart::compiler::target::word AOT_Coroutine_InstanceSize = 0x28; +static constexpr dart::compiler::target::word AOT_Coroutine_InstanceSize = 0x30; static constexpr dart::compiler::target::word AOT_String_InstanceSize = 0x10; static constexpr dart::compiler::target::word AOT_SubtypeTestCache_InstanceSize = 0x18; static constexpr dart::compiler::target::word AOT_LoadingUnit_InstanceSize = 0x20; @@ -15810,11 +15872,13 @@ static constexpr dart::compiler::target::word AOT_WeakReference_type_arguments_o static constexpr dart::compiler::target::word AOT_Coroutine_caller_offset = 0x4; static constexpr dart::compiler::target::word AOT_Coroutine_entry_offset = 0x8; static constexpr dart::compiler::target::word AOT_Coroutine_stack_base_offset = - 0xc; + 0x14; static constexpr dart::compiler::target::word AOT_Coroutine_stack_limit_offset = - 0x10; + 0x18; +static constexpr dart::compiler::target::word + AOT_Coroutine_source_frame_pointer_offset = 0xc; static constexpr dart::compiler::target::word - AOT_Coroutine_top_exit_frame_offset = 0x14; + AOT_Coroutine_source_frame_size_offset = 0x10; static constexpr dart::compiler::target::word AOT_Code_entry_point_offset[] = {0x4, 0xc, 0x8, 0x10}; static constexpr dart::compiler::target::word AOT_Thread_write_barrier_wrappers_thread_offset[] = { @@ -15881,7 +15945,7 @@ static constexpr dart::compiler::target::word AOT_Sentinel_InstanceSize = 0x4; static constexpr dart::compiler::target::word AOT_SingleTargetCache_InstanceSize = 0x14; static constexpr dart::compiler::target::word AOT_StackTrace_InstanceSize = 0x14; static constexpr dart::compiler::target::word AOT_SuspendState_HeaderSize = 0x18; -static constexpr dart::compiler::target::word AOT_Coroutine_InstanceSize = 0x18; +static constexpr dart::compiler::target::word AOT_Coroutine_InstanceSize = 0x1c; static constexpr dart::compiler::target::word AOT_String_InstanceSize = 0xc; static constexpr dart::compiler::target::word AOT_SubtypeTestCache_InstanceSize = 0x10; static constexpr dart::compiler::target::word AOT_LoadingUnit_InstanceSize = 0x14; @@ -16360,11 +16424,13 @@ static constexpr dart::compiler::target::word AOT_WeakReference_type_arguments_o static constexpr dart::compiler::target::word AOT_Coroutine_caller_offset = 0x8; static constexpr dart::compiler::target::word AOT_Coroutine_entry_offset = 0x10; static constexpr dart::compiler::target::word AOT_Coroutine_stack_base_offset = - 0x18; + 0x28; static constexpr dart::compiler::target::word AOT_Coroutine_stack_limit_offset = - 0x20; + 0x30; static constexpr dart::compiler::target::word - AOT_Coroutine_top_exit_frame_offset = 0x28; + AOT_Coroutine_source_frame_pointer_offset = 0x18; +static constexpr dart::compiler::target::word + AOT_Coroutine_source_frame_size_offset = 0x20; static constexpr dart::compiler::target::word AOT_Code_entry_point_offset[] = {0x8, 0x18, 0x10, 0x20}; static constexpr dart::compiler::target::word AOT_Thread_write_barrier_wrappers_thread_offset[] = { @@ -16431,7 +16497,7 @@ static constexpr dart::compiler::target::word AOT_Sentinel_InstanceSize = 0x8; static constexpr dart::compiler::target::word AOT_SingleTargetCache_InstanceSize = 0x20; static constexpr dart::compiler::target::word AOT_StackTrace_InstanceSize = 0x28; static constexpr dart::compiler::target::word AOT_SuspendState_HeaderSize = 0x30; -static constexpr dart::compiler::target::word AOT_Coroutine_InstanceSize = 0x30; +static constexpr dart::compiler::target::word AOT_Coroutine_InstanceSize = 0x38; static constexpr dart::compiler::target::word AOT_String_InstanceSize = 0x10; static constexpr dart::compiler::target::word AOT_SubtypeTestCache_InstanceSize = 0x18; static constexpr dart::compiler::target::word AOT_LoadingUnit_InstanceSize = 0x28; diff --git a/runtime/vm/compiler/runtime_offsets_list.h b/runtime/vm/compiler/runtime_offsets_list.h index 04b407d05286..9959aa81a4b1 100644 --- a/runtime/vm/compiler/runtime_offsets_list.h +++ b/runtime/vm/compiler/runtime_offsets_list.h @@ -404,7 +404,8 @@ FIELD(Coroutine, entry_offset) \ FIELD(Coroutine, stack_base_offset) \ FIELD(Coroutine, stack_limit_offset) \ - FIELD(Coroutine, top_exit_frame_offset) \ + FIELD(Coroutine, source_frame_pointer_offset) \ + FIELD(Coroutine, source_frame_size_offset) \ RANGE(Code, entry_point_offset, CodeEntryKind, CodeEntryKind::kNormal, \ CodeEntryKind::kMonomorphicUnchecked, \ [](CodeEntryKind value) { return true; }) \ diff --git a/runtime/vm/constants_x64.h b/runtime/vm/constants_x64.h index 7b6a9d84a6fd..2c6f29be90a8 100644 --- a/runtime/vm/constants_x64.h +++ b/runtime/vm/constants_x64.h @@ -394,6 +394,10 @@ struct CoroutineEntryABI { struct CoroutineInitializeABI { static constexpr Register kCoroutineReg = CoroutineEntryABI::kCoroutineReg; + static constexpr Register kSourceFrameReg = RBX; + static constexpr Register kStoreFrameReg = RCX; + static constexpr Register kSourceFrameSizeReg = RDX; + static constexpr Register kTempReg = TMP; }; struct CoroutineForkABI { diff --git a/runtime/vm/heap/marker.cc b/runtime/vm/heap/marker.cc index 6e0466f6f23c..967f692da38b 100644 --- a/runtime/vm/heap/marker.cc +++ b/runtime/vm/heap/marker.cc @@ -3,7 +3,9 @@ // BSD-style license that can be found in the LICENSE file. #include "vm/heap/marker.h" +#include +#include "dart_api.h" #include "platform/assert.h" #include "platform/atomic.h" #include "vm/allocation.h" @@ -643,6 +645,13 @@ class MarkingVisitorBase : public ObjectPointerVisitor { return false; } + if (obj->untag()->IsCardRemembered()) { + if(!((obj->GetClassId() == kArrayCid) || (obj->GetClassId() == kImmutableArrayCid))) + { + Dart_DumpNativeStackTrace(nullptr); + raise(SIGINT); + } + } if (obj->IsNewObject()) { if (TryAcquireMarkBit(obj)) { new_work_list_.Push(obj); diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc index b2b29705495a..57cc426ef7c6 100644 --- a/runtime/vm/object.cc +++ b/runtime/vm/object.cc @@ -26629,11 +26629,11 @@ CodePtr SuspendState::GetCodeObject() const { #endif // defined(DART_PRECOMPILED_RUNTIME) } -CoroutinePtr Coroutine::New(void** stack_base, uintptr_t stack_size, FunctionPtr entry) { +CoroutinePtr Coroutine::New(void** source_frame_space, void** stack_base, uintptr_t stack_size, FunctionPtr entry) { const auto& coroutine = Coroutine::Handle(Object::Allocate(Heap::kOld)); coroutine.StoreNonPointer(&coroutine.untag()->stack_base_, (uword)stack_base); coroutine.StoreNonPointer(&coroutine.untag()->stack_limit_, (uword)stack_base - stack_size); - coroutine.StoreNonPointer(&coroutine.untag()->top_exit_frame_, 0); + coroutine.StoreNonPointer(&coroutine.untag()->source_frame_pointer_, (uword)source_frame_space); coroutine.StoreCompressedPointer(&coroutine.untag()->entry_, entry); coroutine.StoreCompressedPointer(&coroutine.untag()->caller_, coroutine.ptr()); return coroutine.ptr(); diff --git a/runtime/vm/object.h b/runtime/vm/object.h index db1034ef8a90..ae6585cd5a6d 100644 --- a/runtime/vm/object.h +++ b/runtime/vm/object.h @@ -12705,7 +12705,7 @@ class Coroutine : public Instance { static intptr_t InstanceSize() { return RoundedAllocationSize(sizeof(UntaggedCoroutine)); } - static CoroutinePtr New(void** stackb_base, uintptr_t stack_size, FunctionPtr entry); + static CoroutinePtr New(void** source_frame_space, void** stack_base, uintptr_t stack_size, FunctionPtr entry); CoroutinePtr caller() const { return untag()->caller(); } static uword caller_offset() { return OFFSET_OF(UntaggedCoroutine, caller_); } @@ -12723,9 +12723,14 @@ class Coroutine : public Instance { return OFFSET_OF(UntaggedCoroutine, stack_limit_); } - uword top_exit_frame() const { return untag()->top_exit_frame_; } - static uword top_exit_frame_offset() { - return OFFSET_OF(UntaggedCoroutine, top_exit_frame_); + uword source_frame_pointer() const { return untag()->source_frame_pointer_; } + static uword source_frame_pointer_offset() { + return OFFSET_OF(UntaggedCoroutine, source_frame_pointer_); + } + + uword source_frame_size() const { return untag()->source_frame_size_; } + static uword source_frame_size_offset() { + return OFFSET_OF(UntaggedCoroutine, source_frame_size_); } private: diff --git a/runtime/vm/raw_object.h b/runtime/vm/raw_object.h index f3ce94973b66..2811f8a8e34e 100644 --- a/runtime/vm/raw_object.h +++ b/runtime/vm/raw_object.h @@ -3781,9 +3781,10 @@ class UntaggedCoroutine : public UntaggedInstance { COMPRESSED_POINTER_FIELD(FunctionPtr, entry) VISIT_TO(entry) CompressedObjectPtr* to_snapshot(Snapshot::Kind kind) { return to(); } + uword source_frame_pointer_; + uword source_frame_size_; uword stack_base_; uword stack_limit_; - uword top_exit_frame_; public: uword stack_base() const { return stack_base_; } uword stack_limit() const { return stack_limit_; } diff --git a/runtime/vm/raw_object_fields.cc b/runtime/vm/raw_object_fields.cc index 9361fd0e0eea..e52d345e292a 100644 --- a/runtime/vm/raw_object_fields.cc +++ b/runtime/vm/raw_object_fields.cc @@ -236,7 +236,8 @@ namespace dart { F(Coroutine, entry_) \ F(Coroutine, stack_base_) \ F(Coroutine, stack_limit_) \ - F(Coroutine, top_exit_frame_) + F(Coroutine, source_frame_pointer_) \ + F(Coroutine, source_frame_size_) #define AOT_CLASSES_AND_FIELDS(F) diff --git a/runtime/vm/stack_frame.cc b/runtime/vm/stack_frame.cc index e4f640d43ddb..dffe05704201 100644 --- a/runtime/vm/stack_frame.cc +++ b/runtime/vm/stack_frame.cc @@ -186,6 +186,7 @@ void ExitFrame::VisitObjectPointers(ObjectPointerVisitor* visitor) { ObjectPtr* first_fixed = reinterpret_cast(fp()) + runtime_frame_layout.last_fixed_object_from_fp; if (first_fixed <= last_fixed) { + //OS::Print("ExitFrame::VisitObjectPointers\n"); visitor->VisitPointers(first_fixed, last_fixed); } else { ASSERT(runtime_frame_layout.first_object_from_fp == @@ -195,12 +196,12 @@ void ExitFrame::VisitObjectPointers(ObjectPointerVisitor* visitor) { void EntryFrame::VisitObjectPointers(ObjectPointerVisitor* visitor) { ASSERT(visitor != nullptr); - if (IsCoroutine()) return; // Visit objects between SP and (FP - callee_save_area). ObjectPtr* first = reinterpret_cast(sp()); ObjectPtr* last = reinterpret_cast(fp()) + kExitLinkSlotFromEntryFp - 1; // There may not be any pointer to visit; in this case, first > last. + //OS::Print("EntryFrame::VisitObjectPointers\n"); visitor->VisitPointers(first, last); } @@ -246,6 +247,10 @@ void StackFrame::VisitObjectPointers(ObjectPointerVisitor* visitor) { } } + //OS::Print("pc() = %p\n", (void*)pc()); + //OS::Print("sp() = %p\n", (void*)sp()); + //OS::Print("fp() = %p\n", (void*)fp()); + //OS::Print("maps.IsNull() = %d\n", (int)maps.IsNull()); if (!maps.IsNull()) { // Optimized frames have a stack map. We need to visit the frame based // on the stack map. @@ -253,6 +258,8 @@ void StackFrame::VisitObjectPointers(ObjectPointerVisitor* visitor) { maps, global_table); const uint32_t pc_offset = pc() - code_start; bool found = it.Find(pc_offset); + //OS::Print("code_start = %p\n", (void*)code_start); + //OS::Print("stack map found = %d\n", (int)found); if (found) { ObjectPtr* first = reinterpret_cast(sp()); ObjectPtr* last = reinterpret_cast( @@ -628,6 +635,16 @@ void StackFrameIterator::FrameSetIterator::Unpoison() { StackFrame* StackFrameIterator::FrameSetIterator::NextFrame(bool validate) { StackFrame* frame; ASSERT(HasNext()); + if (StubCode::InCoroutineEntryStub(stack_frame_.pc_)) { + frame = &stack_frame_; + frame->sp_ = sp_; + frame->fp_ = fp_; + frame->pc_ = pc_; + sp_ = frame->GetCallerSp(); + fp_ = frame->GetCallerFp(); + pc_ = frame->GetCallerPc(); + return NextFrame(validate); + } frame = &stack_frame_; frame->sp_ = sp_; frame->fp_ = fp_; @@ -657,13 +674,6 @@ EntryFrame* StackFrameIterator::NextEntryFrame() { entry_.sp_ = frames_.sp_; entry_.fp_ = frames_.fp_; entry_.pc_ = frames_.pc_; - if (entry_.IsCoroutine()) { - frames_.fp_ = 0; - frames_.sp_ = 0; - frames_.pc_ = 0; - frames_.Unpoison(); - return &entry_; - } SetupNextExitFrameData(); // Setup data for next exit frame in chain. ASSERT(!validate_ || entry_.IsValid()); return &entry_; diff --git a/runtime/vm/stack_frame.h b/runtime/vm/stack_frame.h index 83db53abab18..07a00a1b32e2 100644 --- a/runtime/vm/stack_frame.h +++ b/runtime/vm/stack_frame.h @@ -193,8 +193,7 @@ class ExitFrame : public StackFrame { // dart code. class EntryFrame : public StackFrame { public: - bool IsValid() const { return StubCode::InInvocationStub(pc()) || StubCode::InCoroutineEntryStub(pc()); } - bool IsCoroutine() const { return StubCode::InCoroutineEntryStub(pc()); } + bool IsValid() const { return StubCode::InInvocationStub(pc()); } bool IsDartFrame(bool validate = true) const { return false; } bool IsStubFrame() const { return false; } bool IsEntryFrame() const { return true; } @@ -265,7 +264,7 @@ class StackFrameIterator { } const uword pc = *(reinterpret_cast(sp_ + (kSavedPcSlotFromSp * kWordSize))); - return !StubCode::InInvocationStub(pc) && !StubCode::InCoroutineEntryStub(pc); + return !StubCode::InInvocationStub(pc); } // Get next non entry/exit frame in the set (assumes a next frame exists). diff --git a/tests/lib/fiber/fiber_test.dart b/tests/lib/fiber/fiber_test.dart index da387c751aa4..42fae14590a7 100644 --- a/tests/lib/fiber/fiber_test.dart +++ b/tests/lib/fiber/fiber_test.dart @@ -8,31 +8,31 @@ var commonState = ""; void main() { while (true) { - print("before idle"); + //print("before idle"); Fiber.idle(); - print("after idle"); + //print("after idle"); commonState = ""; - print("before start"); + //print("before start"); mainFiber.start(); - print("after start"); + //print("after start"); } } void mainEntry() { - print("main: entry"); + //print("main: entry"); commonState += "main -> "; mainFiber.fork(childFiber); - print("main: after child fork"); + //print("main: after child fork"); commonState += "main -> "; - print("main: after child transfer"); + //print("main: after child transfer"); mainFiber.transfer(childFiber); print(commonState); } void childEntry() { - print("child: entry"); + //print("child: entry"); commonState += "child -> "; childFiber.transfer(mainFiber); - print("child: after main transfer"); + //print("child: after main transfer"); commonState += "child"; } From c063aaeb96ba0345176031b2f0d7c39b9be48115 Mon Sep 17 00:00:00 2001 From: "anton.bashirov" Date: Sun, 8 Sep 2024 00:59:44 +0400 Subject: [PATCH 34/35] fibers --- runtime/lib/fiber.cc | 10 +- runtime/vm/compiler/runtime_api.h | 2 - .../vm/compiler/runtime_offsets_extracted.h | 306 ++++++------------ runtime/vm/compiler/runtime_offsets_list.h | 2 - runtime/vm/heap/marker.cc | 9 - runtime/vm/object.cc | 3 +- runtime/vm/object.h | 12 +- runtime/vm/raw_object.h | 2 - runtime/vm/raw_object_fields.cc | 4 +- runtime/vm/stack_frame.cc | 8 - tests/lib/fiber/fiber_test.dart | 1 + 11 files changed, 100 insertions(+), 259 deletions(-) diff --git a/runtime/lib/fiber.cc b/runtime/lib/fiber.cc index f023900f4471..0f6e9e19cebf 100644 --- a/runtime/lib/fiber.cc +++ b/runtime/lib/fiber.cc @@ -14,10 +14,12 @@ DEFINE_NATIVE_ENTRY(Coroutine_factory, 0, 3) { GET_NON_NULL_NATIVE_ARGUMENT(Smi, size, arguments->NativeArgAt(1)); GET_NON_NULL_NATIVE_ARGUMENT(Closure, entry, arguments->NativeArgAt(2)); intptr_t stack_size = size.Value(); - void** stack_base = (void**)((uintptr_t)mmap(0, stack_size * kWordSize, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0)); +#if defined(DART_TARGET_OS_WINDOWS) + void** stack_base = (void**)((uintptr_t)VirtualAlloc(nullptr, stack_size * kWordSize, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE)); +#else + void** stack_base = (void**)((uintptr_t)mmap(nullptr, stack_size * kWordSize, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0)); +#endif memset(stack_base, 0, stack_size * kWordSize); - void** source_frame_space = (void**)((uintptr_t)mmap(0, stack_size * kWordSize, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0)); - memset(source_frame_space, 0, stack_size * kWordSize); - return Coroutine::New(source_frame_space, stack_base + stack_size , stack_size, Function::Handle(entry.function()).ptr()); + return Coroutine::New(stack_base + stack_size , stack_size, Function::Handle(entry.function()).ptr()); } } // namespace dart diff --git a/runtime/vm/compiler/runtime_api.h b/runtime/vm/compiler/runtime_api.h index ae43e6c8fadc..37a35915e09b 100644 --- a/runtime/vm/compiler/runtime_api.h +++ b/runtime/vm/compiler/runtime_api.h @@ -1040,8 +1040,6 @@ class Coroutine : public AllStatic { static word entry_offset(); static word stack_base_offset(); static word stack_limit_offset(); - static word source_frame_size_offset(); - static word source_frame_pointer_offset(); static word InstanceSize(); FINAL_CLASS(); }; diff --git a/runtime/vm/compiler/runtime_offsets_extracted.h b/runtime/vm/compiler/runtime_offsets_extracted.h index 30f2d72c5dd0..b2f226f26967 100644 --- a/runtime/vm/compiler/runtime_offsets_extracted.h +++ b/runtime/vm/compiler/runtime_offsets_extracted.h @@ -467,14 +467,9 @@ static constexpr dart::compiler::target::word WeakReference_target_offset = 0x4; static constexpr dart::compiler::target::word WeakReference_type_arguments_offset = 0x8; static constexpr dart::compiler::target::word Coroutine_caller_offset = 0x4; static constexpr dart::compiler::target::word Coroutine_entry_offset = 0x8; -static constexpr dart::compiler::target::word Coroutine_stack_base_offset = - 0x14; +static constexpr dart::compiler::target::word Coroutine_stack_base_offset = 0xc; static constexpr dart::compiler::target::word Coroutine_stack_limit_offset = - 0x18; -static constexpr dart::compiler::target::word - Coroutine_source_frame_pointer_offset = 0xc; -static constexpr dart::compiler::target::word - Coroutine_source_frame_size_offset = 0x10; + 0x10; static constexpr dart::compiler::target::word Code_entry_point_offset[] = {0x4, 0xc, 0x8, 0x10}; static constexpr dart::compiler::target::word Thread_write_barrier_wrappers_thread_offset[] = { @@ -540,7 +535,7 @@ static constexpr dart::compiler::target::word Sentinel_InstanceSize = 0x4; static constexpr dart::compiler::target::word SingleTargetCache_InstanceSize = 0x14; static constexpr dart::compiler::target::word StackTrace_InstanceSize = 0x14; static constexpr dart::compiler::target::word SuspendState_HeaderSize = 0x1c; -static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x1c; +static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x14; static constexpr dart::compiler::target::word String_InstanceSize = 0xc; static constexpr dart::compiler::target::word SubtypeTestCache_InstanceSize = 0x10; static constexpr dart::compiler::target::word LoadingUnit_InstanceSize = 0x14; @@ -1015,13 +1010,9 @@ static constexpr dart::compiler::target::word WeakReference_type_arguments_offse static constexpr dart::compiler::target::word Coroutine_caller_offset = 0x8; static constexpr dart::compiler::target::word Coroutine_entry_offset = 0x10; static constexpr dart::compiler::target::word Coroutine_stack_base_offset = - 0x28; + 0x18; static constexpr dart::compiler::target::word Coroutine_stack_limit_offset = - 0x30; -static constexpr dart::compiler::target::word - Coroutine_source_frame_pointer_offset = 0x18; -static constexpr dart::compiler::target::word - Coroutine_source_frame_size_offset = 0x20; + 0x20; static constexpr dart::compiler::target::word Code_entry_point_offset[] = {0x8, 0x18, 0x10, 0x20}; static constexpr dart::compiler::target::word Thread_write_barrier_wrappers_thread_offset[] = { @@ -1087,7 +1078,7 @@ static constexpr dart::compiler::target::word Sentinel_InstanceSize = 0x8; static constexpr dart::compiler::target::word SingleTargetCache_InstanceSize = 0x20; static constexpr dart::compiler::target::word StackTrace_InstanceSize = 0x28; static constexpr dart::compiler::target::word SuspendState_HeaderSize = 0x38; -static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x38; +static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x28; static constexpr dart::compiler::target::word String_InstanceSize = 0x10; static constexpr dart::compiler::target::word SubtypeTestCache_InstanceSize = 0x18; static constexpr dart::compiler::target::word LoadingUnit_InstanceSize = 0x28; @@ -1561,14 +1552,9 @@ static constexpr dart::compiler::target::word WeakReference_target_offset = 0x4; static constexpr dart::compiler::target::word WeakReference_type_arguments_offset = 0x8; static constexpr dart::compiler::target::word Coroutine_caller_offset = 0x4; static constexpr dart::compiler::target::word Coroutine_entry_offset = 0x8; -static constexpr dart::compiler::target::word Coroutine_stack_base_offset = - 0x14; +static constexpr dart::compiler::target::word Coroutine_stack_base_offset = 0xc; static constexpr dart::compiler::target::word Coroutine_stack_limit_offset = - 0x18; -static constexpr dart::compiler::target::word - Coroutine_source_frame_pointer_offset = 0xc; -static constexpr dart::compiler::target::word - Coroutine_source_frame_size_offset = 0x10; + 0x10; static constexpr dart::compiler::target::word Code_entry_point_offset[] = {0x4, 0xc, 0x8, 0x10}; static constexpr dart::compiler::target::word Thread_write_barrier_wrappers_thread_offset[] = { @@ -1633,7 +1619,7 @@ static constexpr dart::compiler::target::word Sentinel_InstanceSize = 0x4; static constexpr dart::compiler::target::word SingleTargetCache_InstanceSize = 0x14; static constexpr dart::compiler::target::word StackTrace_InstanceSize = 0x14; static constexpr dart::compiler::target::word SuspendState_HeaderSize = 0x1c; -static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x1c; +static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x14; static constexpr dart::compiler::target::word String_InstanceSize = 0xc; static constexpr dart::compiler::target::word SubtypeTestCache_InstanceSize = 0x10; static constexpr dart::compiler::target::word LoadingUnit_InstanceSize = 0x14; @@ -2108,13 +2094,9 @@ static constexpr dart::compiler::target::word WeakReference_type_arguments_offse static constexpr dart::compiler::target::word Coroutine_caller_offset = 0x8; static constexpr dart::compiler::target::word Coroutine_entry_offset = 0x10; static constexpr dart::compiler::target::word Coroutine_stack_base_offset = - 0x28; + 0x18; static constexpr dart::compiler::target::word Coroutine_stack_limit_offset = - 0x30; -static constexpr dart::compiler::target::word - Coroutine_source_frame_pointer_offset = 0x18; -static constexpr dart::compiler::target::word - Coroutine_source_frame_size_offset = 0x20; + 0x20; static constexpr dart::compiler::target::word Code_entry_point_offset[] = {0x8, 0x18, 0x10, 0x20}; static constexpr dart::compiler::target::word Thread_write_barrier_wrappers_thread_offset[] = { @@ -2182,7 +2164,7 @@ static constexpr dart::compiler::target::word Sentinel_InstanceSize = 0x8; static constexpr dart::compiler::target::word SingleTargetCache_InstanceSize = 0x20; static constexpr dart::compiler::target::word StackTrace_InstanceSize = 0x28; static constexpr dart::compiler::target::word SuspendState_HeaderSize = 0x38; -static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x38; +static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x28; static constexpr dart::compiler::target::word String_InstanceSize = 0x10; static constexpr dart::compiler::target::word SubtypeTestCache_InstanceSize = 0x18; static constexpr dart::compiler::target::word LoadingUnit_InstanceSize = 0x28; @@ -2658,13 +2640,9 @@ static constexpr dart::compiler::target::word WeakReference_type_arguments_offse static constexpr dart::compiler::target::word Coroutine_caller_offset = 0x8; static constexpr dart::compiler::target::word Coroutine_entry_offset = 0xc; static constexpr dart::compiler::target::word Coroutine_stack_base_offset = - 0x20; + 0x10; static constexpr dart::compiler::target::word Coroutine_stack_limit_offset = - 0x28; -static constexpr dart::compiler::target::word - Coroutine_source_frame_pointer_offset = 0x10; -static constexpr dart::compiler::target::word - Coroutine_source_frame_size_offset = 0x18; + 0x18; static constexpr dart::compiler::target::word Code_entry_point_offset[] = {0x8, 0x18, 0x10, 0x20}; static constexpr dart::compiler::target::word Thread_write_barrier_wrappers_thread_offset[] = { @@ -2730,7 +2708,7 @@ static constexpr dart::compiler::target::word Sentinel_InstanceSize = 0x8; static constexpr dart::compiler::target::word SingleTargetCache_InstanceSize = 0x20; static constexpr dart::compiler::target::word StackTrace_InstanceSize = 0x18; static constexpr dart::compiler::target::word SuspendState_HeaderSize = 0x30; -static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x30; +static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x20; static constexpr dart::compiler::target::word String_InstanceSize = 0x10; static constexpr dart::compiler::target::word SubtypeTestCache_InstanceSize = 0x18; static constexpr dart::compiler::target::word LoadingUnit_InstanceSize = 0x20; @@ -3206,13 +3184,9 @@ static constexpr dart::compiler::target::word WeakReference_type_arguments_offse static constexpr dart::compiler::target::word Coroutine_caller_offset = 0x8; static constexpr dart::compiler::target::word Coroutine_entry_offset = 0xc; static constexpr dart::compiler::target::word Coroutine_stack_base_offset = - 0x20; + 0x10; static constexpr dart::compiler::target::word Coroutine_stack_limit_offset = - 0x28; -static constexpr dart::compiler::target::word - Coroutine_source_frame_pointer_offset = 0x10; -static constexpr dart::compiler::target::word - Coroutine_source_frame_size_offset = 0x18; + 0x18; static constexpr dart::compiler::target::word Code_entry_point_offset[] = {0x8, 0x18, 0x10, 0x20}; static constexpr dart::compiler::target::word Thread_write_barrier_wrappers_thread_offset[] = { @@ -3280,7 +3254,7 @@ static constexpr dart::compiler::target::word Sentinel_InstanceSize = 0x8; static constexpr dart::compiler::target::word SingleTargetCache_InstanceSize = 0x20; static constexpr dart::compiler::target::word StackTrace_InstanceSize = 0x18; static constexpr dart::compiler::target::word SuspendState_HeaderSize = 0x30; -static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x30; +static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x20; static constexpr dart::compiler::target::word String_InstanceSize = 0x10; static constexpr dart::compiler::target::word SubtypeTestCache_InstanceSize = 0x18; static constexpr dart::compiler::target::word LoadingUnit_InstanceSize = 0x20; @@ -3754,14 +3728,9 @@ static constexpr dart::compiler::target::word WeakReference_target_offset = 0x4; static constexpr dart::compiler::target::word WeakReference_type_arguments_offset = 0x8; static constexpr dart::compiler::target::word Coroutine_caller_offset = 0x4; static constexpr dart::compiler::target::word Coroutine_entry_offset = 0x8; -static constexpr dart::compiler::target::word Coroutine_stack_base_offset = - 0x14; +static constexpr dart::compiler::target::word Coroutine_stack_base_offset = 0xc; static constexpr dart::compiler::target::word Coroutine_stack_limit_offset = - 0x18; -static constexpr dart::compiler::target::word - Coroutine_source_frame_pointer_offset = 0xc; -static constexpr dart::compiler::target::word - Coroutine_source_frame_size_offset = 0x10; + 0x10; static constexpr dart::compiler::target::word Code_entry_point_offset[] = {0x4, 0xc, 0x8, 0x10}; static constexpr dart::compiler::target::word Thread_write_barrier_wrappers_thread_offset[] = { @@ -3828,7 +3797,7 @@ static constexpr dart::compiler::target::word Sentinel_InstanceSize = 0x4; static constexpr dart::compiler::target::word SingleTargetCache_InstanceSize = 0x14; static constexpr dart::compiler::target::word StackTrace_InstanceSize = 0x14; static constexpr dart::compiler::target::word SuspendState_HeaderSize = 0x1c; -static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x1c; +static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x14; static constexpr dart::compiler::target::word String_InstanceSize = 0xc; static constexpr dart::compiler::target::word SubtypeTestCache_InstanceSize = 0x10; static constexpr dart::compiler::target::word LoadingUnit_InstanceSize = 0x14; @@ -4303,13 +4272,9 @@ static constexpr dart::compiler::target::word WeakReference_type_arguments_offse static constexpr dart::compiler::target::word Coroutine_caller_offset = 0x8; static constexpr dart::compiler::target::word Coroutine_entry_offset = 0x10; static constexpr dart::compiler::target::word Coroutine_stack_base_offset = - 0x28; + 0x18; static constexpr dart::compiler::target::word Coroutine_stack_limit_offset = - 0x30; -static constexpr dart::compiler::target::word - Coroutine_source_frame_pointer_offset = 0x18; -static constexpr dart::compiler::target::word - Coroutine_source_frame_size_offset = 0x20; + 0x20; static constexpr dart::compiler::target::word Code_entry_point_offset[] = {0x8, 0x18, 0x10, 0x20}; static constexpr dart::compiler::target::word Thread_write_barrier_wrappers_thread_offset[] = { @@ -4376,7 +4341,7 @@ static constexpr dart::compiler::target::word Sentinel_InstanceSize = 0x8; static constexpr dart::compiler::target::word SingleTargetCache_InstanceSize = 0x20; static constexpr dart::compiler::target::word StackTrace_InstanceSize = 0x28; static constexpr dart::compiler::target::word SuspendState_HeaderSize = 0x38; -static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x38; +static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x28; static constexpr dart::compiler::target::word String_InstanceSize = 0x10; static constexpr dart::compiler::target::word SubtypeTestCache_InstanceSize = 0x18; static constexpr dart::compiler::target::word LoadingUnit_InstanceSize = 0x28; @@ -4845,14 +4810,9 @@ static constexpr dart::compiler::target::word WeakReference_target_offset = 0x4; static constexpr dart::compiler::target::word WeakReference_type_arguments_offset = 0x8; static constexpr dart::compiler::target::word Coroutine_caller_offset = 0x4; static constexpr dart::compiler::target::word Coroutine_entry_offset = 0x8; -static constexpr dart::compiler::target::word Coroutine_stack_base_offset = - 0x14; +static constexpr dart::compiler::target::word Coroutine_stack_base_offset = 0xc; static constexpr dart::compiler::target::word Coroutine_stack_limit_offset = - 0x18; -static constexpr dart::compiler::target::word - Coroutine_source_frame_pointer_offset = 0xc; -static constexpr dart::compiler::target::word - Coroutine_source_frame_size_offset = 0x10; + 0x10; static constexpr dart::compiler::target::word Code_entry_point_offset[] = {0x4, 0xc, 0x8, 0x10}; static constexpr dart::compiler::target::word Thread_write_barrier_wrappers_thread_offset[] = { @@ -4918,7 +4878,7 @@ static constexpr dart::compiler::target::word Sentinel_InstanceSize = 0x4; static constexpr dart::compiler::target::word SingleTargetCache_InstanceSize = 0x14; static constexpr dart::compiler::target::word StackTrace_InstanceSize = 0x14; static constexpr dart::compiler::target::word SuspendState_HeaderSize = 0x1c; -static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x1c; +static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x14; static constexpr dart::compiler::target::word String_InstanceSize = 0xc; static constexpr dart::compiler::target::word SubtypeTestCache_InstanceSize = 0x10; static constexpr dart::compiler::target::word LoadingUnit_InstanceSize = 0x14; @@ -5388,13 +5348,9 @@ static constexpr dart::compiler::target::word WeakReference_type_arguments_offse static constexpr dart::compiler::target::word Coroutine_caller_offset = 0x8; static constexpr dart::compiler::target::word Coroutine_entry_offset = 0x10; static constexpr dart::compiler::target::word Coroutine_stack_base_offset = - 0x28; + 0x18; static constexpr dart::compiler::target::word Coroutine_stack_limit_offset = - 0x30; -static constexpr dart::compiler::target::word - Coroutine_source_frame_pointer_offset = 0x18; -static constexpr dart::compiler::target::word - Coroutine_source_frame_size_offset = 0x20; + 0x20; static constexpr dart::compiler::target::word Code_entry_point_offset[] = {0x8, 0x18, 0x10, 0x20}; static constexpr dart::compiler::target::word Thread_write_barrier_wrappers_thread_offset[] = { @@ -5460,7 +5416,7 @@ static constexpr dart::compiler::target::word Sentinel_InstanceSize = 0x8; static constexpr dart::compiler::target::word SingleTargetCache_InstanceSize = 0x20; static constexpr dart::compiler::target::word StackTrace_InstanceSize = 0x28; static constexpr dart::compiler::target::word SuspendState_HeaderSize = 0x38; -static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x38; +static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x28; static constexpr dart::compiler::target::word String_InstanceSize = 0x10; static constexpr dart::compiler::target::word SubtypeTestCache_InstanceSize = 0x18; static constexpr dart::compiler::target::word LoadingUnit_InstanceSize = 0x28; @@ -5929,14 +5885,9 @@ static constexpr dart::compiler::target::word WeakReference_target_offset = 0x4; static constexpr dart::compiler::target::word WeakReference_type_arguments_offset = 0x8; static constexpr dart::compiler::target::word Coroutine_caller_offset = 0x4; static constexpr dart::compiler::target::word Coroutine_entry_offset = 0x8; -static constexpr dart::compiler::target::word Coroutine_stack_base_offset = - 0x14; +static constexpr dart::compiler::target::word Coroutine_stack_base_offset = 0xc; static constexpr dart::compiler::target::word Coroutine_stack_limit_offset = - 0x18; -static constexpr dart::compiler::target::word - Coroutine_source_frame_pointer_offset = 0xc; -static constexpr dart::compiler::target::word - Coroutine_source_frame_size_offset = 0x10; + 0x10; static constexpr dart::compiler::target::word Code_entry_point_offset[] = {0x4, 0xc, 0x8, 0x10}; static constexpr dart::compiler::target::word Thread_write_barrier_wrappers_thread_offset[] = { @@ -6001,7 +5952,7 @@ static constexpr dart::compiler::target::word Sentinel_InstanceSize = 0x4; static constexpr dart::compiler::target::word SingleTargetCache_InstanceSize = 0x14; static constexpr dart::compiler::target::word StackTrace_InstanceSize = 0x14; static constexpr dart::compiler::target::word SuspendState_HeaderSize = 0x1c; -static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x1c; +static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x14; static constexpr dart::compiler::target::word String_InstanceSize = 0xc; static constexpr dart::compiler::target::word SubtypeTestCache_InstanceSize = 0x10; static constexpr dart::compiler::target::word LoadingUnit_InstanceSize = 0x14; @@ -6471,13 +6422,9 @@ static constexpr dart::compiler::target::word WeakReference_type_arguments_offse static constexpr dart::compiler::target::word Coroutine_caller_offset = 0x8; static constexpr dart::compiler::target::word Coroutine_entry_offset = 0x10; static constexpr dart::compiler::target::word Coroutine_stack_base_offset = - 0x28; + 0x18; static constexpr dart::compiler::target::word Coroutine_stack_limit_offset = - 0x30; -static constexpr dart::compiler::target::word - Coroutine_source_frame_pointer_offset = 0x18; -static constexpr dart::compiler::target::word - Coroutine_source_frame_size_offset = 0x20; + 0x20; static constexpr dart::compiler::target::word Code_entry_point_offset[] = {0x8, 0x18, 0x10, 0x20}; static constexpr dart::compiler::target::word Thread_write_barrier_wrappers_thread_offset[] = { @@ -6545,7 +6492,7 @@ static constexpr dart::compiler::target::word Sentinel_InstanceSize = 0x8; static constexpr dart::compiler::target::word SingleTargetCache_InstanceSize = 0x20; static constexpr dart::compiler::target::word StackTrace_InstanceSize = 0x28; static constexpr dart::compiler::target::word SuspendState_HeaderSize = 0x38; -static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x38; +static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x28; static constexpr dart::compiler::target::word String_InstanceSize = 0x10; static constexpr dart::compiler::target::word SubtypeTestCache_InstanceSize = 0x18; static constexpr dart::compiler::target::word LoadingUnit_InstanceSize = 0x28; @@ -7016,13 +6963,9 @@ static constexpr dart::compiler::target::word WeakReference_type_arguments_offse static constexpr dart::compiler::target::word Coroutine_caller_offset = 0x8; static constexpr dart::compiler::target::word Coroutine_entry_offset = 0xc; static constexpr dart::compiler::target::word Coroutine_stack_base_offset = - 0x20; + 0x10; static constexpr dart::compiler::target::word Coroutine_stack_limit_offset = - 0x28; -static constexpr dart::compiler::target::word - Coroutine_source_frame_pointer_offset = 0x10; -static constexpr dart::compiler::target::word - Coroutine_source_frame_size_offset = 0x18; + 0x18; static constexpr dart::compiler::target::word Code_entry_point_offset[] = {0x8, 0x18, 0x10, 0x20}; static constexpr dart::compiler::target::word Thread_write_barrier_wrappers_thread_offset[] = { @@ -7088,7 +7031,7 @@ static constexpr dart::compiler::target::word Sentinel_InstanceSize = 0x8; static constexpr dart::compiler::target::word SingleTargetCache_InstanceSize = 0x20; static constexpr dart::compiler::target::word StackTrace_InstanceSize = 0x18; static constexpr dart::compiler::target::word SuspendState_HeaderSize = 0x30; -static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x30; +static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x20; static constexpr dart::compiler::target::word String_InstanceSize = 0x10; static constexpr dart::compiler::target::word SubtypeTestCache_InstanceSize = 0x18; static constexpr dart::compiler::target::word LoadingUnit_InstanceSize = 0x20; @@ -7559,13 +7502,9 @@ static constexpr dart::compiler::target::word WeakReference_type_arguments_offse static constexpr dart::compiler::target::word Coroutine_caller_offset = 0x8; static constexpr dart::compiler::target::word Coroutine_entry_offset = 0xc; static constexpr dart::compiler::target::word Coroutine_stack_base_offset = - 0x20; + 0x10; static constexpr dart::compiler::target::word Coroutine_stack_limit_offset = - 0x28; -static constexpr dart::compiler::target::word - Coroutine_source_frame_pointer_offset = 0x10; -static constexpr dart::compiler::target::word - Coroutine_source_frame_size_offset = 0x18; + 0x18; static constexpr dart::compiler::target::word Code_entry_point_offset[] = {0x8, 0x18, 0x10, 0x20}; static constexpr dart::compiler::target::word Thread_write_barrier_wrappers_thread_offset[] = { @@ -7633,7 +7572,7 @@ static constexpr dart::compiler::target::word Sentinel_InstanceSize = 0x8; static constexpr dart::compiler::target::word SingleTargetCache_InstanceSize = 0x20; static constexpr dart::compiler::target::word StackTrace_InstanceSize = 0x18; static constexpr dart::compiler::target::word SuspendState_HeaderSize = 0x30; -static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x30; +static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x20; static constexpr dart::compiler::target::word String_InstanceSize = 0x10; static constexpr dart::compiler::target::word SubtypeTestCache_InstanceSize = 0x18; static constexpr dart::compiler::target::word LoadingUnit_InstanceSize = 0x20; @@ -8102,14 +8041,9 @@ static constexpr dart::compiler::target::word WeakReference_target_offset = 0x4; static constexpr dart::compiler::target::word WeakReference_type_arguments_offset = 0x8; static constexpr dart::compiler::target::word Coroutine_caller_offset = 0x4; static constexpr dart::compiler::target::word Coroutine_entry_offset = 0x8; -static constexpr dart::compiler::target::word Coroutine_stack_base_offset = - 0x14; +static constexpr dart::compiler::target::word Coroutine_stack_base_offset = 0xc; static constexpr dart::compiler::target::word Coroutine_stack_limit_offset = - 0x18; -static constexpr dart::compiler::target::word - Coroutine_source_frame_pointer_offset = 0xc; -static constexpr dart::compiler::target::word - Coroutine_source_frame_size_offset = 0x10; + 0x10; static constexpr dart::compiler::target::word Code_entry_point_offset[] = {0x4, 0xc, 0x8, 0x10}; static constexpr dart::compiler::target::word Thread_write_barrier_wrappers_thread_offset[] = { @@ -8176,7 +8110,7 @@ static constexpr dart::compiler::target::word Sentinel_InstanceSize = 0x4; static constexpr dart::compiler::target::word SingleTargetCache_InstanceSize = 0x14; static constexpr dart::compiler::target::word StackTrace_InstanceSize = 0x14; static constexpr dart::compiler::target::word SuspendState_HeaderSize = 0x1c; -static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x1c; +static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x14; static constexpr dart::compiler::target::word String_InstanceSize = 0xc; static constexpr dart::compiler::target::word SubtypeTestCache_InstanceSize = 0x10; static constexpr dart::compiler::target::word LoadingUnit_InstanceSize = 0x14; @@ -8646,13 +8580,9 @@ static constexpr dart::compiler::target::word WeakReference_type_arguments_offse static constexpr dart::compiler::target::word Coroutine_caller_offset = 0x8; static constexpr dart::compiler::target::word Coroutine_entry_offset = 0x10; static constexpr dart::compiler::target::word Coroutine_stack_base_offset = - 0x28; + 0x18; static constexpr dart::compiler::target::word Coroutine_stack_limit_offset = - 0x30; -static constexpr dart::compiler::target::word - Coroutine_source_frame_pointer_offset = 0x18; -static constexpr dart::compiler::target::word - Coroutine_source_frame_size_offset = 0x20; + 0x20; static constexpr dart::compiler::target::word Code_entry_point_offset[] = {0x8, 0x18, 0x10, 0x20}; static constexpr dart::compiler::target::word Thread_write_barrier_wrappers_thread_offset[] = { @@ -8719,7 +8649,7 @@ static constexpr dart::compiler::target::word Sentinel_InstanceSize = 0x8; static constexpr dart::compiler::target::word SingleTargetCache_InstanceSize = 0x20; static constexpr dart::compiler::target::word StackTrace_InstanceSize = 0x28; static constexpr dart::compiler::target::word SuspendState_HeaderSize = 0x38; -static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x38; +static constexpr dart::compiler::target::word Coroutine_InstanceSize = 0x28; static constexpr dart::compiler::target::word String_InstanceSize = 0x10; static constexpr dart::compiler::target::word SubtypeTestCache_InstanceSize = 0x18; static constexpr dart::compiler::target::word LoadingUnit_InstanceSize = 0x28; @@ -9203,13 +9133,9 @@ static constexpr dart::compiler::target::word AOT_WeakReference_type_arguments_o static constexpr dart::compiler::target::word AOT_Coroutine_caller_offset = 0x4; static constexpr dart::compiler::target::word AOT_Coroutine_entry_offset = 0x8; static constexpr dart::compiler::target::word AOT_Coroutine_stack_base_offset = - 0x14; + 0xc; static constexpr dart::compiler::target::word AOT_Coroutine_stack_limit_offset = - 0x18; -static constexpr dart::compiler::target::word - AOT_Coroutine_source_frame_pointer_offset = 0xc; -static constexpr dart::compiler::target::word - AOT_Coroutine_source_frame_size_offset = 0x10; + 0x10; static constexpr dart::compiler::target::word AOT_Code_entry_point_offset[] = {0x4, 0xc, 0x8, 0x10}; static constexpr dart::compiler::target::word AOT_Thread_write_barrier_wrappers_thread_offset[] = { @@ -9275,7 +9201,7 @@ static constexpr dart::compiler::target::word AOT_Sentinel_InstanceSize = 0x4; static constexpr dart::compiler::target::word AOT_SingleTargetCache_InstanceSize = 0x14; static constexpr dart::compiler::target::word AOT_StackTrace_InstanceSize = 0x14; static constexpr dart::compiler::target::word AOT_SuspendState_HeaderSize = 0x18; -static constexpr dart::compiler::target::word AOT_Coroutine_InstanceSize = 0x1c; +static constexpr dart::compiler::target::word AOT_Coroutine_InstanceSize = 0x14; static constexpr dart::compiler::target::word AOT_String_InstanceSize = 0xc; static constexpr dart::compiler::target::word AOT_SubtypeTestCache_InstanceSize = 0x10; static constexpr dart::compiler::target::word AOT_LoadingUnit_InstanceSize = 0x14; @@ -9759,13 +9685,9 @@ static constexpr dart::compiler::target::word AOT_WeakReference_type_arguments_o static constexpr dart::compiler::target::word AOT_Coroutine_caller_offset = 0x8; static constexpr dart::compiler::target::word AOT_Coroutine_entry_offset = 0x10; static constexpr dart::compiler::target::word AOT_Coroutine_stack_base_offset = - 0x28; + 0x18; static constexpr dart::compiler::target::word AOT_Coroutine_stack_limit_offset = - 0x30; -static constexpr dart::compiler::target::word - AOT_Coroutine_source_frame_pointer_offset = 0x18; -static constexpr dart::compiler::target::word - AOT_Coroutine_source_frame_size_offset = 0x20; + 0x20; static constexpr dart::compiler::target::word AOT_Code_entry_point_offset[] = {0x8, 0x18, 0x10, 0x20}; static constexpr dart::compiler::target::word AOT_Thread_write_barrier_wrappers_thread_offset[] = { @@ -9831,7 +9753,7 @@ static constexpr dart::compiler::target::word AOT_Sentinel_InstanceSize = 0x8; static constexpr dart::compiler::target::word AOT_SingleTargetCache_InstanceSize = 0x20; static constexpr dart::compiler::target::word AOT_StackTrace_InstanceSize = 0x28; static constexpr dart::compiler::target::word AOT_SuspendState_HeaderSize = 0x30; -static constexpr dart::compiler::target::word AOT_Coroutine_InstanceSize = 0x38; +static constexpr dart::compiler::target::word AOT_Coroutine_InstanceSize = 0x28; static constexpr dart::compiler::target::word AOT_String_InstanceSize = 0x10; static constexpr dart::compiler::target::word AOT_SubtypeTestCache_InstanceSize = 0x18; static constexpr dart::compiler::target::word AOT_LoadingUnit_InstanceSize = 0x28; @@ -10320,13 +10242,9 @@ static constexpr dart::compiler::target::word AOT_WeakReference_type_arguments_o static constexpr dart::compiler::target::word AOT_Coroutine_caller_offset = 0x8; static constexpr dart::compiler::target::word AOT_Coroutine_entry_offset = 0x10; static constexpr dart::compiler::target::word AOT_Coroutine_stack_base_offset = - 0x28; + 0x18; static constexpr dart::compiler::target::word AOT_Coroutine_stack_limit_offset = - 0x30; -static constexpr dart::compiler::target::word - AOT_Coroutine_source_frame_pointer_offset = 0x18; -static constexpr dart::compiler::target::word - AOT_Coroutine_source_frame_size_offset = 0x20; + 0x20; static constexpr dart::compiler::target::word AOT_Code_entry_point_offset[] = {0x8, 0x18, 0x10, 0x20}; static constexpr dart::compiler::target::word AOT_Thread_write_barrier_wrappers_thread_offset[] = { @@ -10394,7 +10312,7 @@ static constexpr dart::compiler::target::word AOT_Sentinel_InstanceSize = 0x8; static constexpr dart::compiler::target::word AOT_SingleTargetCache_InstanceSize = 0x20; static constexpr dart::compiler::target::word AOT_StackTrace_InstanceSize = 0x28; static constexpr dart::compiler::target::word AOT_SuspendState_HeaderSize = 0x30; -static constexpr dart::compiler::target::word AOT_Coroutine_InstanceSize = 0x38; +static constexpr dart::compiler::target::word AOT_Coroutine_InstanceSize = 0x28; static constexpr dart::compiler::target::word AOT_String_InstanceSize = 0x10; static constexpr dart::compiler::target::word AOT_SubtypeTestCache_InstanceSize = 0x18; static constexpr dart::compiler::target::word AOT_LoadingUnit_InstanceSize = 0x28; @@ -10882,13 +10800,9 @@ static constexpr dart::compiler::target::word AOT_WeakReference_type_arguments_o static constexpr dart::compiler::target::word AOT_Coroutine_caller_offset = 0x8; static constexpr dart::compiler::target::word AOT_Coroutine_entry_offset = 0xc; static constexpr dart::compiler::target::word AOT_Coroutine_stack_base_offset = - 0x20; + 0x10; static constexpr dart::compiler::target::word AOT_Coroutine_stack_limit_offset = - 0x28; -static constexpr dart::compiler::target::word - AOT_Coroutine_source_frame_pointer_offset = 0x10; -static constexpr dart::compiler::target::word - AOT_Coroutine_source_frame_size_offset = 0x18; + 0x18; static constexpr dart::compiler::target::word AOT_Code_entry_point_offset[] = {0x8, 0x18, 0x10, 0x20}; static constexpr dart::compiler::target::word AOT_Thread_write_barrier_wrappers_thread_offset[] = { @@ -10954,7 +10868,7 @@ static constexpr dart::compiler::target::word AOT_Sentinel_InstanceSize = 0x8; static constexpr dart::compiler::target::word AOT_SingleTargetCache_InstanceSize = 0x20; static constexpr dart::compiler::target::word AOT_StackTrace_InstanceSize = 0x18; static constexpr dart::compiler::target::word AOT_SuspendState_HeaderSize = 0x28; -static constexpr dart::compiler::target::word AOT_Coroutine_InstanceSize = 0x30; +static constexpr dart::compiler::target::word AOT_Coroutine_InstanceSize = 0x20; static constexpr dart::compiler::target::word AOT_String_InstanceSize = 0x10; static constexpr dart::compiler::target::word AOT_SubtypeTestCache_InstanceSize = 0x18; static constexpr dart::compiler::target::word AOT_LoadingUnit_InstanceSize = 0x20; @@ -11439,13 +11353,9 @@ static constexpr dart::compiler::target::word AOT_WeakReference_type_arguments_o static constexpr dart::compiler::target::word AOT_Coroutine_caller_offset = 0x8; static constexpr dart::compiler::target::word AOT_Coroutine_entry_offset = 0xc; static constexpr dart::compiler::target::word AOT_Coroutine_stack_base_offset = - 0x20; + 0x10; static constexpr dart::compiler::target::word AOT_Coroutine_stack_limit_offset = - 0x28; -static constexpr dart::compiler::target::word - AOT_Coroutine_source_frame_pointer_offset = 0x10; -static constexpr dart::compiler::target::word - AOT_Coroutine_source_frame_size_offset = 0x18; + 0x18; static constexpr dart::compiler::target::word AOT_Code_entry_point_offset[] = {0x8, 0x18, 0x10, 0x20}; static constexpr dart::compiler::target::word AOT_Thread_write_barrier_wrappers_thread_offset[] = { @@ -11513,7 +11423,7 @@ static constexpr dart::compiler::target::word AOT_Sentinel_InstanceSize = 0x8; static constexpr dart::compiler::target::word AOT_SingleTargetCache_InstanceSize = 0x20; static constexpr dart::compiler::target::word AOT_StackTrace_InstanceSize = 0x18; static constexpr dart::compiler::target::word AOT_SuspendState_HeaderSize = 0x28; -static constexpr dart::compiler::target::word AOT_Coroutine_InstanceSize = 0x30; +static constexpr dart::compiler::target::word AOT_Coroutine_InstanceSize = 0x20; static constexpr dart::compiler::target::word AOT_String_InstanceSize = 0x10; static constexpr dart::compiler::target::word AOT_SubtypeTestCache_InstanceSize = 0x18; static constexpr dart::compiler::target::word AOT_LoadingUnit_InstanceSize = 0x20; @@ -11997,13 +11907,9 @@ static constexpr dart::compiler::target::word AOT_WeakReference_type_arguments_o static constexpr dart::compiler::target::word AOT_Coroutine_caller_offset = 0x4; static constexpr dart::compiler::target::word AOT_Coroutine_entry_offset = 0x8; static constexpr dart::compiler::target::word AOT_Coroutine_stack_base_offset = - 0x14; + 0xc; static constexpr dart::compiler::target::word AOT_Coroutine_stack_limit_offset = - 0x18; -static constexpr dart::compiler::target::word - AOT_Coroutine_source_frame_pointer_offset = 0xc; -static constexpr dart::compiler::target::word - AOT_Coroutine_source_frame_size_offset = 0x10; + 0x10; static constexpr dart::compiler::target::word AOT_Code_entry_point_offset[] = {0x4, 0xc, 0x8, 0x10}; static constexpr dart::compiler::target::word AOT_Thread_write_barrier_wrappers_thread_offset[] = { @@ -12070,7 +11976,7 @@ static constexpr dart::compiler::target::word AOT_Sentinel_InstanceSize = 0x4; static constexpr dart::compiler::target::word AOT_SingleTargetCache_InstanceSize = 0x14; static constexpr dart::compiler::target::word AOT_StackTrace_InstanceSize = 0x14; static constexpr dart::compiler::target::word AOT_SuspendState_HeaderSize = 0x18; -static constexpr dart::compiler::target::word AOT_Coroutine_InstanceSize = 0x1c; +static constexpr dart::compiler::target::word AOT_Coroutine_InstanceSize = 0x14; static constexpr dart::compiler::target::word AOT_String_InstanceSize = 0xc; static constexpr dart::compiler::target::word AOT_SubtypeTestCache_InstanceSize = 0x10; static constexpr dart::compiler::target::word AOT_LoadingUnit_InstanceSize = 0x14; @@ -12554,13 +12460,9 @@ static constexpr dart::compiler::target::word AOT_WeakReference_type_arguments_o static constexpr dart::compiler::target::word AOT_Coroutine_caller_offset = 0x8; static constexpr dart::compiler::target::word AOT_Coroutine_entry_offset = 0x10; static constexpr dart::compiler::target::word AOT_Coroutine_stack_base_offset = - 0x28; + 0x18; static constexpr dart::compiler::target::word AOT_Coroutine_stack_limit_offset = - 0x30; -static constexpr dart::compiler::target::word - AOT_Coroutine_source_frame_pointer_offset = 0x18; -static constexpr dart::compiler::target::word - AOT_Coroutine_source_frame_size_offset = 0x20; + 0x20; static constexpr dart::compiler::target::word AOT_Code_entry_point_offset[] = {0x8, 0x18, 0x10, 0x20}; static constexpr dart::compiler::target::word AOT_Thread_write_barrier_wrappers_thread_offset[] = { @@ -12627,7 +12529,7 @@ static constexpr dart::compiler::target::word AOT_Sentinel_InstanceSize = 0x8; static constexpr dart::compiler::target::word AOT_SingleTargetCache_InstanceSize = 0x20; static constexpr dart::compiler::target::word AOT_StackTrace_InstanceSize = 0x28; static constexpr dart::compiler::target::word AOT_SuspendState_HeaderSize = 0x30; -static constexpr dart::compiler::target::word AOT_Coroutine_InstanceSize = 0x38; +static constexpr dart::compiler::target::word AOT_Coroutine_InstanceSize = 0x28; static constexpr dart::compiler::target::word AOT_String_InstanceSize = 0x10; static constexpr dart::compiler::target::word AOT_SubtypeTestCache_InstanceSize = 0x18; static constexpr dart::compiler::target::word AOT_LoadingUnit_InstanceSize = 0x28; @@ -13106,13 +13008,9 @@ static constexpr dart::compiler::target::word AOT_WeakReference_type_arguments_o static constexpr dart::compiler::target::word AOT_Coroutine_caller_offset = 0x4; static constexpr dart::compiler::target::word AOT_Coroutine_entry_offset = 0x8; static constexpr dart::compiler::target::word AOT_Coroutine_stack_base_offset = - 0x14; + 0xc; static constexpr dart::compiler::target::word AOT_Coroutine_stack_limit_offset = - 0x18; -static constexpr dart::compiler::target::word - AOT_Coroutine_source_frame_pointer_offset = 0xc; -static constexpr dart::compiler::target::word - AOT_Coroutine_source_frame_size_offset = 0x10; + 0x10; static constexpr dart::compiler::target::word AOT_Code_entry_point_offset[] = {0x4, 0xc, 0x8, 0x10}; static constexpr dart::compiler::target::word AOT_Thread_write_barrier_wrappers_thread_offset[] = { @@ -13178,7 +13076,7 @@ static constexpr dart::compiler::target::word AOT_Sentinel_InstanceSize = 0x4; static constexpr dart::compiler::target::word AOT_SingleTargetCache_InstanceSize = 0x14; static constexpr dart::compiler::target::word AOT_StackTrace_InstanceSize = 0x14; static constexpr dart::compiler::target::word AOT_SuspendState_HeaderSize = 0x18; -static constexpr dart::compiler::target::word AOT_Coroutine_InstanceSize = 0x1c; +static constexpr dart::compiler::target::word AOT_Coroutine_InstanceSize = 0x14; static constexpr dart::compiler::target::word AOT_String_InstanceSize = 0xc; static constexpr dart::compiler::target::word AOT_SubtypeTestCache_InstanceSize = 0x10; static constexpr dart::compiler::target::word AOT_LoadingUnit_InstanceSize = 0x14; @@ -13657,13 +13555,9 @@ static constexpr dart::compiler::target::word AOT_WeakReference_type_arguments_o static constexpr dart::compiler::target::word AOT_Coroutine_caller_offset = 0x8; static constexpr dart::compiler::target::word AOT_Coroutine_entry_offset = 0x10; static constexpr dart::compiler::target::word AOT_Coroutine_stack_base_offset = - 0x28; + 0x18; static constexpr dart::compiler::target::word AOT_Coroutine_stack_limit_offset = - 0x30; -static constexpr dart::compiler::target::word - AOT_Coroutine_source_frame_pointer_offset = 0x18; -static constexpr dart::compiler::target::word - AOT_Coroutine_source_frame_size_offset = 0x20; + 0x20; static constexpr dart::compiler::target::word AOT_Code_entry_point_offset[] = {0x8, 0x18, 0x10, 0x20}; static constexpr dart::compiler::target::word AOT_Thread_write_barrier_wrappers_thread_offset[] = { @@ -13729,7 +13623,7 @@ static constexpr dart::compiler::target::word AOT_Sentinel_InstanceSize = 0x8; static constexpr dart::compiler::target::word AOT_SingleTargetCache_InstanceSize = 0x20; static constexpr dart::compiler::target::word AOT_StackTrace_InstanceSize = 0x28; static constexpr dart::compiler::target::word AOT_SuspendState_HeaderSize = 0x30; -static constexpr dart::compiler::target::word AOT_Coroutine_InstanceSize = 0x38; +static constexpr dart::compiler::target::word AOT_Coroutine_InstanceSize = 0x28; static constexpr dart::compiler::target::word AOT_String_InstanceSize = 0x10; static constexpr dart::compiler::target::word AOT_SubtypeTestCache_InstanceSize = 0x18; static constexpr dart::compiler::target::word AOT_LoadingUnit_InstanceSize = 0x28; @@ -14213,13 +14107,9 @@ static constexpr dart::compiler::target::word AOT_WeakReference_type_arguments_o static constexpr dart::compiler::target::word AOT_Coroutine_caller_offset = 0x8; static constexpr dart::compiler::target::word AOT_Coroutine_entry_offset = 0x10; static constexpr dart::compiler::target::word AOT_Coroutine_stack_base_offset = - 0x28; + 0x18; static constexpr dart::compiler::target::word AOT_Coroutine_stack_limit_offset = - 0x30; -static constexpr dart::compiler::target::word - AOT_Coroutine_source_frame_pointer_offset = 0x18; -static constexpr dart::compiler::target::word - AOT_Coroutine_source_frame_size_offset = 0x20; + 0x20; static constexpr dart::compiler::target::word AOT_Code_entry_point_offset[] = {0x8, 0x18, 0x10, 0x20}; static constexpr dart::compiler::target::word AOT_Thread_write_barrier_wrappers_thread_offset[] = { @@ -14287,7 +14177,7 @@ static constexpr dart::compiler::target::word AOT_Sentinel_InstanceSize = 0x8; static constexpr dart::compiler::target::word AOT_SingleTargetCache_InstanceSize = 0x20; static constexpr dart::compiler::target::word AOT_StackTrace_InstanceSize = 0x28; static constexpr dart::compiler::target::word AOT_SuspendState_HeaderSize = 0x30; -static constexpr dart::compiler::target::word AOT_Coroutine_InstanceSize = 0x38; +static constexpr dart::compiler::target::word AOT_Coroutine_InstanceSize = 0x28; static constexpr dart::compiler::target::word AOT_String_InstanceSize = 0x10; static constexpr dart::compiler::target::word AOT_SubtypeTestCache_InstanceSize = 0x18; static constexpr dart::compiler::target::word AOT_LoadingUnit_InstanceSize = 0x28; @@ -14767,13 +14657,9 @@ static constexpr dart::compiler::target::word AOT_WeakReference_type_arguments_o static constexpr dart::compiler::target::word AOT_Coroutine_caller_offset = 0x8; static constexpr dart::compiler::target::word AOT_Coroutine_entry_offset = 0xc; static constexpr dart::compiler::target::word AOT_Coroutine_stack_base_offset = - 0x20; + 0x10; static constexpr dart::compiler::target::word AOT_Coroutine_stack_limit_offset = - 0x28; -static constexpr dart::compiler::target::word - AOT_Coroutine_source_frame_pointer_offset = 0x10; -static constexpr dart::compiler::target::word - AOT_Coroutine_source_frame_size_offset = 0x18; + 0x18; static constexpr dart::compiler::target::word AOT_Code_entry_point_offset[] = {0x8, 0x18, 0x10, 0x20}; static constexpr dart::compiler::target::word AOT_Thread_write_barrier_wrappers_thread_offset[] = { @@ -14839,7 +14725,7 @@ static constexpr dart::compiler::target::word AOT_Sentinel_InstanceSize = 0x8; static constexpr dart::compiler::target::word AOT_SingleTargetCache_InstanceSize = 0x20; static constexpr dart::compiler::target::word AOT_StackTrace_InstanceSize = 0x18; static constexpr dart::compiler::target::word AOT_SuspendState_HeaderSize = 0x28; -static constexpr dart::compiler::target::word AOT_Coroutine_InstanceSize = 0x30; +static constexpr dart::compiler::target::word AOT_Coroutine_InstanceSize = 0x20; static constexpr dart::compiler::target::word AOT_String_InstanceSize = 0x10; static constexpr dart::compiler::target::word AOT_SubtypeTestCache_InstanceSize = 0x18; static constexpr dart::compiler::target::word AOT_LoadingUnit_InstanceSize = 0x20; @@ -15319,13 +15205,9 @@ static constexpr dart::compiler::target::word AOT_WeakReference_type_arguments_o static constexpr dart::compiler::target::word AOT_Coroutine_caller_offset = 0x8; static constexpr dart::compiler::target::word AOT_Coroutine_entry_offset = 0xc; static constexpr dart::compiler::target::word AOT_Coroutine_stack_base_offset = - 0x20; + 0x10; static constexpr dart::compiler::target::word AOT_Coroutine_stack_limit_offset = - 0x28; -static constexpr dart::compiler::target::word - AOT_Coroutine_source_frame_pointer_offset = 0x10; -static constexpr dart::compiler::target::word - AOT_Coroutine_source_frame_size_offset = 0x18; + 0x18; static constexpr dart::compiler::target::word AOT_Code_entry_point_offset[] = {0x8, 0x18, 0x10, 0x20}; static constexpr dart::compiler::target::word AOT_Thread_write_barrier_wrappers_thread_offset[] = { @@ -15393,7 +15275,7 @@ static constexpr dart::compiler::target::word AOT_Sentinel_InstanceSize = 0x8; static constexpr dart::compiler::target::word AOT_SingleTargetCache_InstanceSize = 0x20; static constexpr dart::compiler::target::word AOT_StackTrace_InstanceSize = 0x18; static constexpr dart::compiler::target::word AOT_SuspendState_HeaderSize = 0x28; -static constexpr dart::compiler::target::word AOT_Coroutine_InstanceSize = 0x30; +static constexpr dart::compiler::target::word AOT_Coroutine_InstanceSize = 0x20; static constexpr dart::compiler::target::word AOT_String_InstanceSize = 0x10; static constexpr dart::compiler::target::word AOT_SubtypeTestCache_InstanceSize = 0x18; static constexpr dart::compiler::target::word AOT_LoadingUnit_InstanceSize = 0x20; @@ -15872,13 +15754,9 @@ static constexpr dart::compiler::target::word AOT_WeakReference_type_arguments_o static constexpr dart::compiler::target::word AOT_Coroutine_caller_offset = 0x4; static constexpr dart::compiler::target::word AOT_Coroutine_entry_offset = 0x8; static constexpr dart::compiler::target::word AOT_Coroutine_stack_base_offset = - 0x14; + 0xc; static constexpr dart::compiler::target::word AOT_Coroutine_stack_limit_offset = - 0x18; -static constexpr dart::compiler::target::word - AOT_Coroutine_source_frame_pointer_offset = 0xc; -static constexpr dart::compiler::target::word - AOT_Coroutine_source_frame_size_offset = 0x10; + 0x10; static constexpr dart::compiler::target::word AOT_Code_entry_point_offset[] = {0x4, 0xc, 0x8, 0x10}; static constexpr dart::compiler::target::word AOT_Thread_write_barrier_wrappers_thread_offset[] = { @@ -15945,7 +15823,7 @@ static constexpr dart::compiler::target::word AOT_Sentinel_InstanceSize = 0x4; static constexpr dart::compiler::target::word AOT_SingleTargetCache_InstanceSize = 0x14; static constexpr dart::compiler::target::word AOT_StackTrace_InstanceSize = 0x14; static constexpr dart::compiler::target::word AOT_SuspendState_HeaderSize = 0x18; -static constexpr dart::compiler::target::word AOT_Coroutine_InstanceSize = 0x1c; +static constexpr dart::compiler::target::word AOT_Coroutine_InstanceSize = 0x14; static constexpr dart::compiler::target::word AOT_String_InstanceSize = 0xc; static constexpr dart::compiler::target::word AOT_SubtypeTestCache_InstanceSize = 0x10; static constexpr dart::compiler::target::word AOT_LoadingUnit_InstanceSize = 0x14; @@ -16424,13 +16302,9 @@ static constexpr dart::compiler::target::word AOT_WeakReference_type_arguments_o static constexpr dart::compiler::target::word AOT_Coroutine_caller_offset = 0x8; static constexpr dart::compiler::target::word AOT_Coroutine_entry_offset = 0x10; static constexpr dart::compiler::target::word AOT_Coroutine_stack_base_offset = - 0x28; + 0x18; static constexpr dart::compiler::target::word AOT_Coroutine_stack_limit_offset = - 0x30; -static constexpr dart::compiler::target::word - AOT_Coroutine_source_frame_pointer_offset = 0x18; -static constexpr dart::compiler::target::word - AOT_Coroutine_source_frame_size_offset = 0x20; + 0x20; static constexpr dart::compiler::target::word AOT_Code_entry_point_offset[] = {0x8, 0x18, 0x10, 0x20}; static constexpr dart::compiler::target::word AOT_Thread_write_barrier_wrappers_thread_offset[] = { @@ -16497,7 +16371,7 @@ static constexpr dart::compiler::target::word AOT_Sentinel_InstanceSize = 0x8; static constexpr dart::compiler::target::word AOT_SingleTargetCache_InstanceSize = 0x20; static constexpr dart::compiler::target::word AOT_StackTrace_InstanceSize = 0x28; static constexpr dart::compiler::target::word AOT_SuspendState_HeaderSize = 0x30; -static constexpr dart::compiler::target::word AOT_Coroutine_InstanceSize = 0x38; +static constexpr dart::compiler::target::word AOT_Coroutine_InstanceSize = 0x28; static constexpr dart::compiler::target::word AOT_String_InstanceSize = 0x10; static constexpr dart::compiler::target::word AOT_SubtypeTestCache_InstanceSize = 0x18; static constexpr dart::compiler::target::word AOT_LoadingUnit_InstanceSize = 0x28; diff --git a/runtime/vm/compiler/runtime_offsets_list.h b/runtime/vm/compiler/runtime_offsets_list.h index 9959aa81a4b1..87af21c268aa 100644 --- a/runtime/vm/compiler/runtime_offsets_list.h +++ b/runtime/vm/compiler/runtime_offsets_list.h @@ -404,8 +404,6 @@ FIELD(Coroutine, entry_offset) \ FIELD(Coroutine, stack_base_offset) \ FIELD(Coroutine, stack_limit_offset) \ - FIELD(Coroutine, source_frame_pointer_offset) \ - FIELD(Coroutine, source_frame_size_offset) \ RANGE(Code, entry_point_offset, CodeEntryKind, CodeEntryKind::kNormal, \ CodeEntryKind::kMonomorphicUnchecked, \ [](CodeEntryKind value) { return true; }) \ diff --git a/runtime/vm/heap/marker.cc b/runtime/vm/heap/marker.cc index 967f692da38b..6e0466f6f23c 100644 --- a/runtime/vm/heap/marker.cc +++ b/runtime/vm/heap/marker.cc @@ -3,9 +3,7 @@ // BSD-style license that can be found in the LICENSE file. #include "vm/heap/marker.h" -#include -#include "dart_api.h" #include "platform/assert.h" #include "platform/atomic.h" #include "vm/allocation.h" @@ -645,13 +643,6 @@ class MarkingVisitorBase : public ObjectPointerVisitor { return false; } - if (obj->untag()->IsCardRemembered()) { - if(!((obj->GetClassId() == kArrayCid) || (obj->GetClassId() == kImmutableArrayCid))) - { - Dart_DumpNativeStackTrace(nullptr); - raise(SIGINT); - } - } if (obj->IsNewObject()) { if (TryAcquireMarkBit(obj)) { new_work_list_.Push(obj); diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc index 57cc426ef7c6..6aee43613b8c 100644 --- a/runtime/vm/object.cc +++ b/runtime/vm/object.cc @@ -26629,11 +26629,10 @@ CodePtr SuspendState::GetCodeObject() const { #endif // defined(DART_PRECOMPILED_RUNTIME) } -CoroutinePtr Coroutine::New(void** source_frame_space, void** stack_base, uintptr_t stack_size, FunctionPtr entry) { +CoroutinePtr Coroutine::New(void** stack_base, uintptr_t stack_size, FunctionPtr entry) { const auto& coroutine = Coroutine::Handle(Object::Allocate(Heap::kOld)); coroutine.StoreNonPointer(&coroutine.untag()->stack_base_, (uword)stack_base); coroutine.StoreNonPointer(&coroutine.untag()->stack_limit_, (uword)stack_base - stack_size); - coroutine.StoreNonPointer(&coroutine.untag()->source_frame_pointer_, (uword)source_frame_space); coroutine.StoreCompressedPointer(&coroutine.untag()->entry_, entry); coroutine.StoreCompressedPointer(&coroutine.untag()->caller_, coroutine.ptr()); return coroutine.ptr(); diff --git a/runtime/vm/object.h b/runtime/vm/object.h index ae6585cd5a6d..83e84afdf512 100644 --- a/runtime/vm/object.h +++ b/runtime/vm/object.h @@ -12705,7 +12705,7 @@ class Coroutine : public Instance { static intptr_t InstanceSize() { return RoundedAllocationSize(sizeof(UntaggedCoroutine)); } - static CoroutinePtr New(void** source_frame_space, void** stack_base, uintptr_t stack_size, FunctionPtr entry); + static CoroutinePtr New(void** stack_base, uintptr_t stack_size, FunctionPtr entry); CoroutinePtr caller() const { return untag()->caller(); } static uword caller_offset() { return OFFSET_OF(UntaggedCoroutine, caller_); } @@ -12723,16 +12723,6 @@ class Coroutine : public Instance { return OFFSET_OF(UntaggedCoroutine, stack_limit_); } - uword source_frame_pointer() const { return untag()->source_frame_pointer_; } - static uword source_frame_pointer_offset() { - return OFFSET_OF(UntaggedCoroutine, source_frame_pointer_); - } - - uword source_frame_size() const { return untag()->source_frame_size_; } - static uword source_frame_size_offset() { - return OFFSET_OF(UntaggedCoroutine, source_frame_size_); - } - private: FINAL_HEAP_OBJECT_IMPLEMENTATION(Coroutine, Instance); friend class Class; diff --git a/runtime/vm/raw_object.h b/runtime/vm/raw_object.h index 2811f8a8e34e..8d5e4917fbfb 100644 --- a/runtime/vm/raw_object.h +++ b/runtime/vm/raw_object.h @@ -3781,8 +3781,6 @@ class UntaggedCoroutine : public UntaggedInstance { COMPRESSED_POINTER_FIELD(FunctionPtr, entry) VISIT_TO(entry) CompressedObjectPtr* to_snapshot(Snapshot::Kind kind) { return to(); } - uword source_frame_pointer_; - uword source_frame_size_; uword stack_base_; uword stack_limit_; public: diff --git a/runtime/vm/raw_object_fields.cc b/runtime/vm/raw_object_fields.cc index e52d345e292a..92d6b5bf8031 100644 --- a/runtime/vm/raw_object_fields.cc +++ b/runtime/vm/raw_object_fields.cc @@ -235,9 +235,7 @@ namespace dart { F(Coroutine, caller_) \ F(Coroutine, entry_) \ F(Coroutine, stack_base_) \ - F(Coroutine, stack_limit_) \ - F(Coroutine, source_frame_pointer_) \ - F(Coroutine, source_frame_size_) + F(Coroutine, stack_limit_) #define AOT_CLASSES_AND_FIELDS(F) diff --git a/runtime/vm/stack_frame.cc b/runtime/vm/stack_frame.cc index dffe05704201..5dd6d861d47f 100644 --- a/runtime/vm/stack_frame.cc +++ b/runtime/vm/stack_frame.cc @@ -186,7 +186,6 @@ void ExitFrame::VisitObjectPointers(ObjectPointerVisitor* visitor) { ObjectPtr* first_fixed = reinterpret_cast(fp()) + runtime_frame_layout.last_fixed_object_from_fp; if (first_fixed <= last_fixed) { - //OS::Print("ExitFrame::VisitObjectPointers\n"); visitor->VisitPointers(first_fixed, last_fixed); } else { ASSERT(runtime_frame_layout.first_object_from_fp == @@ -201,7 +200,6 @@ void EntryFrame::VisitObjectPointers(ObjectPointerVisitor* visitor) { ObjectPtr* last = reinterpret_cast(fp()) + kExitLinkSlotFromEntryFp - 1; // There may not be any pointer to visit; in this case, first > last. - //OS::Print("EntryFrame::VisitObjectPointers\n"); visitor->VisitPointers(first, last); } @@ -247,10 +245,6 @@ void StackFrame::VisitObjectPointers(ObjectPointerVisitor* visitor) { } } - //OS::Print("pc() = %p\n", (void*)pc()); - //OS::Print("sp() = %p\n", (void*)sp()); - //OS::Print("fp() = %p\n", (void*)fp()); - //OS::Print("maps.IsNull() = %d\n", (int)maps.IsNull()); if (!maps.IsNull()) { // Optimized frames have a stack map. We need to visit the frame based // on the stack map. @@ -258,8 +252,6 @@ void StackFrame::VisitObjectPointers(ObjectPointerVisitor* visitor) { maps, global_table); const uint32_t pc_offset = pc() - code_start; bool found = it.Find(pc_offset); - //OS::Print("code_start = %p\n", (void*)code_start); - //OS::Print("stack map found = %d\n", (int)found); if (found) { ObjectPtr* first = reinterpret_cast(sp()); ObjectPtr* last = reinterpret_cast( diff --git a/tests/lib/fiber/fiber_test.dart b/tests/lib/fiber/fiber_test.dart index 42fae14590a7..b0ebcdc2341a 100644 --- a/tests/lib/fiber/fiber_test.dart +++ b/tests/lib/fiber/fiber_test.dart @@ -24,6 +24,7 @@ void mainEntry() { mainFiber.fork(childFiber); //print("main: after child fork"); commonState += "main -> "; + throw Exception("test"); //print("main: after child transfer"); mainFiber.transfer(childFiber); print(commonState); From 383b321c2b34729407ec07c3cd335ed6ae12e3d2 Mon Sep 17 00:00:00 2001 From: "anton.bashirov" Date: Sun, 8 Sep 2024 01:04:40 +0400 Subject: [PATCH 35/35] fibers --- runtime/vm/exceptions.cc | 2 ++ runtime/vm/stack_frame.cc | 3 +-- runtime/vm/virtual_memory.h | 1 - runtime/vm/virtual_memory_posix.cc | 13 ------------- 4 files changed, 3 insertions(+), 16 deletions(-) diff --git a/runtime/vm/exceptions.cc b/runtime/vm/exceptions.cc index 2ca130dcb35c..38abbf353e00 100644 --- a/runtime/vm/exceptions.cc +++ b/runtime/vm/exceptions.cc @@ -109,6 +109,7 @@ static void BuildStackTrace(StackTraceBuilder* builder) { if (!frame->IsDartFrame()) { continue; } + OS::Print("BuildStackTrace\n"); code = frame->LookupDartCode(); ASSERT(code.ContainsInstructionAt(frame->pc())); const uword pc_offset = frame->pc() - code.PayloadStart(); @@ -153,6 +154,7 @@ class ExceptionHandlerFinder : public StackResource { (handler_pc != StubCode::AsyncExceptionHandler().EntryPoint())) { pc_ = frame->pc(); + OS::Print("ExceptionHandlerFinder::find\n"); code_ = &Code::Handle(frame->LookupDartCode()); CatchEntryMovesRefPtr* cached_catch_entry_moves = catch_entry_moves_cache_->Lookup(pc_); diff --git a/runtime/vm/stack_frame.cc b/runtime/vm/stack_frame.cc index 5dd6d861d47f..c0843c706a88 100644 --- a/runtime/vm/stack_frame.cc +++ b/runtime/vm/stack_frame.cc @@ -251,8 +251,7 @@ void StackFrame::VisitObjectPointers(ObjectPointerVisitor* visitor) { CompressedStackMaps::Iterator it( maps, global_table); const uint32_t pc_offset = pc() - code_start; - bool found = it.Find(pc_offset); - if (found) { + if (it.Find(pc_offset)) { ObjectPtr* first = reinterpret_cast(sp()); ObjectPtr* last = reinterpret_cast( fp() + (runtime_frame_layout.first_local_from_fp * kWordSize)); diff --git a/runtime/vm/virtual_memory.h b/runtime/vm/virtual_memory.h index d5742034397b..7ee27f27233f 100644 --- a/runtime/vm/virtual_memory.h +++ b/runtime/vm/virtual_memory.h @@ -92,7 +92,6 @@ class VirtualMemory { bool vm_owns_region() const { return reserved_.pointer() != nullptr; } static VirtualMemory* ForImagePage(void* pointer, uword size); - static VirtualMemory* AllocateStack(intptr_t size); private: static intptr_t CalculatePageSize(); diff --git a/runtime/vm/virtual_memory_posix.cc b/runtime/vm/virtual_memory_posix.cc index ec082404e2a4..07d4dd537dcd 100644 --- a/runtime/vm/virtual_memory_posix.cc +++ b/runtime/vm/virtual_memory_posix.cc @@ -334,19 +334,6 @@ VirtualMemory* VirtualMemory::Reserve(intptr_t size, intptr_t alignment) { return new VirtualMemory(region, region); } -VirtualMemory* VirtualMemory::AllocateStack(intptr_t size) { - intptr_t alignment = OS::ActivationFrameAlignment(); - intptr_t allocated_size = size; - void* address = - GenericMapAligned(nullptr, PROT_EXEC | PROT_READ | PROT_WRITE, size, alignment, allocated_size, MAP_PRIVATE | MAP_ANONYMOUS); - if (address == nullptr) { - return nullptr; - } - MemoryRegion region(address, size); - return new VirtualMemory(region, region); - -} - void VirtualMemory::Commit(void* address, intptr_t size) { ASSERT(Utils::IsAligned(address, PageSize())); ASSERT(Utils::IsAligned(size, PageSize()));