Commit 5d9e18e
Fix HFA/HVA by-value argument marshalling on ARM64 in CallTargetWorker (#130580)
MethodDescCallSite::CallTargetWorker manually marshals arguments into
the register save area. The branch that expands a
struct-passed-in-registers into individual register slots was gated to
UNIX_AMD64_ABI / LOONGARCH64 / RISCV64 only. On ARM64, HFA/HVA structs
passed by value in FP registers fell through to the default packed
CopyMemory, which lays the fields out contiguously instead of placing
each field in its own NEON register slot. The callee then read {field0,
field2, garbage, ...}.
Add a TARGET_ARM64 branch that calls the existing
ArgDestination::CopyHFAStructToRegister when the argument is an HFA,
matching the pattern already used in CopyValueClassArgUnchecked. Non-HFA
structs (and HFAs spilled to the stack) keep IsHFA() == false and fall
through to the unchanged default copy.
This manifested as "vector math broken in the debugger only" because
normal JIT-emitted calls and reflection invoke stubs do not use this
manual marshalling path, but debugger func-eval does.
Fixes #126564
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>1 parent 4d33abd commit 5d9e18e
1 file changed
Lines changed: 9 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
401 | 401 | | |
402 | 402 | | |
403 | 403 | | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
404 | 413 | | |
405 | 414 | | |
406 | 415 | | |
| |||
0 commit comments