Commit 9479fc6
[wasm] Retype integer constant struct returns to the native return type
When LowerRetStruct retypes a struct return to a primitive nativeReturnType and
the return value is a GT_CNS_INT, the integer branch left the constant as TYP_INT
even when the native return type is wider (e.g. TYP_LONG). On register targets
this is harmless because integer registers are untyped, but wasm has a typed
value stack, so codegen emitted i32.const 0 for an i64-typed return.
This surfaced validating the R2R-compiled CoreLib for wasm:
Vector64<byte>.get_Zero returns a zero-initialized 8-byte struct, which the wasm
ABI lowers to an i64 return. The emitted body ended with i32.const 0 and wasmtime
rejected the module with "type mismatch: expected i64, found i32".
Retype the integer constant to the native return type under TARGET_WASM so
codegen emits an i64.const. Applies to both browser and wasi, which share the JIT.
Also submitted standalone as dotnet#129102; will reconcile if that lands
first.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent f3448f6 commit 9479fc6
1 file changed
Lines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5859 | 5859 | | |
5860 | 5860 | | |
5861 | 5861 | | |
| 5862 | + | |
| 5863 | + | |
| 5864 | + | |
| 5865 | + | |
| 5866 | + | |
| 5867 | + | |
| 5868 | + | |
| 5869 | + | |
| 5870 | + | |
| 5871 | + | |
5862 | 5872 | | |
5863 | 5873 | | |
5864 | 5874 | | |
| |||
0 commit comments