Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/design/coreclr/botr/readytorun-format.md
Original file line number Diff line number Diff line change
Expand Up @@ -1059,6 +1059,7 @@ The string format is:
| `l` | returns `i64` |
| `f` | returns `f32` |
| `d` | returns `f64` |
| `V` | returns `v128` (a `Vector128<T>`, or a 16-byte `Vector<T>`) |
| `S<N>` | struct return via hidden buffer, `N` is the struct size in bytes |

**This pointer** (if the method has a `this` parameter):
Expand All @@ -1085,6 +1086,7 @@ it knows a hidden retbuf pointer argument is present in the Wasm parameter list.
| `l` | `i64` parameter |
| `f` | `f32` parameter |
| `d` | `f64` parameter |
| `V` | `v128` parameter (a `Vector128<T>`, or a 16-byte `Vector<T>`, passed by value) |
| `S<N>` | struct parameter passed by reference, `<N>` is the struct size in bytes |
| `e` | empty struct parameter — elided from Wasm args but present in the string |

Expand Down
19 changes: 19 additions & 0 deletions src/coreclr/vm/wasm/helpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -989,6 +989,7 @@ namespace
ToI64,
ToF32,
ToF64,
ToV128,
ToStruct, // S<N> — multi-field struct passed by pointer, structSize holds the size
ToEmpty, // e — empty struct, takes no wasm argument
};
Expand Down Expand Up @@ -1032,6 +1033,23 @@ namespace
}

MethodTable* pMT = th.AsMethodTable();

bool isSupportedVectorBaseType =
pMT->IsIntrinsicType() &&
(pMT->GetNumGenericArgs() == 1) &&
CorIsNumericalType(pMT->GetInstantiation()[0].GetSignatureCorElementType());
Comment thread
tannergooding marked this conversation as resolved.
if (isSupportedVectorBaseType)
{
PTR_MethodTable pVector128MT = CoreLibBinder::GetClassIfExist(CLASS__VECTOR128T);
PTR_MethodTable pVectorTMT = CoreLibBinder::GetClassIfExist(CLASS__VECTORT);

if ((pVector128MT != nullptr && pMT->HasSameTypeDefAs(pVector128MT)) ||
((size == 16) && (pVectorTMT != nullptr) && pMT->HasSameTypeDefAs(pVectorTMT)))
{
return { ConvertType::ToV128, 0 };
}
}

uint32_t numInstanceFields = pMT->GetNumInstanceFields();

// WASM-TODO: Empty structs should return ToEmpty once .NET
Expand Down Expand Up @@ -1107,6 +1125,7 @@ namespace
case ConvertType::ToI64: c = 'l'; break;
case ConvertType::ToF32: c = 'f'; break;
case ConvertType::ToF64: c = 'd'; break;
case ConvertType::ToV128: c = 'V'; break;
case ConvertType::ToEmpty: c = 'e'; break;
case ConvertType::ToStruct:
{
Expand Down