626 Commits

Author SHA1 Message Date
Ryan Levick
7db951ba9f Consistently add generated preamble (#621)
* Consistently add generated preamble

* Fix tests
2023-07-17 15:40:18 -05:00
Alex Crichton
67e2d2228a Bump crate versions (#620)
Pull in recent updates and bug fixes, namely the wasm-tools updates and
new Rust generator features.
2023-07-14 20:14:54 -05:00
Peter Huene
4e2dcd4431 Rust: add option for path to wit-bindgen runtime. (#619)
* Rust: add option for path to wit-bindgen runtime.

This change adds an optional path to the `wit-bindgen` runtime to use for Rust
code generation.

This will allow a different crate from `wit-bindgen` to generate bindings while
also re-exporting `wit-bindgen::rt` at a known path for the generated code to
use.

* Rust: add `runtime_path` macro option and a test.
2023-07-14 16:35:15 -05:00
Ryan Levick
cce4af414c Fix warnings when compiling with Rust 1.71 (#618) 2023-07-14 10:06:57 -05:00
Ryan Levick
1151bd0e2a C: Namespace types inside of annoymous types (#608)
* C: Namespace types inside of annoymous types

* Go generator should use c generator's name generation

* Optionaly namespace inner types for all anonymous types

* Test more
2023-07-14 10:06:26 -05:00
Peter Huene
a33d062f1e Update dependencies to latest. (#616)
This commit updates dependencies to latest.

It includes the latest wasm-tools, where support for resources has been stubbed
out with a `todo!`.

Hopefully that won't be too much of an annoyance for those actively developing
support for resources.

Additionally, `indexmap`, which is used extensively on many public APIs, has
been rev'd to a new major version; this resulted in no required source changes.
2023-07-13 13:01:48 -05:00
Dan Gohman
1a3acf9257 Correct the accounting for results containing empty types. (#610)
* Correct the accounting for results containing empty types.

Empty types are special-cased in the C backend because C doesn't allow
zero-sized types. In the case of a result containing an empty type,
when processing the ok side, increment the return value counter even
if the store is omitted due to the value being empty.

Fixes #609.

* Test all the combinations of non-empty, empty, and absent.
2023-07-12 13:21:53 -07:00
Ryan Levick
d629bc12ba Alias anon types in tiny-go (#606)
* Alias anon types in tiny-go

* Expand codegen test for anon types
2023-07-07 10:57:16 -07:00
xxchan
7019072594 fix symbol conflicts for post return (#602)
follow-up of #593
2023-06-30 10:18:29 -05:00
Jiaxiao Zhou
8ceb28d320 Disable flaky variants go-bindgen runtime test (#601)
Signed-off-by: Jiaxiao Zhou (Mossaka) <duibao55328@gmail.com>
2023-06-29 12:08:38 -05:00
Ali Somay
262207cb34 Update rust guest example comments in README.md (#599)
* Update rust guest example comments in README.md

* Shorten the explanations on export_host macro

Co-authored-by: Kyle Brown <kylebrw@gmail.com>

---------

Co-authored-by: Kyle Brown <kylebrw@gmail.com>
2023-06-29 12:02:09 -05:00
Daniel Bevenius
0cc1e99c26 Update preview2-prototyping download links (#577)
* Update preview2-prototyping download links

This commit updates the preview2-prototyping command and reactor .wasm
download links as they have been updated.

Signed-off-by: Daniel Bevenius <daniel.bevenius@gmail.com>

* Change component adapter links to point to wasmtime

This commit updates the link to the component adapters to point to the
wasmtime repository instead of preview2-prototyping.

Signed-off-by: Daniel Bevenius <daniel.bevenius@gmail.com>

---------

Signed-off-by: Daniel Bevenius <daniel.bevenius@gmail.com>
2023-06-28 10:55:32 -05:00
Joel Dice
c28cdd6c1c provide more control over type ownership (#598)
* provide more control over type ownership

This is the guest version of https://github.com/bytecodealliance/wasmtime/pull/6648.

This replaces the duplicate_if_necessary parameter to the Rust binding generator
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 are 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.

Signed-off-by: Joel Dice <joel.dice@fermyon.com>

* fix tests

Signed-off-by: Joel Dice <joel.dice@fermyon.com>

* fix tests, part 2

Signed-off-by: Joel Dice <joel.dice@fermyon.com>

---------

Signed-off-by: Joel Dice <joel.dice@fermyon.com>
2023-06-28 10:54:30 -05:00
Alex Crichton
544576ea94 Bump crate versions (#596)
* Update to published Wasmtime 10

* Bump crates to 0.8.0

Will publish a release compatible with the latest Wasmtime 10
2023-06-22 18:28:30 -05:00
Alex Crichton
131746313d Fix symbol conflicts in exported Rust functions (#593)
Closes #592
2023-06-13 12:18:09 -05:00
Jiaxiao Zhou
e69cf5db87 Updated README to reflect on the newest WIT package format (#591)
Signed-off-by: Jiaxiao Zhou (Mossaka) <duibao55328@gmail.com>
2023-05-31 09:46:47 -05:00
Jiaxiao Zhou
ede00f0bf3 fix(go): enable all the codegen tests for go generator (#588)
* update go generator to re-enable codegen-tests

Signed-off-by: Jiaxiao Zhou (Mossaka) <duibao55328@gmail.com>

* Re-enable runtime tests

Signed-off-by: Jiaxiao Zhou (Mossaka) <duibao55328@gmail.com>

* enable all the runtime tests

Signed-off-by: Jiaxiao Zhou (Mossaka) <duibao55328@gmail.com>

* adds variants test

Signed-off-by: Jiaxiao Zhou (Mossaka) <duibao55328@gmail.com>

---------

Signed-off-by: Jiaxiao Zhou (Mossaka) <duibao55328@gmail.com>
2023-05-31 09:38:07 -05:00
Jiaxiao Zhou
8bab26e857 update go generator to re-enable codegen-tests (#585)
Signed-off-by: Jiaxiao Zhou (Mossaka) <duibao55328@gmail.com>
2023-05-26 17:28:09 -05:00
Joel Dice
081a4bb11c update teavm-java generator and re-enable tests (#584)
Signed-off-by: Joel Dice <joel.dice@fermyon.com>
2023-05-26 15:25:57 -05:00
Alex Crichton
a2935a4fa4 Update wit-bindgen for upcoming WIT changes (#580)
* Update Rust codegen for new WIT changes

* Update the markdown generation for new WIT

* more-rust

* Update the C generator for new WIT

* Get Rust guest tests compiling

* Get rust host tests working

* Get all C tests passing

* Turn off teavm-java and Go tests for now

* Fixup lockfile after rebase

* Bump crate versions

* Update dependency sources

* Update to wasmtime dep
2023-05-26 12:30:24 -05:00
Dan Gohman
0b5ed6390c Give the C component-type object a valid encoding. (#583)
Add an `end` opcode to the dummy function in the component-type object
produced for the C bindings, which is needed in order for the resulting
binary encoding to validate.
2023-05-25 10:24:04 -05:00
Alex Crichton
dab3644b0e Update to Wasmtime 9.0.0 (#582) 2023-05-24 16:27:57 -05:00
Pat Hickey
c1eb6ba2ff bump dependencies on all wasm-tools crates (#579) 2023-05-17 12:54:50 -05:00
Pat Hickey
7fad6bdbf2 TypeInfo.error detection: chase down definition typeid (#576) 2023-05-12 12:32:54 -05:00
Alex Crichton
0d398ceee8 Fix types used when interfaces are imported and exported (#574)
This fixes an issue where exported freestanding functions are intended
to refer to imported types, not exported types. The order of bindings
generation is altered here to ensure that code generators get access to
types only as they're available, ensuring that functions refer to
imported types rather than exported ones.

Closes #573
2023-05-10 10:57:47 -05:00