alexcrichton opened PR #11 from new-api
to main
:
Overhaul the
wasmtime
crate's API to improve it along a number of vectors:
Greatly improve the multithreading story in all languages (Rust, C, Go, ...),
namely enabling safe usage ofwasmtime
in multithreaded server runtimes
where wasm objects can migrate between threads.Leverage mutability in Rust to allow
&mut
access to user-defined state
instead of requiring users to use interior mutability.Simplify memory management in the C API and embeddings.
The only major cost relative to today's API is that
ExternRef
will move to
atomic reference counting and will requireT: Send + Sync
on constructors.
bnjbvr submitted PR Review.
bnjbvr submitted PR Review.
bnjbvr created PR Review Comment:
self`. The reason for this is that everything is effectively behind an `Rc`
bnjbvr created PR Review Comment:
Above it is suggested that having the
Store
beSend + Sync
is optional and depends onT
beingSend + Sync
too; so is this a strong requirement, even when the embedder doesn't need aSend + Sync
Store
?
bnjbvr created PR Review Comment:
Should the first parameter be
cx: impl AsContextMut
here?
bnjbvr created PR Review Comment:
Are these two functions doing more than what the
AsContext/Mut
trait methods provide?
bnjbvr created PR Review Comment:
* Management of memory in the API can sometimes be confusing. Additionally for C
alexcrichton submitted PR Review.
alexcrichton created PR Review Comment:
That's correct, regardless of whether the embedder needs
Send
andSync
host functions will always be required to beSend
andSync
. This is thought to be ok, though, because most host state should be stored inT
rather than in the funtion itself, and it's expected that the majority of host functions are simply 0-sized closures that are just code and no data.
alexcrichton submitted PR Review.
alexcrichton created PR Review Comment:
Nah they're just explicitly named so if users want to call them they don't have to import the trait. I'm not sure if this makes sense but it's always an option we can have of course!
alexcrichton updated PR #11 from new-api
to main
.
alexcrichton updated PR #11 from new-api
to main
.
alexcrichton updated PR #11 from new-api
to main
.
bjorn3 created PR Review Comment:
it's simply an index into the `Store`. This implementation detail is how the
bjorn3 submitted PR Review.
alexcrichton updated PR #11 from new-api
to main
.
pchickey submitted PR review.
peterhuene submitted PR review.
jedisct1 submitted PR review.
sunfishcode submitted PR review.
sunfishcode submitted PR review.
sunfishcode created PR review comment:
`wasm.h` which does not have any sort of context handle passed around anywhere.
alexcrichton updated PR #11 from new-api
to main
.
bjorn3 submitted PR review.
radu-matei submitted PR review.
abrown submitted PR review.
thomastaylor312 submitted PR review.
bacongobbler submitted PR review.
bnjbvr submitted PR review.
alexcrichton merged PR #11.
Last updated: Dec 23 2024 at 12:05 UTC