feat: allow custom fiber API impls on unsupported arches#13620
feat: allow custom fiber API impls on unsupported arches#13620rvolosatovs wants to merge 2 commits into
Conversation
b3a252b to
f2c42ca
Compare
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
f2c42ca to
a40269c
Compare
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
| mod nostd; | ||
| use nostd as imp; | ||
| mod stackswitch; |
There was a problem hiding this comment.
I'm not sure if this should be gated by custom feature, but the comment in stackswitch states:
// No support for this platform. Don't fail compilation though and // instead defer the error to happen at runtime when a fiber is created. // Should help keep compiles working and narrows the failure to only // situations that need fibers on unsupported platforms.
so this seems consistent
alexcrichton
left a comment
There was a problem hiding this comment.
Sounds reasonable to me, thanks!
Structurally though I'd like to plumb this a bit differently to ensure this shows up in the wasmtime-platform.h header file. That header is generated from this file and is the current source-of-truth for "wasmtime may externally rely on these things" and provides a nice place to document things as well.
Now if these C API definitions were added over there they wouldn't actually be usable in wasmtime-internal-fiber due to crate dependencies, but that's also fine to have them duplicated here. Basically, can you add these function definitions over there, document them as to their purpose, leave a provisional comment in both locations saying "hey this is duplicated over there keep them in-sync", and then regenerate the header file?
Add support for custom embedder-supplied fiber implementations, similar to e.g.
custom-virtual-memoryfeature and others that already exist.I'm not sure whether
custom-fiberorcustom-stack-switchis more appropriate, went for the one matching the crate name.For my concrete use case, this is sufficient to allow running Wasmtime with cranelift in interpreter mode using Pulley with
async/component-model-asyncfeatures enabled, compiled to wasm32-unknown-unknown with a bit of JS glue based on JSPI in the browser or node.js