-
The first idea that comes to my mind when we have multi value wasm is that we just break down struct in memory until it contains just primitive datatype in the correct order. Then we just return or store the return value in correct or with the correct offset in memory. Is that true how it works? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 16 replies
-
Basically yes, although exactly how and when it makes sense to do this kind of thing is up in the air still. This is really question for upstream llvm which does the code generation. There is an experiment-mv ABI there that is not currently well supported but you can play with it you like. On the emscripten side will likely not make any changes to the ABI aside from following whatever upstream llvm does. Separately to the C ABI there is talk of enabling multi-value as a feature so we can use it internally for things (e.g. using assembly perhaps). For recent work on this see: llvm/llvm-project#88492 |
Beta Was this translation helpful? Give feedback.
-
Why not do this, for now, for every struct that is breakable into basic wasm types? Maybe I'm not experienced enough to see the issue? |
Beta Was this translation helpful? Give feedback.
Basically yes, although exactly how and when it makes sense to do this kind of thing is up in the air still. This is really question for upstream llvm which does the code generation. There is an experiment-mv ABI there that is not currently well supported but you can play with it you like. On the emscripten side will likely not make any changes to the ABI aside from following whatever upstream llvm does.
Separately to the C ABI there is talk of enabling multi-value as a feature so we can use it internally for things (e.g. using assembly perhaps).
For recent work on this see: llvm/llvm-project#88492
And WebAssembly/tool-conventions#223
And llvm/llvm-project#82714