Stream: general

Topic: Symmetric ABI variant


view this post on Zulip Christof Petig (Jul 13 2024 at 10:03):

Following a proposal by a co-worker I have been investigating into a modified ABI which is symmetric between caller and callee, while maintaining an unchanged API to the guest languages. This facilitates using WIT for compile-to-native plugins, because the same binding rules work for both sides of the call (no guest vs host distinction).

The rules are quite simple to define: Apply the same ABI for imported and exported interfaces.

For strings you can either select method(&str) -> &'post str (with 'post defined as until calling cabi_post on the result), method(&str) -> String or method(String) -> String. I selected the first one because it is the only option which removes all allocations from the call. Similar for vectors.

For resources I selected the import ABI for both sides, with the recent modification to make handles usize. This way a resource table becomes optional because you can pass rep directly to the other side.

You can find a link to the source code and more information in this thread

If you combine this with a caller provided buffer API (and/or async from 0.3) it becomes even more attractive for shared everything, as initial feed-back from SIG embedded suggests.

I post here as I would like to get a wider opinion on the acceptability as an alternative ABI configuration for shared everything.


Last updated: Dec 23 2024 at 12:05 UTC