From 46cf07fe355f0921414409f88cf9afeca538bfed Mon Sep 17 00:00:00 2001 From: Alexander Aprelev Date: Wed, 11 Mar 2026 13:11:32 -0700 Subject: [PATCH] [vm/shared] Ensure scratch register is requested as temp for LoadStaticFieldInstr. TEST=tests/ffi/many_listener_callbacks_test/5 on vm-ffi-qemu-linux-release-arm Change-Id: I6a60220bce6dbc760e3a027b1b023c59dff36ba7 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/487200 Commit-Queue: Alexander Aprelev Reviewed-by: Slava Egorov --- runtime/vm/compiler/backend/il.cc | 4 +++- tests/ffi/many_listener_callbacks_test.dart | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/runtime/vm/compiler/backend/il.cc b/runtime/vm/compiler/backend/il.cc index 2dfaa27f027..0f0f3f994f7 100644 --- a/runtime/vm/compiler/backend/il.cc +++ b/runtime/vm/compiler/backend/il.cc @@ -4516,7 +4516,7 @@ LocationSummary* LoadStaticFieldInstr::MakeLocationSummary(Zone* zone, const intptr_t kNumTemps = does_throw_access_error_or_call_initializer() && throw_exception_on_initialization() && use_shared_stub - ? 1 + ? 2 : 0; LocationSummary* locs = new (zone) LocationSummary( zone, kNumInputs, kNumTemps, @@ -4530,6 +4530,8 @@ LocationSummary* LoadStaticFieldInstr::MakeLocationSummary(Zone* zone, throw_exception_on_initialization() && use_shared_stub) { locs->set_temp( 0, Location::RegisterLocation(LateInitializationErrorABI::kFieldReg)); + locs->set_temp(1, Location::RegisterLocation( + InitLateStaticFieldInternalRegs::kScratchReg)); } locs->set_out(0, does_throw_access_error_or_call_initializer() diff --git a/tests/ffi/many_listener_callbacks_test.dart b/tests/ffi/many_listener_callbacks_test.dart index 732f5ac5281..33136b6ea7a 100644 --- a/tests/ffi/many_listener_callbacks_test.dart +++ b/tests/ffi/many_listener_callbacks_test.dart @@ -11,6 +11,7 @@ // VMOptions=--use-slow-path --stacktrace-every=100 // VMOptions=--dwarf_stack_traces --no-retain_function_objects --no-retain_code_objects // VMOptions=--test_il_serialization +// VMOptions=--experimental-shared-data // SharedObjects=ffi_test_functions // No profiler for this test. TSAN's vector clocks become more expensive as the