History log of /wasmtime-44.0.1/crates/wit-bindgen/src/rust.rs (Results 1 – 25 of 31)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: dev, v36.0.9, v44.0.1, v43.0.2, v36.0.8, v24.0.8, v44.0.0, v43.0.1, v42.0.2, v36.0.7, v24.0.7, v43.0.0
# 1b59b579 09-Mar-2026 Yordis Prieto <[email protected]>

Add support for map type (#12216)

* Add support for map type

Signed-off-by: Yordis Prieto <[email protected]>

* Add Map and MapEntry classes to support key/value pairs in component model

Th

Add support for map type (#12216)

* Add support for map type

Signed-off-by: Yordis Prieto <[email protected]>

* Add Map and MapEntry classes to support key/value pairs in component model

This commit introduces the Map and MapEntry classes, enabling the representation of map values in the component model. The Map class allows for the creation and iteration of key/value pairs, enhancing the functionality of the wasmtime component API. Additionally, the .gitignore file is updated to exclude build artifacts from the crates/c-api directory.

* Add wasm_component_model_map configuration support

* Format code

* Format C code

* Enhance component model to support HashMap<K, V> type

This commit introduces support for HashMap<K, V> in the component model, allowing maps to be represented as list<tuple<K, V>> in the canonical ABI. It includes implementations for the ComponentType, Lower, and Lift traits for HashMap, enabling type checking, lowering to flat representations, and lifting from memory. Additionally, the maximum depth for type generation in the fuzzing utility is updated to accommodate the new map type.

* Refactor component configuration to introduce map support

This commit removes the previous wasm features configuration and adds new functions for creating a map-configured engine. The `map_config` and `map_engine` functions are introduced to facilitate the use of the component model with maps in tests, ensuring that the engine is properly configured for map types in the component model.

* Add new WAST test for map types and remove map type definitions from existing tests

This commit introduces a new WAST test file specifically for testing various map types in the component model. Additionally, it removes the redundant map type definitions from the existing types.wast file to streamline the test suite.

* Update component fuzzing and dynamic tests to replace call_and_post_return with call

* Format code

* Refactor HashMap usage in typed.rs to use wasmtime_environ collections

* Fix HashMap initialization and insertion to handle potential errors in typed.rs

* Refactor HashMap handling in typed.rs to use lower_map_iter for improved iteration and memory management. Introduce new implementations for ComponentType, Lower, and Lift traits for std::collections::HashMap, enhancing support for map types in the component model.

* Fix map adapter trampoline compilation and alignment bugs

The translate_map function had two categories of bugs preventing map
adapter trampolines from working:

1. Wasm stack discipline: local_set_new_tmp emits LocalSet which pops
from the stack, but was called when the stack was empty (to
"pre-allocate" locals). Fixed by computing values first, then
calling local_set_new_tmp to consume them—matching translate_list's
pattern. Also removed an erroneous LocalTee that left an orphan
value on the stack. Affected: src_byte_len, dst_byte_len,
cur_src_ptr, cur_dst_ptr.

2. Pointer advancement: after value translation, the pointer still
points at the value start. The code only advanced by trailing
padding instead of value_size + trailing_padding, causing every
loop iteration to re-read the same memory.

Also fixes entry layout to use proper record alignment rules (entry
align = max(key_align, value_align), value at aligned offset).

* Refactor map entry layout calculations to use canonical ABI

* Remove unnecessary clone of map pairs during lowering

Val::Map already holds Vec<(Val, Val)> which derefs to &[(Val, Val)],
matching lower_map's signature directly. The intermediate Vec allocation
and deep clone of every key/value pair was redundant.

* Deduplicate map lift logic between HashMap implementations

* Deduplicate list and map sequence translation scaffolding

* Fix cargo fmt formatting issues

* Deduplicate map typecheck logic

* Deduplicate map lowering with linear_lower_map_to_flat and linear_lower_map_to_memory helpers

* Clean up lift_try_map: use drop, move TryHashMap import to module scope

* Fix CI: arbtest overflow and no-std HashMap lift_map

- component_fuzz: use saturating_sub in generate_hashable_key to prevent
underflow when fuel is 0 and Enum variant is chosen
- typed: remove incorrect ? operators in lift_map for hashbrown::HashMap
(with_capacity and insert don't return Result)

* Store map tuple layout in TypeMap

Compute map entry ABI and value offsets once during type building, and reuse that metadata in runtime map lift/lower paths instead of recalculating tuple layout at each call site.

* Refactor map ABI argument passing

Bundle map lift/lower layout and type metadata into a small MapAbi32 helper so map helper calls stay concise without changing behavior.

* Fix CI: enable component_model_map in fuzzing and handle map in arbitrary_val

The fuzzer's component_api oracle was generating map types but the engine
didn't have the map feature enabled, and arbitrary_val had no arm for
Type::Map. Enable component_model_map in the store helper (matching how
component_model_async is forced on) and implement arbitrary value generation
for map types.

---------

Signed-off-by: Yordis Prieto <[email protected]>

show more ...


Revision tags: v42.0.1, v41.0.4, v42.0.0, v40.0.4, v36.0.6, v24.0.6
# d2fbd2de 12-Feb-2026 Alex Crichton <[email protected]>

Update to wasm-tools 245 (#12571)

* Intrinsics updates

* Remove ds_store

* Update to wasm-tools 245

* Add vets

* Fixup tests

* Add missing feature for `indexmap`

---------

Co-authored-by: Sy

Update to wasm-tools 245 (#12571)

* Intrinsics updates

* Remove ds_store

* Update to wasm-tools 245

* Add vets

* Fixup tests

* Add missing feature for `indexmap`

---------

Co-authored-by: Sy Brand <[email protected]>

show more ...


Revision tags: v41.0.3, v41.0.2, v41.0.1, v36.0.5, v40.0.3, v41.0.0, v36.0.4, v39.0.2, v40.0.2, v40.0.1
# e63dd69f 07-Jan-2026 Alex Crichton <[email protected]>

Update wasm-tools dependencies (#12254)

* Update wasm-tools dependencies

Brings in binary-parsing support for the WIT `map` type as well as the
wasm compact-imports proposal. Neither of these are e

Update wasm-tools dependencies (#12254)

* Update wasm-tools dependencies

Brings in binary-parsing support for the WIT `map` type as well as the
wasm compact-imports proposal. Neither of these are enabled by default
and will continue to be rejected, but it'll now be possible to support
them without needing to update dependencies.

* Add vets

* Update test expectations, add tests

Closes #12166

show more ...


Revision tags: v40.0.0, v39.0.1, v39.0.0, v38.0.4, v37.0.3, v36.0.3, v24.0.5, v38.0.3, v38.0.2, v38.0.1, v37.0.2, v37.0.1, v37.0.0, v36.0.2, v36.0.1, v36.0.0
# b4475438 30-Jul-2025 Joel Dice <[email protected]>

refactor `{Stream,Future}|{Reader,Writer}` APIs and internals (#11325)

* refactor `{Stream,Future}|{Reader,Writer}` APIs and internals

This makes a several changes to how `{Stream,Future}|{Reader,W

refactor `{Stream,Future}|{Reader,Writer}` APIs and internals (#11325)

* refactor `{Stream,Future}|{Reader,Writer}` APIs and internals

This makes a several changes to how `{Stream,Future}|{Reader,Writer}` work to
make them more efficient and, in some ways, more ergonomic:

- The background tasks have been removed, allowing reads and writes to complete without task context switching. We now only allocate and use oneshot channels lazily when the other end is not yet ready; this improves real world performance benchmarks (e.g. wasi-http request handling) considerably.

- Instances of `{Stream,Future}Reader` can now be lifted and lowered directly; no need for `Host{Stream,Future}` anymore.

- The type parameter for `Stream{Reader,Writer}` no longer refers to the buffer type -- just the payload type (i.e. `StreamReader<u8>` instead of `StreamReader<Vec<u8>>`), meaning any buffer type may be used for a given read or write operation. This also means the compiler needs help with type inference less often when calling `Instance::stream`.

- Instances of `{Stream,Future}|{Reader,Writer}` now require access to the store in order to be disposed of properly. I've added RAII wrapper structs (`WithAccessor[AndValue]`) to help with this, and also updated `Store::drop` and `Instance::run_concurrent` to ensure the store thread-local is set when dropping futures closing over `&Accessor`s.

- In order to ensure that resources containing `{Stream,Future}|{Reader,Writer}` instances are disposed of properly, I've added `LinkerInstance::resource_concurrent` and have updated `wasmtime-wit-bindgen` to use it. This gives resource drop functions access to a `StoreContextMut` via an `Accessor`, allowing the stream and future handles to be disposed of.
- In order to make this work, I had to change `Accessor::instance` from a `Instance` to an `Option<Instance>`, which is awkward but temporary since we're planning to remove `Accessor::instance` entirely once we've moved concurrent state from `ComponentInstance` to `Store`.

That problem of disposal is definitely the most awkward part of all this. In
simple cases, it's easy enough to ensure that read and write handles are
disposed of properly, but both `wasmtime-wasi` and `wasmtime-wasi-http` have
some pretty complicated functions where handles are passed between tasks and/or
stored inside resources, so it can be tricky to ensure proper disposal on all
code paths. I'm open to ideas for improving this, but I suspect we'll need new
Rust language features (e.g. linear types) to make it truly ergonomic, robust,
and efficient.

While testing the above, I discovered an issue with `Instance::poll_until` such
that it would prematurely give up and return a "deadlock" trap error, believing
that there was no further work to do, even though the future passed to it was
ready to resolve the next time it was polled. I've fixed this by polling it one
last time and only trapping if it returns pending.

Note that I've moved a few associated functions from `ConcurrentState` to
`Instance` (e.g. `guest_drop_writable` and others) since they now need access to
the store; they're unchanged otherwise. Apologies for the diff noise.

Finally, I've tweaked how `wasmtime serve` to poll the guest for content before
handing the response to Hyper, which helps performance by ensuring the first
content chunk can be sent with the same TCP packet as the beginning of the
response.

Signed-off-by: Joel Dice <[email protected]>

fix wasi p3 build and test failures

Signed-off-by: Joel Dice <[email protected]>

use `ManuallyDrop` instead of `Option` in `Dropper`

This allows us to drop its `value` field in-place, i.e. without moving it,
thereby upholding the `Pin` guarantee.

Signed-off-by: Joel Dice <[email protected]>

address review comments

- Remove `DropWithStoreAndValue` and friends; go back to taking a `fn() -> T` parameter in `Instance::future` instead
- Make `DropWithStore::drop[_with]` take `&mut self` instead of `self`
- Make `WithAccessor` and `DropWithStore` private
- Instead, I've added public `Guarded{Stream,Future}{Reader,Writer}` types for RAII
- and also `{Stream,Future}{Reader,Writer}::close[_with]` methods
- Use RAII in `FutureReader::read` and `FutureWriter::write` to ensure handles are dropped if the `Future` is dropped

Signed-off-by: Joel Dice <[email protected]>

* lower host stream/future writes in background task

This avoids unsoundness due to guest realloc calls while there are host embedder
frames on the stack.

Signed-off-by: Joel Dice <[email protected]>

* fix `tcp.rs` regressions

Signed-off-by: Joel Dice <[email protected]>

---------

Signed-off-by: Joel Dice <[email protected]>

show more ...


Revision tags: v35.0.0, v24.0.4, v33.0.2, v34.0.2, v34.0.1, v33.0.1, v24.0.3, v32.0.1, v34.0.0
# beca86b0 09-Jun-2025 Alex Crichton <[email protected]>

Re-enable concurrent bindings generation tests (#10972)

* Re-enable concurrent bindings generation tests

This commit re-enables tests for bindings generation for concurrent
calls in the main repo

Re-enable concurrent bindings generation tests (#10972)

* Re-enable concurrent bindings generation tests

This commit re-enables tests for bindings generation for concurrent
calls in the main repo after all syncs have now finished with wasip3.
This additionally adds some skeleton APIs that the bindings generator
uses which are necessary to get tests passing.

* Update test expectations

show more ...


Revision tags: v33.0.0
# 90ac295e 19-May-2025 Alex Crichton <[email protected]>

Update Wasmtime to the 2024 Rust Edition (#10806)

* Update Wasmtime to the 2024 Rust Edition

Now that our MSRV supports the 2024 edition it's possible to make this
switch. This commit moves Wasmtim

Update Wasmtime to the 2024 Rust Edition (#10806)

* Update Wasmtime to the 2024 Rust Edition

Now that our MSRV supports the 2024 edition it's possible to make this
switch. This commit moves Wasmtime to the 2024 Edition to keep
up-to-date with Rust idioms and access many of the edition features
exclusive to the 2024 edition.

prtest:full

* Reformat with the 2024 edition

show more ...


# e682be4e 05-May-2025 Alex Crichton <[email protected]>

Update wasm-tools crates (#10731)

* Update wasm-tools crates

Minor API changes, mostly just stubbing out support for
fixed-size-lists.

* Update vets

* Update some test expectations


Revision tags: v32.0.0
# 4d0a43fd 14-Apr-2025 Pat Hickey <[email protected]>

wasmtime-wit-bindgen: nonfunctional changes to internals (#10578)

* wasmtime-wit-bindgen: transform type printing to return strings

keep all used print_ functions, but otherwise NFC refactor to ret

wasmtime-wit-bindgen: nonfunctional changes to internals (#10578)

* wasmtime-wit-bindgen: transform type printing to return strings

keep all used print_ functions, but otherwise NFC refactor to return
String instead of push strs to the output.

* reusable typedfunc signature

prtest:full

* clippy

show more ...


Revision tags: v31.0.0
# b8e3fbe9 05-Mar-2025 Alex Crichton <[email protected]>

Update wasm-tools to the latest revision (#10314)

* Update wasm-tools to the latest revision

* Update component async bits for new intrinsics

* Ignore options for now

* I truly, and fundamentally

Update wasm-tools to the latest revision (#10314)

* Update wasm-tools to the latest revision

* Update component async bits for new intrinsics

* Ignore options for now

* I truly, and fundamentally, do not understand `cargo vet`

* Fix a test

show more ...


# af31e80d 28-Feb-2025 Pat Hickey <[email protected]>

wasmtime-wit-bindgen: emit a definition for all types in a wit interface (#10311)

* wasmtime-wit-bindgen: emit a definition for all types in a wit

The calculation of TypeInfo only reaches types whi

wasmtime-wit-bindgen: emit a definition for all types in a wit interface (#10311)

* wasmtime-wit-bindgen: emit a definition for all types in a wit

The calculation of TypeInfo only reaches types which are passed to or
from a function. For types which are not reachable, default to the
defining them according to the ownership setting given to bindgen.

I have my doubts that `with`-reuse of bindgen types actually works
properly when bindgen is set to Ownership::Borrowing but thats out
of scope for this PR, which is to fix #10090

* component-macro: bless bindgen test output

show more ...


# 6e221e7a 28-Feb-2025 Pat Hickey <[email protected]>

wasmtime-wit-bindgen: gen is a reserved keyword in the lexer starting in 2024 edition (#10308)


Revision tags: v30.0.2, v30.0.1, v30.0.0
# 636435f1 22-Jan-2025 Joel Dice <[email protected]>

async/stream/future support for wasmtime-wit-bindgen (#10044)

* async/stream/future support for wasmtime-wit-bindgen

I've split this out of #9582 to make review easier.

This patch adds async/strea

async/stream/future support for wasmtime-wit-bindgen (#10044)

* async/stream/future support for wasmtime-wit-bindgen

I've split this out of #9582 to make review easier.

This patch adds async/stream/future/error-context support to the host binding
generator, along with placeholder type and function definitions in the
`wasmtime` crate which the generated bindings can refer to. See
https://github.com/dicej/rfcs/blob/component-async/accepted/component-model-async.md#componentbindgen-updates
for the design and rationale.

Note that I've added temporary `[patch.crates-io]` overrides in Cargo.toml until
https://github.com/bytecodealliance/wit-bindgen/pull/1130 and
https://github.com/bytecodealliance/wasm-tools/pull/1978 have been released.

Also note that we emit a `T: 'static` bound for `AsContextMut<Data = T>` when
generating bindings with `concurrent_imports: true`. This is only because
`rustc` insists that the closure we're passing to
`LinkerInstance::func_wrap_concurrent` captures the lifetime of `T` despite my
best efforts to convince it otherwise. Alex and I suspect this is a limitation
in the compiler, and I asked about it on the rust-lang Zulip, but we haven't
been able to determine a workaround so far.

Signed-off-by: Joel Dice <[email protected]>

remove obsolete TODO comment

Signed-off-by: Joel Dice <[email protected]>

make `futures` dep optional

Signed-off-by: Joel Dice <[email protected]>

update `wasm-tools` and `wit-bindgen`

Signed-off-by: Joel Dice <[email protected]>

* run cargo vet

Signed-off-by: Joel Dice <[email protected]>

---------

Signed-off-by: Joel Dice <[email protected]>

show more ...


Revision tags: v29.0.1, v29.0.0, v28.0.1
# 4c5f250f 08-Jan-2025 Alex Crichton <[email protected]>

Update wasm-tools crates (#9952)

* Update wasm-tools crates

Pull in recent updates and denying memory64 support in components during
validation.

* Fix renamings in wave

* Fix some bindgen tests


Revision tags: v28.0.0, v27.0.0, v26.0.1, v25.0.3, v24.0.2, v26.0.0, v21.0.2, v22.0.1, v23.0.3, v25.0.2, v24.0.1, v25.0.1, v25.0.0, v24.0.0, v23.0.2
# a0442ea0 05-Aug-2024 Hamir Mahal <[email protected]>

Enforce `uninlined_format_args` for the workspace (#9065)

* Enforce `uninlined_format_args` for the workspace

* fix: failing `Monolith Checks` job

* fix: formatting


Revision tags: v23.0.1, v23.0.0, v22.0.0
# 44220746 03-Jun-2024 Alex Crichton <[email protected]>

Overhaul and improve documentation of `bindgen!` (#8727)

This is another take at improving the documentation for `bindgen!` in
Wasmtime. This commit takes a leaf out of the book of
bytecodealliance/

Overhaul and improve documentation of `bindgen!` (#8727)

This is another take at improving the documentation for `bindgen!` in
Wasmtime. This commit takes a leaf out of the book of
bytecodealliance/wit-bindgen#871 to organize the documentation of the
macro a bit more rather than having one giant doc block that can be
difficult to explore. The macro's documentation itself is now mostly a
reference of all the options that can be specified. There is now a new
documentation-only module which serves a few purposes:

* Individual examples are organized per-submodule to be a bit more
digestable.
* Each example has an example of the generated code in addition to the
source code used for each example.
* All examples are tested on CI to compile (none are run).

My hope is that this makes it easier to expand the docs here further
over time with niche features as they arise or with various options that
the macro has. This is one of the lynchpins of Wasmtime's support for
the component model so it seems pretty important to have a good
onboarding experience here.

Along the way I've implemented a few more niche options for the
`bindgen!` macro that I found necessary, such as configuring the
`wasmtime` crate and where it's located.

show more ...


Revision tags: v21.0.1, v21.0.0, v20.0.2
# 81a89169 04-May-2024 Alex Crichton <[email protected]>

Add support for `#![no_std]` to the `wasmtime` crate (#8533)

* Always fall back to custom platform for Wasmtime

This commit updates Wasmtime's platform support to no longer require an
opt-in `RUSTF

Add support for `#![no_std]` to the `wasmtime` crate (#8533)

* Always fall back to custom platform for Wasmtime

This commit updates Wasmtime's platform support to no longer require an
opt-in `RUSTFLAGS` `--cfg` flag to be specified. With `no_std` becoming
officially supported this should provide a better onboarding experience
where the fallback custom platform is used. This will cause linker
errors if the symbols aren't implemented and searching/googling should
lead back to our docs/repo (eventually, hopefully).

* Change Wasmtime's TLS state to a single pointer

This commit updates the management of TLS to rely on just a single
pointer rather than a pair of a pointer and a `bool`. Additionally
management of the TLS state is pushed into platform-specific modules to
enable different means of managing it, namely the "custom" platform now
has a C function required to implement TLS state for Wasmtime.

* Delay conversion to `Instant` in atomic intrinsics

The `Duration` type is available in `no_std` but the `Instant` type is
not. The intention is to only support the `threads` proposal if `std` is
active but to assist with this split push the `Duration` further into
Wasmtime to avoid using a type that can't be mentioned in `no_std`.

* Gate more parts of Wasmtime on the `profiling` feature

Move `serde_json` to an optional dependency and gate the guest profiler
entirely on the `profiling` feature.

* Refactor conversion to `anyhow::Error` in `wasmtime-environ`

Have a dedicated trait for consuming `self` in addition to a
`Result`-friendly trait.

* Gate `gimli` in Wasmtime on `addr2line`

Cut down the dependency list if `addr2line` isn't enabled since then
the dependency is not used. While here additionally lift the version
requirement for `addr2line` up to the workspace level.

* Update `bindgen!` to have `no_std`-compatible output

Pull most types from Wasmtime's `__internal` module as the source of
truth.

* Use an `Option` for `gc_store` instead of `OnceCell`

No need for synchronization here when mutability is already available in
the necessary contexts.

* Enable embedder-defined host feature detection

* Add `#![no_std]` support to the `wasmtime` crate

This commit enables compiling the `runtime`, `gc`, and `component-model`
features of the `wasmtime` crate on targets that do not have `std`. This
tags the crate as `#![no_std]` and then updates everything internally to
import from `core` or `alloc` and adapt for the various idioms. This
ended up requiring some relatively extensive changes, but nothing too
too bad in the grand scheme of things.

* Require `std` for the perfmap profiling agent

prtest:full

* Fix build on wasm

* Fix windows build

* Remove unused import

* Fix Windows/Unix build without `std` feature

* Fix some doc links

* Remove unused import

* Fix build of wasi-common in isolation

* Fix no_std build on macos

* Re-fix build

* Fix standalone build of wasmtime-cli-flags

* Resolve a merge conflict

* Review comments

* Remove unused import

show more ...


Revision tags: v20.0.1, v20.0.0, v17.0.3, v19.0.2, v18.0.4, v19.0.1
# e78605e8 26-Mar-2024 Alex Crichton <[email protected]>

Update wasm-tools family of crates (#8242)

Closes #8241


Revision tags: v19.0.0, v18.0.3, v18.0.2, v17.0.2, v18.0.1, v18.0.0
# a8209097 09-Feb-2024 Alex Crichton <[email protected]>

Fix more nightly warnings (#7907)

Additionally give `-Zcheck-cfg` a spin with Cargo and fix some mistakes
with our `--cfg` and `#[cfg]` directives.


Revision tags: v17.0.1, v17.0.0, v16.0.0, v15.0.1, v15.0.0, v14.0.4, v14.0.3, v14.0.2, v13.0.1, v14.0.1, v14.0.0, minimum-viable-wasi-proxy-serve, v13.0.0, v12.0.2, v11.0.2, v10.0.2
# 878a243a 30-Aug-2023 Timmy Silesmo <[email protected]>

Host resources wit-bindgen code generation (#6886)

* added trap to resource dtor

* basic resources

* fixed signature and trait bounds

* fixed static function

* fixed trait signature

* basic res

Host resources wit-bindgen code generation (#6886)

* added trap to resource dtor

* basic resources

* fixed signature and trait bounds

* fixed static function

* fixed trait signature

* basic resources

* added result to resource drop

* reverted formatting

* added doc comment to resource `dtor`

* fixed merge issue

* fixed another merge issue

* added resource import codegen test

* Revert changes to `Cargo.lock`

* Update `Cargo.lock` with the wit-bindgen update

* Add `cargo vet` entries for new crates

* Restore old-style of printing types in bindgen

Avoid collecting resources-as-we-go in favor of doing that more
declaratively elsewhere. Additionally handle imported-vs-exported
resource via the order that interfaces are visited.

* Update the shape of resource traits:

* Use `&mut self` instead of `StoreContextMut`
* Make resource traits as supertraits of the `Host` trait generated for
each resource.
* More uniformly handle types/returns with resource methods.
* Fix derivations of `Clone` and `Copy` for where handles are contained.

* Fix generation of handle typedefs

* Support resources-in-worlds

* Remove now-duplicate function

This is now the same as the preexisting `generate_function_trait_sig`

* Fix classifying handles as imported or exported

This determination happens by looking up the origin definition of a
resource, not the leaf possibly-aliased type.

* Fix chains-of-use of resources

Resources don't have their representation asserted since the bare type
itself doesn't implement `ComponentType`, but otherwise generate type
aliases the same way as other type aliases.

* Revert `Cargo.lock` changes

No need to update `wit-bindgen` to 0.10.0 just yet, that'll happen in a
future update if necessary.

* Add basic runtime tests for resources

* fixed merge issue

---------

Co-authored-by: Alex Crichton <[email protected]>

show more ...


# 35902366 26-Aug-2023 Lann <[email protected]>

Remove component union types (#6913)

- Bump wasm-tools deps
- Use new TypeSectionReader::into_iter_err_on_gc_types method


Revision tags: v12.0.1, v12.0.0
# 3878a002 07-Aug-2023 Andrew Brown <[email protected]>

Fix typo (#6819)


Revision tags: v11.0.1
# 5a6ed0fb 21-Jul-2023 Alex Crichton <[email protected]>

Implement component model resources in Wasmtime (#6691)

* Fix signatures registered with modules-in-components

This commit fixes a minor issue in
`FunctionIndices::link_and_append_code` which previ

Implement component model resources in Wasmtime (#6691)

* Fix signatures registered with modules-in-components

This commit fixes a minor issue in
`FunctionIndices::link_and_append_code` which previously ended up only
filling out the `wasm_to_native_trampolines` field for the first module
rather than all the modules. Additionally the first module might have
too many entries that encompass all modules instead of just its own
entries. The fix in this commit is to refactor this logic to ensure that
the necessary maps are present for all translations.

While technically a bug that can be surfaced through the embedder API
it's pretty obscure. The given test here panics beforehand but succeeds
afterwards, but this is moreso prep for some future resource-related
work where this map will need persisting into the component metadata
side of things.

* Initial support for resources

Lots of bits and pieces squashed into this commit. Much to be done
still.

* Start supporting destructors

* Get some basic drop tests working

Also add a test which requires host-defined drop to be called which
isn't working.

* Fix rebase issue

* Fix a failing test

* I am zorthax, destroyer of resources

* Remove a branch in compiled code

No need to check for a null funcref when we already know ahead of time
if it's ever going to be null or not.

* Fix the test suite

* Add embedder API to destroy resources

* Add TODO for factc

* Fix a warning and leave a comment

* Integrate resources into `Type`

Plumb around dynamic information about resource types.

* Implement `Val::Own`

* Implement reentrance check for destructors

Implemented both in the raw wasm intrinsic as well as the host.

* Use cast instead of transmute

* Fill out some cranelift-shared comments

* Update codegen for resource.drop shim

The MAY_ENTER flag must always be checked, regardless of whether there's
an actual destructor or not.

* Update wasm-tools crates to latest `main`

* Update resource.drop binary format

* Add some docs

* Implement dynamic tracking for borrow resources

Not actually hooked up anywhere but this should at least be a first stab
at an implementation of the spec.

* Remove git overrides

* Remove no-longer-needed arms in wit-bindgen

* Prepare for mutability in `LiftContext`

* Change `&LiftContext` to `&mut LiftContext`
* Remove `store: &'a StoreOpaque` from `LiftContext`, instead storing
just `memory: &'a [u8]`
* Refactor methods to avoid needing the entire `StoreOpaque`

This'll enable `LiftContext` to store `&'a mut ResourceTable` in an
upcoming commit to refer to the host's resources.

* Lowering a borrow is infallible

* Use `ResourceAny` for both own/borrow

Rename `Val::Own` to `Val::Resource` accordingly.

* Initial implementation of borrowed resources

Lots of juggling of contexts here and there to try and get everything
working but this is hopefully a faithful implementation. Tests not
implemented yet and will come next and additionally likely update
implementation details as issues are weeded out.

* Add a suite of tests for borrowing resources

Code coverage was used to ensure that almost all of the various paths
through the code are taken to ensure all the basic bases are covered.
There's probably still lurking bugs, but this should be a solid enough
base to start from hopefully.

* Fill in an issue for bindgen todo

* Add docs, still more to go

* Fill out more documentation

* Fill out a test TODO

* Update the host `Resource<T>` type

* Add docs everywhere
* Don't require a `Store` for creating the resource or getting the
representation.

The latter point is the main refactoring in this commit. This is done in
preparation for `bindgen!` to use this type where host bindings
generally do not have access to the store.

* Document `ResourceAny`

* Debug assert dtor is non-null

* Review comments on loading libcalls

* Update some comments

* Update a comment

* Fix some typos

* Add a test that host types are the same when guest types differ

* Fix some typos

* Thread things through a bit less

* Undo CompileKey-related changes

* Gate an async function on the async feature

* Fix doc links

* Skip resources tests in miri

They all involve compilation which takes too long and doesn't currently
work

show more ...


Revision tags: v11.0.0
# 80e68c33 11-Jul-2023 Alex Crichton <[email protected]>

Update the wasm-tools family of crates (#6710)

* Update wasm-tools dependencies

* Get tests passing after wasm-tools update

Mostly dealing with updates to `wasmparser`'s API.

* Update `cargo vet`

Update the wasm-tools family of crates (#6710)

* Update wasm-tools dependencies

* Get tests passing after wasm-tools update

Mostly dealing with updates to `wasmparser`'s API.

* Update `cargo vet` for new crates

* Add `equivalent`, `hashbrown`, and `quote` to the list of trusted
authors. We already trust these authors for other crates.
* Pull in some upstream audits for various deps.
* I've audited the `pulldown-cmark` dependency upgrade myself.

show more ...


# 537214fd 27-Jun-2023 Joel Dice <[email protected]>

[wit-bindgen] provide more control over type ownership (#6648)

* [wit-bindgen] provide more control over type ownership

This replaces the `duplicate_if_necessary` parameter to
`wasmtime::component:

[wit-bindgen] provide more control over type ownership (#6648)

* [wit-bindgen] provide more control over type ownership

This replaces the `duplicate_if_necessary` parameter to
`wasmtime::component::bindgen` with a new `ownership` parameter which provides
finer-grained control over whether and how generated types own their fields.

The default is `Ownership::Owning`, which means types own their fields
regardless of how they are used in functions. These types passed by reference
when used as parameters to guest-exported functions. Note that this also
affects how unnamed types (e.g. `list<list<string>>`) are passed: using a
reference only at the top level (e.g. `&[Vec<String>]` instead of `&[&[&str]]`,
which is more difficult to construct when using non-`'static` data).

The other option is `Ownership::Borrowing`, which includes a
`duplicate_if_necessary` field, providing the same code generation strategy as
was used prior to this change.

If we're happy with this approach, I'll open another PR in the `wit-bindgen`
repo to match.

This also fixes a bug that caused named types to be considered owned and/or
borrowed when they shouldn't have been due to having fields with unnamed types
which were owned and/or borrowed in unrelated interfaces.

Signed-off-by: Joel Dice <[email protected]>

* fix test breakage

Signed-off-by: Joel Dice <[email protected]>

---------

Signed-off-by: Joel Dice <[email protected]>

show more ...


Revision tags: v10.0.1, v10.0.0, v9.0.4, v9.0.3, v9.0.2, v9.0.1, v9.0.0, v6.0.2, v7.0.1, v8.0.1, v8.0.0
# 85118c8c 17-Apr-2023 kevaundray <[email protected]>

Add clippy suggestions (#6203)

* add clippy suggestions

* revert &/ref change

* Update cranelift/isle/isle/src/parser.rs

Co-authored-by: Jamey Sharp <[email protected]>

---------

Co-authored-by

Add clippy suggestions (#6203)

* add clippy suggestions

* revert &/ref change

* Update cranelift/isle/isle/src/parser.rs

Co-authored-by: Jamey Sharp <[email protected]>

---------

Co-authored-by: Jamey Sharp <[email protected]>

show more ...


12