alexcrichton · GitHub

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 of `wasmtime` 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 require `T: Send + Sync` on constructors.

@alexcrichton mentioned this pull request

May 4, 2021

Closed

alexcrichton added a commit to alexcrichton/wasmtime that referenced this pull request

May 5, 2021
This commit removes a TLS lookup of the store information whenever a
trap is created. This was previously done to lookup information in the
module registry, but nowadays there's a global registry which has all
the equivalent information as well. This commit moves around some code
in the module registry and then uses this global map when creating
traps.
This is not motivated by performance, and likely regresses performance
slightly since it involves taking a global lock now. That being said the
perf of creating a `Trap` is generally not super consequential, so this
is seen as ok.
The goal of this commit is to lessen Wasmtime's reliance on TLS for
store-based information. I'm hoping to lessen this even more with the
changes for bytecodealliance/rfcs#11, where acquiring a store via TLS is
going to be much more difficult if not possible any more.

Closed

bnjbvr

@alexcrichton

These locations may involve adding items into the `Store`, so a mutable
view is needed.

bjorn3

Merged

@alexcrichton

pchickey

peterhuene

Open

jedisct1

sunfishcode

Co-authored-by: Dan Gohman <dev@sunfishcode.online>

radu-matei

thomastaylor312

bacongobbler

@alexcrichton

alexcrichton added a commit to alexcrichton/wasmtime-py that referenced this pull request

Jun 3, 2021
This commit updates wasmtime-py to account for [RFC 11] and the changes
in Wasmtime's own C API. Note that this is a breaking change for this
binding, notably requiring that `Store` is a uniquely-owned value now
which must be passed in as context to most methods that operate with a
store. More details are in the commit itself and updated tests and such.
[RFC 11]: bytecodealliance/rfcs#11

Merged

alexcrichton added a commit to alexcrichton/wasmtime-go that referenced this pull request

Jun 3, 2021
This commit updates this repository to use Wasmtime's new C API as
specified by [RFC 11]. This is a breaking change for this API and
notably requires that a `Storelike` object is now passed in for many
functions, serving as the `Store` context for that method. The
implementation of memory management, however, has been greatly
simplified, now that objects within a `Store` no longer need
destructors. This should improve performance and also help avoid
reclaiming memory only at odd times.
[RFC 11]: bytecodealliance/rfcs#11

alexcrichton added a commit to bytecodealliance/wasmtime-py that referenced this pull request

Jun 3, 2021
* Update to Wasmtime's new C API
This commit updates wasmtime-py to account for [RFC 11] and the changes
in Wasmtime's own C API. Note that this is a breaking change for this
binding, notably requiring that `Store` is a uniquely-owned value now
which must be passed in as context to most methods that operate with a
store. More details are in the commit itself and updated tests and such.
[RFC 11]: bytecodealliance/rfcs#11
* Fix compat with Python 3.6
* Test Python 3.9 on CI
* Cancel in-flight jobs on CI

alexcrichton added a commit to bytecodealliance/wasmtime-go that referenced this pull request

Jun 3, 2021
* Update with Wasmtime's new C API
This commit updates this repository to use Wasmtime's new C API as
specified by [RFC 11]. This is a breaking change for this API and
notably requires that a `Storelike` object is now passed in for many
functions, serving as the `Store` context for that method. The
implementation of memory management, however, has been greatly
simplified, now that objects within a `Store` no longer need
destructors. This should improve performance and also help avoid
reclaiming memory only at odd times.
[RFC 11]: bytecodealliance/rfcs#11
* Try fixing bazel build
* Cancel in-flight jobs on CI

Merged

Closed

Open

olivierlemasle added a commit to olivierlemasle/opa that referenced this pull request

Jun 15, 2021

Open

srenatus pushed a commit to open-policy-agent/opa that referenced this pull request

Jun 21, 2021

jeremywiebe added a commit to Khan/fastlike that referenced this pull request

Aug 3, 2021
This upgrade includes a wasmtime-go fix for a linker bug on Linux where the pthread library wasn't linked and caused builds to fail on Linux.
The upgrade to wasmtime-go v0.29 also includes a migration to wasmtime's new C api (bytecodealliance/rfcs#11)

Merged

jeremywiebe added a commit to Khan/fastlike that referenced this pull request

Aug 4, 2021

Merged

Draft

X-leaf7 added a commit to X-leaf7/wasmtime-go that referenced this pull request

Jun 24, 2024
* Update with Wasmtime's new C API
This commit updates this repository to use Wasmtime's new C API as
specified by [RFC 11]. This is a breaking change for this API and
notably requires that a `Storelike` object is now passed in for many
functions, serving as the `Store` context for that method. The
implementation of memory management, however, has been greatly
simplified, now that objects within a `Store` no longer need
destructors. This should improve performance and also help avoid
reclaiming memory only at odd times.
[RFC 11]: bytecodealliance/rfcs#11
* Try fixing bazel build
* Cancel in-flight jobs on CI

Read the original on github.com ↗