-
Notifications
You must be signed in to change notification settings - Fork 5.3k
[Wasm RyuJit] Wasm abi classifier #123515
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
e59945e
677018d
fc97403
b847871
4eac135
2dec621
2c5b37f
e2541c8
2130664
a339c42
ebc2e48
f6123de
39a0811
debffb2
f20cef5
aff4126
4b8c389
d37e0f0
00d4c7f
21d5b5f
929037b
4dfc9f7
62f5166
adee2a8
9a7291b
105a04b
9f6ee69
0c5d93b
cfd372d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -385,15 +385,21 @@ private protected override void EmitSymbolTable(IDictionary<Utf8String, SymbolDe | |
| } | ||
| } | ||
|
|
||
| // TODO-WASM: The logic here isn't comprehensive yet. It should cover primitive types and references, | ||
| // but by-value structs + nullable types aren't handled yet. | ||
| public static class WasmAbiContext | ||
| { | ||
| private static WasmValueType LowerType(TypeDesc type) | ||
| { | ||
| if ((type.IsValueType && !type.IsPrimitive) || type.IsNullable) | ||
| WasmValueType pointerType = (type.Context.Target.PointerSize == 4) ? WasmValueType.I32 : WasmValueType.I64; | ||
|
|
||
| if (type.IsValueType && !type.IsPrimitiveNumeric) | ||
| { | ||
| throw new NotImplementedException($"By-value struct types are not yet supported: {type}"); | ||
| type = Internal.JitInterface.WasmLowering.LowerTypeForWasm(type); | ||
|
|
||
| if (type == null) | ||
| { | ||
| // pass by-ref | ||
| return pointerType; | ||
| } | ||
|
Comment on lines
+392
to
+402
|
||
| } | ||
|
|
||
| switch (type.UnderlyingType.Category) | ||
|
|
@@ -428,7 +434,7 @@ private static WasmValueType LowerType(TypeDesc type) | |
| case TypeFlags.ByRef: | ||
| case TypeFlags.Pointer: | ||
| case TypeFlags.FunctionPointer: | ||
| return WasmValueType.I32; | ||
| return pointerType; | ||
|
|
||
| default: | ||
| throw new NotSupportedException($"Unknown wasm mapping for type: {type.UnderlyingType.Category}"); | ||
|
|
@@ -449,7 +455,6 @@ private static WasmValueType LowerType(TypeDesc type) | |
| public static WasmFuncType GetSignature(MethodDesc method) | ||
| { | ||
| // TODO-WASM: handle struct by-value return (extra parameter pointing to buffer must be in signature) | ||
| // TODO-WASM: handle seemingly by-value struct arguments that are actually passed implicitly by reference | ||
|
|
||
| MethodSignature signature = method.Signature; | ||
| TypeDesc returnType = signature.ReturnType; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: this could use
Target::g_tgtCPUName.