[vm, compiler] Fix calculation to find the beginning of the FFI callback stub on ARM32.

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/63402
Change-Id: I4aff8d6dca9aa71fd68275fd495b7dba2e119df5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/504401
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
This commit is contained in:
Ryan Macnak
2026-05-19 09:06:20 -07:00
committed by dart-scoped@luci-project-accounts.iam.gserviceaccount.com
parent c4ce9dbdfd
commit 6a9b9b331c
@@ -278,8 +278,11 @@ void StubCodeCompiler::GenerateLoadFfiCallbackMetadataRuntimeFunction(
// Note: If the stub was aligned, this could be a single PC relative load.
// Load a pointer to the beginning of the stub into dst.
// This is not SubImmediate(dst, PC, Instr::kPCReadOffset + code_size)
// because synthesizing the large immediate changes what offset is needed.
const intptr_t code_size = __ CodeSize();
__ SubImmediate(dst, PC, Instr::kPCReadOffset + code_size);
__ mov(dst, Operand(PC));
__ SubImmediate(dst, dst, Instr::kPCReadOffset + code_size);
// Round dst down to the page size.
__ AndImmediate(dst, dst, FfiCallbackMetadata::kPageMask);