* pulley: add `push` and `pop` instructions
Add `xpush{32, 64}` and `xpop{32, 64}` for pushing/popping XRegs from the stack,
and `push_frame`/`pop_frame` for saving/restoring LR and FP in function
prologue/epilogue.
Copyright (c) 2024, Arm Limited.
Signed-off-by: Karl Meakin <karl.meakin@arm.com>
* cranelift-bitset: more impls for `ScalarBitset`
Implement `Arbitrary` for `ScalarBitset`.
Also implement `DoubleEndedIterator` and `ExactSizeIterator` for `Iter`.
The `pop_min` method was added to help implement `DoubleEndedIterator`,
and `pop` was renamed to `pop_max` for consistency.
Copyright (c) 2024, Arm Limited.
Signed-off-by: Karl Meakin <karl.meakin@arm.com>
* pulley: add instructions for pushing/popping list of registers
Add `xpush{32,64}_many` and `xpop{32,64}_many` for pushing/popping any
combination of all 32 XRegs.
Copyright (c) 2024, Arm Limited.
Signed-off-by: Karl Meakin <karl.meakin@arm.com>
---------
Signed-off-by: Karl Meakin <karl.meakin@arm.com>
* pulley: use enums for `{X,F,V}Reg`
Copyright (c) 2024, Arm Limited.
Signed-off-by: Karl Meakin <karl.meakin@arm.com>
* pulley: add `BinaryOperands`
Copyright (c) 2024, Arm Limited.
Signed-off-by: Karl Meakin <karl.meakin@arm.com>
* pulley: use `BinaryOperands` for binary operators
Copyright (c) 2024, Arm Limited.
Signed-off-by: Karl Meakin <karl.meakin@arm.com>
---------
Signed-off-by: Karl Meakin <karl.meakin@arm.com>
* Pulley: Add memory access instructions with 64-bit offsets
I had trimmed these instructions from the original upstreaming of the Pulley
interpreter because I had mistakenly believed that they were unused. Turns out
they are needed for Cranelift's Pulley backend to allow for lowering certain
address modes to a single instruction. The alternative, lowering the address
modes to a sequence of instructions, would be a bit annoying and these
instructions seem generally useful.
* rebase on top of indexing changes for `MachineState`
Right now this is only on some crates such as `wasmtime` itself and
`wasmtime-cli`, but by applying it to all crates it helps with version
selection of those using just Cranelift for example.
This fixes a crash where the `GetSp` opcode was overwriting a special
register, so apply a similar filter as to other instructions to ensure
that the special registers are not clobbered.
* Introduce the `pulley-interpreter` crate
This commit is the first step towards implementing
https://github.com/bytecodealliance/rfcs/pull/35
This commit introduces the `pulley-interpreter` crate which contains the Pulley
bytecode definition, encoder, decoder, disassembler, and interpreter.
This is still very much a work in progress! It is expected that we will tweak
encodings and bytecode definitions, that we will overhaul the interpreter (to,
for example, optionally support the unstable Rust `explicit_tail_calls`
feature), and otherwise make large changes. This is just a starting point to get
the ball rolling.
Subsequent commits and pull requests will do things like add the Cranelift
backend to produce Pulley bytecode from Wasm as well as the runtime integration
to run the Pulley interpreter inside Wasmtime.
* remove stray fn main
* Add small tests for special x registers
* Remove now-unused import
* always generate 0 pc rel offsets in arbitrary
* Add doc_auto_cfg feature for docs.rs
* enable all optional features for docs.rs
* Consolidate `BytecodeStream::{advance,get1,get2,...}` into `BytecodeStream::read`
* fix fuzz targets build
* inherit workspace lints in pulley's fuzz crate
* Merge fuzz targets into one target; fix a couple small fuzz bugs
* Add Pulley to our cargo vet config
* Add pulley as a crate to publish
* Move Pulley fuzz target into top level fuzz directory