Skip to content
This repository was archived by the owner on Aug 31, 2023. It is now read-only.

Merge with upstream#22

Merged
dhil merged 10 commits intoeffect-handlers:function-referencesfrom
alexcrichton:function-references
May 25, 2023
Merged

Merge with upstream#22
dhil merged 10 commits intoeffect-handlers:function-referencesfrom
alexcrichton:function-references

Conversation

@alexcrichton
Copy link
Copy Markdown

This is notably handling merge conflicts with bytecodealliance#6443

saulecabrera and others added 10 commits May 23, 2023 13:32
* winch(fuzz): Refactor Winch's fuzzing

This change is a follow-up to the discussion in
bytecodealliance#6281.

The most notable characteristic of this change is that it enables
`winch` by default in the fuzzers. If compilation time is a big enough
concern I can add the cargo feature back. I opted to enable `winch` by
default for several reasons:

* It substantially reduces the `cfg` complexity -- at first I thought
  I had covered all the places in which a `cfg` check would be needed,
  but then I realized that I missed the Cranelift specific compiler
  flags.

* It's the fastest route to enable winch by default in the fuzzers,
  which we want to do eventually -- the only change we'd need at that
  point would be to get rid of the winch-specific environment variable.

* We can get rid of the winch-specific checks in CI for fuzzing

* Implement Arbitraty for CompilerStrategy

Unconditionally return `Cranelift` for the `Arbitrary` implementation of
`CompilerStrategy`. This ensures that `Cranelift` is used as the
compiler for all the targets unless explicitly requested otherwise. As
of this change, only the differential target overrides the
`CompilerStrategy`
…liance#6430)

* riscv64: Implement SIMD `{u,s}{add,sub}_sat`

* riscv64: Implement SIMD `{u,s}{min,max}`
* refactor(wasi): impl `Debug` on `Table`

Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>

* feat(preview1): instrument calls

Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>

* feat(preview1): implement core I/O functionality

prtest:full

Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>

---------

Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
This commit is a small cleanup to drop the usage of the `FuncEnv` trait.

In bytecodealliance#6358, we agreed on
making `winch-codegen` directly depend on `wasmtime-environ`.

Introducing a direct relatioship between `winch-codegen` and
`wasmtime-environ` means that the `FuncEnv` trait is no longer serving
its original purpose, and we can drop the usage of the trait and use the
types exposed from `winch-codegen` directly instead.

Even though this change drops the `FuncEnv` trait, it still keeps
a `FuncEnv` struct, which is used during code generation.
…e#6416)

* x64: Add memory operand support to EVEX instructions

Currently load-sinking is enabled for EVEX instructions (aka AVX512
instructions) but the encoding of these instructions is a `todo!()`
which can cause a panic for some wasms if the right features are
enabled. This commit fills out the support for memory operands in the
same manner as VEX-encoded instructions. The main stickler here was that
EVEX instructions always use a scaled 8-bit offset which needed extra
handling to ensure that the correct offset is emitted.

* Pass scaling to `Imm` construction

* Review comments

* Fix tests

* Fix evex benchmark
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
@alexcrichton alexcrichton force-pushed the function-references branch from 98320f5 to 0adcec6 Compare May 25, 2023 15:24
@dhil dhil merged commit 36e9f7e into effect-handlers:function-references May 25, 2023
@dhil
Copy link
Copy Markdown

dhil commented May 25, 2023

Thanks!

dhil pushed a commit that referenced this pull request May 29, 2023
* import `wasi-common` from `wasmtime` 8bbd9bb

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

* adapt `wasi-common` for use in host implementation

Per recent discussion with Dan and Pat, this begins the work of adapting
`wasi-common` for use in the Preview 2 host implementation.  It removes the
`wiggle` dependency and the rights system, and adds a few structs and fields
specific to Preview 2.  Further changes will follow as we implement more
features.

The intention is that this version of `wasi-common` will be merged back into
`wasmtime` and be used there for both the Preview 1 and Preview 2 WASI host
implementations.  In addition, we would like it to remain runtime-agnostic
(i.e. not depend on `wasmtime` directly or indirectly) so it can be reused by
other runtimes, which was the original intention behind `wasi-common`.
Currently, this requires a manually-written conversion from `wasi_common::Errno`
to `wit_bindgen_host_wasmtime_rust::Errno`; there might be a way to automate
that conversion as part of code generation later on.

This also enables `async` code generation, since most of the `wasi-common`
methods are `async` (though none of them currently `await` anywhere, and many
block).  The intention is that only `wasi-poll::poll-oneoff` will actually
`await`, and we'll replace the current schedulers in `wasi-common` with
something based on e.g. `tokio`.

Other minor changes:

- `wasi-clocks::wall-clock-resolution` now returns an `instant` instead of a
  `datetime` (I presume the latter was a mistake).
- The structs in `host::clocks` have been moved to `wasi-common::clocks`.
- `host::WasiCtx` has been replaced by `wasi-common::WasiCtx`.

Finally, this implements `wasi-filesystem::pread` and `wasi-filesystem::pwrite`
using `wasi-common::WasiFile`.  Implementing the rest of the interface should be
straightforward.

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

* add "publish = false" to wasi-common/Cargo.toml

This ensures that we don't accidentally overwrite the `wasmtime` version.

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

* switch `wall-clock-resolution` return type back to `datetime`

I had mistakenly changed this to `instant`, believing `datetime` was an
unintended mistake, but Dan explained that it was intentional.

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

Signed-off-by: Joel Dice <joel.dice@fermyon.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants