Closed lukewagner closed 4 years ago
Indeed. Helper functions help with this: https://github.com/jgravelle-google/it-tools/blob/5ba7a5177f148400a7251fed442ae0dbf20bb012/examples/01%20-%20ITL/fizzbuzz.itl#L16, especially for C++ where we also need to null-terminate the strings. In general agree that this is worth having; I'm not sure where you'd prefer to drop
the pointer, so it should add to savings and convenience overall.
Overall, I am not sure this is worth it.
On Mon, May 11, 2020 at 1:36 PM Jacob Gravelle notifications@github.com wrote:
Indeed. Helper functions help with this: https://github.com/jgravelle-google/it-tools/blob/5ba7a5177f148400a7251fed442ae0dbf20bb012/examples/01%20-%20ITL/fizzbuzz.itl#L16, especially for C++ where we also need to null-terminate the strings. In general agree that this is worth having; I'm not sure where you'd prefer to drop the pointer, so it should add to savings and convenience overall.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/WebAssembly/interface-types/issues/114#issuecomment-626947544, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAQAXUD6WCDOQXR3QNJX5UDRRBOU3ANCNFSM4M6GEKHQ .
-- Francis McCabe SWE
Also not sure if it's worth the asymmetry. For example, what about the string length? Sometimes you need it, and in those cases you end up using a let there too.
Yeah, on second thought, it would be a bit ad hoc; a few let
s won't hurt anyone.
A common pattern seems to be:
Lowering ops tend to take an
i32
pointer (that they lower into) as the first operand, then pop it. This ensures that practically all cases of lowering will need to uselet
to pass the pointer to core wasm. It's a relatively minor detail, but I think it's worth considering having all lowering ops default to leaving thei32
pointer on the stack.