* chore: convert wasi http cli test to component
* fix(wasmtime-cli): wrong linker in wasi http
* fix(wasmtime-cli): fix multiple functions added to linker
We will allow shadowing in linker when using
WASI HTTP in order to prevent the following
error:
> import of `wasi:clocks/wall-clock` defined
twice
* chore: update to latest io streams wit definition
* chore: rename main function of core module
prtest:full
* fix(wasmtime-cli): add only http functions to linker
* chore: add test building http request and response
* chore: disable temporarily wasi http test
The task was disabled due to a failing checksum. Since then, the
`install-openvino-action` has improved and now _almost_ has
cross-platform support. This change just restores the status quo in
expectation that #6895 will significantly improve the testing story.
prtest:full
To prepare this commit I've run `WIT_REQUIRE_SEMICOLONS=1 ./ci/run-tests.sh`
locally which configures `wit-parser` to generate an error for missing
semicolons in WIT files. This led me to add quite a few semicolons in
quite a few places in what is going to be the first of a few batches of
semicolons.
CI checks for this cannot be added just yet because the wasi-nn spec is
a submodule which needs to be updated with semicolons before this
repository can require semicolons. Nevertheless that doesn't stop us
from using semicolons in the meantime (yay gradual rollout of changes!)
so I figure this would be good to get in sooner rather than later.
* Change `bindgen!`'s trappable error to take an input type
This commit removes the generated type for `trappable_error_type` from
the `bindgen!` macro to allow users to provide a type instead. This
works similarly as before with new conversion functions generated in
traits which are used to convert the custom error into the ABI
representation of what a WIT world expects.
There are a few motivations for this commit:
* This enables reducing the number of errors in play between async/sync
bindings by using the same error type there.
* This avoids an auto-generated type which is more difficult to inspect
than one that's written down already and the source can more easily be
inspected.
* This enables richer conversions using `self` (e.g. `self.table_mut()`)
between error types rather than purely relying on `Into`. This is
important for #7017 where an error is going to be inserted into the
table as it gets converted.
* Fix tests
* Update WASI to use new trappable errors
This commit deals with the fallout of the previous commit for the WASI
preview2 implementation. The main changes here are:
* Bindgen-generated `Error` types no longer exist. These are replaced
with `TrappableError<T>` where type aliases are used such as
```rust
type FsError = TrappableError<wasi::filesystem::types::ErrorCode>;
```
* Type synonyms such as `FsResult<T>` are now added for more
conveniently writing down fallible signatures.
* Some various error conversions are updated from converting to the old
`Error` type to now instead directly into corresponding `ErrorCode` types.
* A number of cases where unknown errors were turned into traps now
return bland error codes and log the error instead since these aren't
fatal events.
* The `StreamError` type does not use `TrappableError` since it has
other variants that it's concerned with such as a
`LastOperationFailed` variant which has an `anyhow::Error` payload.
* Some minor preview1 issues were fixed such as trapping errors being
turned into normal I/O errors by accident.
* Add an `error` resource to WASI streams
This commit adds a new `error` resource to the `wasi:io/streams`
interface. This `error` resource is returned as part of
`last-operation-failed` and serves as a means to discover through other
interfaces more granular type information than a generic string. This
error type has a new function in the `filesystem` interface, for
example, which enables getting filesystem-related error codes from I/O
performed on filesystem-originating streams. This is plumbed through to
the adapter as well to return more than `ERRNO_IO` from failed
read/write operations now too.
This is not super fancy just yet but is intended to be a vector through
which future additions can be done. The main thing this enables is to
avoid dropping errors on the floor in the host and enabling the guest to
discover further information about I/O errors on streams.
Closes#7017
* Update crates/wasi-http/wit/deps/io/streams.wit
Co-authored-by: Trevor Elliott <awesomelyawesome@gmail.com>
* Update wasi-http wit too
* Remove unnecessary clone
---------
Co-authored-by: Trevor Elliott <awesomelyawesome@gmail.com>
This commit moves the optimizations from `sextend` for various shapes of
instructions into the `sext` helper. This enables these optimizations to
kick in when generating other instructions which require sign-extensions
such as `icmp` and `brif`.
This additionally fixes an issue introduced in #7121 where
uextend-of-sextend wasn't translated correctly and the outer `uextend`
was mistakenly omitted.
* riscv64: Add codegen tests for min/max
* riscv64: Remove unused `Type` payload from `Select`
* riscv64: Add codegen test for brif
* riscv64: Consolidate conditional moves into one instruction
This commit removes the `IntSelect` and `SelectReg` pseudo-instructions
from the riscv64 backend and consolidates them into the `Select`
instruction. Additionally the `Select` instruction is updated to subsume
the functionality of these two previous instructions. Namely `Select`
now operates with `ValueRegs` to handle i128 and additionally takes an
`IntegerCompare` as the condition for the conditional branch to use.
This commit touches a fair bit of the backend since conditional
selection of registers was used in quite a few places. The previous
`gen_select_*` functions are replaced with new typed equivalents of
`gen_select_{xreg,vreg,freg,regs}`. Furthermore new `cmp_*` helpers were
added to create `IntegerCompare` instructions which sort-of match
conditional branch instructions, or at least the pnemonics they use.
Finally since this affected the `select` CLIF instruction itself I went
ahead and did some refactoring there too. The `select` instruction
creates an `IntegerCompare` from its argument to use to generate the
appropriate register selection instruction. This is basically the same
thing that `brif` does and now both go through a new helper,
`lower_int_compare`, which takes a `Value` and produces an
`IntegerCompare` representing if that value is either true or false.
This enables folding an `icmp` or an `fcmp`, for example, directly into
a branching instruction.
* Fix a test
* Favor sign-extension in equality comparisons
* Refactor option handling in the `run` and `serve` commands
* Use a real thread to manage epoch increments
* Move module/component loading into src/common.rs
* Require wasi-http and component-model to not be disabled in serve
This allows embedders to implement those traits themselves rather than be
restricted to using the built-in implementations.
Fixes https://github.com/bytecodealliance/wasmtime/issues/7149
Signed-off-by: Joel Dice <joel.dice@fermyon.com>
* Refactor HTTP tests to be less flaky and more robust
This commit refactors the wasi-http tests we have in this repository
with a few changes:
* Each test now uses a dedicated port for the test. The port 0 is bound
and whatever the OS gives is used for the duration of the test. This
prevents tests from possibly interfering with each other.
* Server spawning is abstracted behind a single `Server` type now which
internally has http1/2 constructors.
* Timeouts for server shutdown are removed since they were failing in CI
and are likely best handled for each test individually if necessary.
As a minor cleanup the `tokio` usage in guest programs was removed as it
was boilerplate in this case. This shouldn't affect the runtimes of
tests, however.
* Remove unused import
* Don't panic from worker thread
* Improve failure error message
prtest:full
* Fix some windows-specific issues
* Fix async tests
* Relax test assertion string
* Implement the `wasi:sockets/ip-name-lookup` interface
This commit is an initial implementation of the new `ip-name-lookup`
interface from the `wasi-sockets` proposal. The intention is to get a
sketch of what an implementation would look like for the preview2
release later this year. Notable features of this implementation are:
* Name lookups are disabled by default and must be explicitly enabled in
`WasiCtx`. This seems like a reasonable default for now while the full
set of configuration around this is settled.
* I've added new "typed" methods to `preview2::Table` to avoid the need
for extra helpers when using resources.
* A new `-Sallow-ip-name-lookup` option is added to control this on the
CLI.
* Implementation-wise this uses the blocking resolution in the Rust
standard library, built on `getaddrinfo`. This doesn't invoke
`getaddrinfo` "raw", however, so information such as error details can
be lost in translation. This will probably need to change in the
future.
Closes#7070
* Validate the input domain name.
* Use a crate-level helper for `spawn_blocking`
---------
Co-authored-by: Dave Bakker <github@davebakker.io>
* riscv64: Add codegen tests for fcmp and fcmp branches
* riscv64: Refactor and simplify some branches/fcmp
This commit is aimed at simplifying the layers necessary to generate a
branch for a `brif` statement. Previously this involved a
`lower_cond_br` helper which bottomed out in emitting a `CondBr`
instruction. The intention here was to cut all that out and emit a
`CondBr` directly.
Along the way I've additionally taken the liberty of simplifying `fcmp`
as well. This moves the "prefer ordered compares" logic into `emit_fcmp`
so it can benefit the `fcmp` instruction as well. This additionally
trimmed some abstractions around branches which shouldn't be necessary
any longer.
This switches the `extractor` to a `pure partial` constructor to be used
in `if-let` instead of the extraction position, which while not quite as
ergonomic does enable matching more constant values in more locations.
* Fix race condition in `AsyncWriteStream`
This commit fixes a synchronization issue with `AsyncWriteStream` where
the writer task would get wedged and not make any further progress. The
underlying reason is that `notify_waiters` was used which did not buffer
its notification, meaning that if a waiter wasn't actually waiting then
it would miss the notification and block forever on the next call to
`notified`. By using `notify_one` instead this will buffer up a single
notification for the other end for when it gets to waiting for work.
Additionally this removes creation of the `Notified` future
ahead-of-time as that's no longer necessary.
* Fix http bodies too
Found in CI for #7099 this commit updates the durations used in the
`resolves_immediately` and `never_resolves` tests. For immediately
resolving it should be ok to wait for a generous amount of time since
the timeout is only a protection against tests hanging. For
`never_resolves` it should be ok to wait a short amount of time and any
failure there will show up as a spurious failure.
* Allow backlog size to be set before initial listen
* Move set_listen_backlog_size into example_body
* Format code
* Let cap_net_ext handle the default value.
* retrigger checks
* Got lost while pulling in changes from main.
* Handle `lower_branch` consistently amongst backends
This commit is a refactoring to consistently implement `lower_branch`
among Cranelift's backends. Previously each backend had its own means of
extracting labels and shuffling along information, and now there's
prelude methods for all backends to access and use. This changes a few
display impls but the actual meat of what's emitted shouldn't change
amongst the backends.
* Fix compile
* c-api: Add a feature for async
Signed-off-by: Tyler Rockwood <rockwood@redpanda.com>
* c-api: Add support for async config
Signed-off-by: Tyler Rockwood <rockwood@redpanda.com>
* c-api: Add support for calling async functions
Signed-off-by: Tyler Rockwood <rockwood@redpanda.com>
* c-api: Add ability to yield execution of Wasm in a store
Signed-off-by: Tyler Rockwood <rockwood@redpanda.com>
* c-api: Introduce wasmtime_linker_instantiate_async
Signed-off-by: Tyler Rockwood <rockwood@redpanda.com>
* c-api: Support defining async host functions
Signed-off-by: Tyler Rockwood <rockwood@redpanda.com>
* gitignore: ignore cmake cache for examples
Signed-off-by: Tyler Rockwood <rockwood@redpanda.com>
* examples: Add example of async API in C
Signed-off-by: Tyler Rockwood <rockwood@redpanda.com>
* c-api: Consolidate async functionality into a single place
Put all the async stuff in it's own header and own rust source file
Also remove the wasmtime_async_continuation_new function, users can just
allocate it directly.
Signed-off-by: Tyler Rockwood <rockwood@redpanda.com>
* c-api: Make async function safe
Signed-off-by: Tyler Rockwood <rockwood@redpanda.com>
* c-api: Remove wasmtime_call_future_get_results
Signed-off-by: Tyler Rockwood <rockwood@redpanda.com>
* c-api: Simplify CHostCallFuture
Move the result translation and hostcall_val_storage usage into an async
function
Signed-off-by: Tyler Rockwood <rockwood@redpanda.com>
* c-api: Simplify C continuation implementation
Remove the caller, which means that we don't need another struct for the
future implementation.
Signed-off-by: Tyler Rockwood <rockwood@redpanda.com>
* c-api: Improve async.h documentation
Signed-off-by: Tyler Rockwood <rockwood@redpanda.com>
* c-api: Cleanup from previous changes
Signed-off-by: Tyler Rockwood <rockwood@redpanda.com>
* examples: Fix example
Signed-off-by: Tyler Rockwood <rockwood@redpanda.com>
* c-api: Simplify continuation callback
This gives more duality with calling an async function and also means
that the implementation can pretty much mirror the sync version.
Signed-off-by: Tyler Rockwood <rockwood@redpanda.com>
* c-api: Fix async.h documentation
Signed-off-by: Tyler Rockwood <rockwood@redpanda.com>
* c-api: Fix documentation for async.h
Signed-off-by: Tyler Rockwood <rockwood@redpanda.com>
* c-api: Review feedback
Signed-off-by: Tyler Rockwood <rockwood@redpanda.com>
* examples: Downgrade async.cpp example to C++11
Signed-off-by: Tyler Rockwood <rockwood@redpanda.com>
* c-api: initialize continuation with a panic callback
Signed-off-by: Tyler Rockwood <rockwood@redpanda.com>
* prtest:full
Signed-off-by: Tyler Rockwood <rockwood@redpanda.com>
---------
Signed-off-by: Tyler Rockwood <rockwood@redpanda.com>
* riscv64: Refactor implementation of `{u,s}{div,rem}`
This commit's goal is to remove the usage of `gen_icmp` with
division-related instructions in the riscv64 backend. I've opted for a
slightly more verbose approach than what was present prior to make
sign/zero extensions more precise and additionally enable some
immediate-related optimizations.
Divison/remainder by an immediate will no longer emit checks to see if a
trap needs to be emitted. Instead only the raw `div`/`rem` instructions
are emitted. Additionally a few minor sign extensions are now avoided
such as the dividend in 32-bit remainders/division because only the
low 32-bits are inspected.
Finally, while I was here, I went ahead an added `has_m` guards to all
these lowering rules. The M extension is always required with riscv64
right now and won't work if it's turned off, but I figure it's not too
bad to add in terms of completeness for now.
As to the meat of the commit, the check for trapping value as part of
division now happens without `gen_icmp` but instead `gen_trapif` which
enables avoiding materializing the comparison's value into a register.
* Fix tests
This commit refactors how the `Pollable` resource is created in WASI.
Previously this was created manually via two variants of a `Pollable`
enum but this was somewhat error prone for a few reasons:
* The more common representation, `TableEntry`, had boilerplate
associated with it that had dynamic downcasts and such. This is now
all hidden behind a more typed API.
* Callers had to remember to use `push_child_resource` which is easy to
forget.
* The previous signature of the readiness check returned a `Result<()>`
which made it accidentally easy for errors to be propagated into traps
rather than being returned as a "last operation failed" error.
This commit replaces the previous API with a single `subscribe` function
which takes a `Resource<T>` and returns a `Resource<Pollable>`. The `T`
type must implement a new trait, `Subscribe`, which indicates the
asynchronous readiness check. This readiness check additionally returns
`()` so it's no longer possible to accidentally return errors (or trap).
This namely required refactoring the `HostOutputStream` trait and
implementations. The trait itself now has a `check_write` method
corresponding to to the same WASI function. The old `write_ready`
function is now a convenience helper combo between `ready` and
`check_write`. Concrete implementations are refactored to store errors
discovered during `ready` to get communicated through `check-write`
later on.
Currently any 32-bit constant can be materialized without a load from a
constant pool on RISCV-64 but once constants start getting larger than
this they're always loaded from the constant pool. This commit adds
another special case for loading constants which appears to match what
LLVM does which is to consider materializing a smaller constant and than
shifting it left.
This is done by chopping off all trailing zeros from an immediate and
then testing if the immediate can be materialized as a 32-bit constant.
This means that the current constant loading sequence can optionally be
followed by a trailing `slli` instruction to shift the zeros back into
the constant. This namely means that loading `i64::MIN` (1 << 63) no
longer falls back to the constant pool.
This commit removes the usage of `gen_icmp` in `uadd_overflow_trap`.
The comparison previously done with an explicit comparison is now
bundled directly into the conditional branch to go to the trap itself.
This commit fixes a compatibility issue with Rust 1.70.0 on Windows
targets. Rust 1.71.0 stabilized `AsSocket for Arc<T>` which is used here
implicitly, so to compile successfully on 1.70.0, our current MSRV, a
slight code change is required.
Closes#7127
* riscv64: Remove some stray whitespace
* riscv64: Refactor int-to-float emission
Use ISLE matching to generate different instructions rather than having
a method deeper in the backend select which instruction to use.
Additionally remove the usage of the `normalize_fcvt_to_int` helper.
* riscv64: Refactor and simplify `lower_bmask`
Take a `Value` as input to simplify 128-bit handling and additionally
simplify the rules a bit with other helpers.
* riscv64: Refactor `normalize_cmp_value` and `truthy_to_reg`
Remove the normalization completely by folding it into callers and
refactor `truthy_to_reg` to perform sign extension internally in
addition to handling 128-vs-64
* riscv64: Remove 128-bit handling from extension helper
This is only needed in a small handful of spots which can pretty easily
handle the sign extension on their own, and this further simplifies sign
extension to purely dealing with a single register.
* riscv64: Remove destination type in extension
This is always `$I64`, so no need to pass it around.
* riscv64: Remove `ext_if_need` helper
Fold 128-bit handling into callers as necessary
* riscv64: Refactor `sext` to take a `Value`
This commit refactors the `sext` helper to take a single `Value` as an
argument rather than an `XReg Type` combo. This will enable, in future
commits, to pattern-match the structure of the input and skip the sign
extension if possible. For example an `icmp` result is already
sign-extended.
This involved moving some `lower_*` declarations directly into
`lower.isle`. Additionally a special-case of lowering `brif` was removed
which caused regressions in generated code due to new `and` instructions
being generated to sign-extend the result of an `icmp`. Once `zext` is
also migrated to this pattern this regression should be fixed, so this
should just be a temporary state of affairs.
* riscv64: Fold `lower_umulhi` helper into lower.isle
* riscv64: Fold `lower_uadd_overflow` into lower.isle
* riscv64: Fold `lower_popcnt` into `lower.isle`
This slightly pessmizes codegen when the `zbb` extension isn't available
due to a sign extension for smaller-than-64-bit types, but this is
possible to fix in the future if necessary and helps simplify this in
the meantime.
Additionally this lifts the special cases for `has_zbb` directly into
the lowering rule.
* riscv64: Refactor clz and cls
This commit refactors the lowering rules for these two CLIF instructions
to move the sext/zext operations to the top rather than having them
buried in lowering rules. This additionally moves them to `lower.isle`
instead of `inst.isle`. This did result in some minor duplication but
overall feels a bit better due to them being less coupled now.
* riscv64: Move `gen_bswap` to `lower.isle`
Additionally shuffle rules around to remove the dependence on `zext`
because when this zero-extension happens it's known that many of the
extension-related optimizations are not applicable. This does pessimize
code slightly but it's hopefully not too bad given the current size of
the bswap lowering.
* riscv64: Change `zext` to taking a `Value`
This is similar to a prior commit for `sext` and will enable future
optimizations to skip the zext entirely if the structure of the value
allows.
* riscv64: Fold `extend` helper into `zext` and `sext`
This commit folds the existing rules of the `extend` helper into the
corresponding functions of `zext` and `sext`. They are the only callers
of `extend` and this keeps the sign extension-related logic truly in one
final resting place now at this point. A new matcher
`val_already_extended` is additionally added to add more cases in a
follow-up commit to enable skipping sign-extension operations based on
the structure of the `Value` input.
* riscv64: Optimize some sign extensions
As the culmination of all prior commits, this commit adds a few cases
where a sign extension is not necessary in the backend and can be
skipped. For example extending a sign-extended value is not required
because the backend always extends to the full register width.
Additionally extending the result of an `icmp` is not necessary since
that always produces a 0 or 1 value at the full register width.
* wasi: Add typed helpers to `Table`
This will help cut down on the `Table*Ext` traits while retaining type
safety.
* Remove `TableNetworkExt` trait
* Remove `TableTcpSocketExt` trait
* Remove the `TableReaddirExt` trait
* Remove `TableFsExt` trait
This involed a fair bit of refactoring within the preview2-to-preview1
adapter to handle the new ownership of resources, but nothing major.
* Remove `TableStreamExt` trait
Additionally simplify some stream methods while I'm here.
* Remove `TablePollableExt` trait
* Fix tests
* Fix some more tests
* Use typed accessors for terminal-{input,output}
* Remove dead code in `Table`
* Fix compile warnings in preview1 adapter
This isn't part of the "main build" so it's not inheriting the "deny
warnings" flag passed in CI, so fixup some warnings which have leaked
through over time.
* Remove some usage of `UnsafeCell` in the adapter
Move to abstractions such as `OnceCell` from the standard library as
well as `RefCell` to avoid some unsafety. This shouldn't have any
practical ramifications on the adapter, mostly just trying to help
over-time maintenance.
* Deny test-programs warnings in CI
* Cranelift: return programmatic error rather than panic when temporaries run out.
Cranelift currently has a limit of `2^21` vregs per function body in
VCode. This is a consequence of (performance-motivated) bitpacking of
`Operand`s into `u32`s in regalloc2.
As a result of this, it is possible to produce a function body that will
fail to compile by running out of vreg temporaries during lowering.
Currently, this results in a panic. Ideally, we would propagate the
error upward and return it programmatically.
This PR does that, with a "deferred error" mechanism. A cleaner solution
would be to properly thread the `Result` types through all layers of
lowering. However, that would require supporting `Result`s in ISLE, and
that is a deeper language-design and `islec`-hacking question that I
think we can tackle later if we continue to see motivating cases.
The deferral works by returning a valid but bogus `ValueReg`s to the
lowering rule, but storing the error and checking for it in the toplevel
lowering loop. (Note that we have to return a bogus `v0` rather than
`VReg::invalid()`, because the latter causes the `ValueRegs` to think
there is no register provided.)
This PR also includes a test at the Wasmtime level. Note that it takes
~22s to run on my (relatively fast) laptop, because it has to run until
it runs out of VRegs in a debug build of the compiler. We could remove
the test if we feel we're otherwise confident.
Thanks to Venkkatesh Sekar for reporting this issue! The integration
test uses one of the example inputs from the report.
* Review feedback.
* Handle alloc after a deferred error occurs.
* Add uncommitted fix for previous.
* Rename `Host*` things to avoid name conflicts with bindings.
* Update to the latest resource-enabled wit files.
* Adapting the code to the new bindings.
* Update wasi-http to the resource-enabled wit deps.
* Start adapting the wasi-http code to the new bindings.
* Make `get_directories` always return new owned handles.
* Simplify the `poll_one` implementation.
* Update the wasi-preview1-component-adapter.
FIXME: temporarily disable wasi-http tests.
Add logging to the cli world, since stderr is now a reseource that
can only be claimed once.
* Work around a bug hit by poll-list, fix a bug in poll-one.
* Comment out `test_fd_readwrite_invalid_fd`, which panics now.
* Fix a few FIXMEs.
* Use `.as_ref().trapping_unwrap()` instead of `TrappingUnwrapRef`.
* Use `drop_in_place`.
* Remove `State::with_mut`.
* Remove the `RefCell` around the `State`.
* Update to wit-bindgen 0.12.
* Update wasi-http to use resources for poll and I/O.
This required making incoming-body and outgoing-body resourrces too, to
work with `push_input_stream_child` and `push_output_stream_child`.
* Re-enable disabled tests, remove logging from the worlds.
* Remove the `poll_list` workarounds that are no longer needed.
* Remove logging from the adapter.
That said, there is no replacement yet, so add a FIXME comment.
* Reenable a test that now passes.
* Remove `.descriptors_mut` and use `with_descriptors_mut` instead.
Replace `.descriptors()` and `.descriptors_mut()` with functions
that take closures, which limits their scope, to prevent them from
invalid aliasing.
* Implement dynamic borrow checking for descriptors.
* Add a cargo-vet audit for wasmtime-wmemcheck.
* Update cargo vet for wit-bindgen 0.12.
* Cut down on duplicate sync/async resource types (#1)
* Allow calling `get-directories` more than once (#2)
For now `Clone` the directories into new descriptor slots as needed.
* Start to lift restriction of stdio only once (#3)
* Start to lift restriction of stdio only once
This commit adds new `{Stdin,Stdout}Stream` traits which take over the
job of the stdio streams in `WasiCtxBuilder` and `WasiCtx`. These traits
bake in the ability to create a stream at any time to satisfy the API
of `wasi:cli`. The TTY functionality is folded into them as while I was
at it.
The implementation for stdin is relatively trivial since the stdin
implementation already handles multiple streams reading it. Built-in
impls of the `StdinStream` trait are also provided for helper types in
`preview2::pipe` which resulted in the implementation of
`MemoryInputPipe` being updated to support `Clone` where all clones read
the same original data.
* Get tests building
* Un-ignore now-passing test
* Remove unneeded argument from `WasiCtxBuilder::build`
* Fix tests
* Remove some workarounds
Stdio functions can now be called multiple times.
* If `poll_oneoff` fails part-way through, clean up properly.
Fix the `Drop` implementation for pollables to only drop the pollables
that have been successfully added to the list.
This fixes the poll_oneoff_files failure and removes a FIXME.
---------
Co-authored-by: Alex Crichton <alex@alexcrichton.com>
* winch(x64): Call indirect
This change adds support for the `call_indirect` instruction to Winch.
Libcalls are a pre-requisite for supporting `call_indirect` in order to
lazily initialy funcrefs. This change adds support for libcalls to
Winch by introducing a `BuiltinFunctions` struct similar to Cranelift's
`BuiltinFunctionSignatures` struct.
In general, libcalls are handled like any other function call, with the
only difference that given that not all the information to fulfill the
function call might be known up-front, control is given to the caller
for finalizing the call.
The introduction of function references also involves dealing with
pointer-sized loads and stores, so this change also adds the required
functionality to `FuncEnv` and `MacroAssembler` to be pointer aware,
making it straight forward to derive an `OperandSize` or `WasmType` from
the target's pointer size.
Finally, given the complexity of the call_indirect instrunction, this
change bundles an improvement to the register allocator, allowing it to
track the allocatable vs non-allocatable registers, this is done to
avoid any mistakes when allocating/de-allocating registers that are not
alloctable.
--
prtest:full
* Address review comments
* Fix typos
* Better documentation for `new_unchecked`
* Introduce `max` for `BitSet`
* Make allocatable property `u64`
* winch(calls): Overhaul `FnCall`
This commit simplifies `FnCall`'s interface making its usage more
uniform throughout the compiler. In summary, this change:
* Avoids side effects in the `FnCall::new` constructor, and also makes
it the only constructor.
* Exposes `FnCall::save_live_registers` and
`FnCall::calculate_call_stack_space` to calculate the stack space
consumed by the call and so that the caller can decide which one to
use at callsites depending on their use-case.
* tests: Fix regset tests
* Remove usage of `is-terminal` and `atty` crates
This functionality is now folded into the standard library itself.
* Fix syntax
* Fix a unix/windows cfg
* Move the incoming_handler impl into http_impl
* Remove the incoming handler -- we need to use it as a guest export
* Start adding a test-programs test for the server side of wasi-http
* Progress towards running a server test
* Implement incoming-request-method
* Validate outparam value
* Initial incoming handler test
* Implement more of the incoming api
* Finish the incoming api implementations
* Initial cut at `wasmtime serve`
* fix warning
* wasmtime-cli: invoke ServeCommand, and add enough stuff to the linker to run trivial test
* fix warnings
* fix warnings
* argument parsing: allow --addr to specify sockaddr
* rustfmt
* sync wit definitions between wasmtime-wasi and wasmtime-wasi-http
* cargo vet: add an import config and wildcard audit for wasmtime-wmemcheck
* cargo vet: audit signal-hook-registry
* Remove duplicate add_to_linker calls for preview2 interfaces
prtest:full
* Add a method to finish outgoing responses
Co-authored-by: Adam Foltzer <acfoltzer@fastly.com>
Co-authored-by: Pat Hickey <phickey@fastly.com>
* Mark the result of the incoming_{request,response}_consume methods as own
* Explicit versions for http-body and http-body-util
* Explicit `serve` feature for the `wasmtime serve` command
* Move the spawn outside of the future returned by `ProxyHandler::call`
* Review feedback
---------
Co-authored-by: Trevor Elliott <telliott@fastly.com>
Co-authored-by: Adam Foltzer <acfoltzer@fastly.com>