Commit Graph

5659 Commits

Author SHA1 Message Date
Till Schneidereit
8f824a9fc1 Update outdated references to the Cranelift repository
This patch updates or removes all references to the Cranelift repository. It affects links in README documents, issues that were transferred to the Wasmtime repository, CI badges, and a small bunch of sundry items.
2020-03-09 14:06:24 +01:00
Yury Delendik
7ce10191df Add lldb smoke test (#1241)
* add lldb runner

* don't build wasmtime

* use brew's lldb

* disable for macos

* set LLDB on linux

* re-org gh actions and cfg

* address feedback
2020-03-09 08:06:13 -05:00
Jakub Konka
e5b9f1b786 [wasi-common]: winx now returns io::Error directly (#1243)
* Winx now returns io::Error

This commit is a spiritual follower of #1242 in the sense that it
adjusts `winx` to also return `io::Error` directly rather than
tossing a custom error type here and there.

* Adapt wasi-common to changes in winx

* Run cargo fmt

* Swap overly big map_err with explicit match
2020-03-09 10:32:01 +01:00
Dan Gohman
fbe29da5cc Miscelaneous docs updates and fixes. (#1249)
Update references to things in CraneStation which have moved, WASI documentation
which has moved to the WASI repo, and fix a few typos.
2020-03-08 16:11:17 +01:00
Till Schneidereit
0afa334f3e Update issue templates
- Include the `cranelift` label for Cranelift bug reports
- Add a Wasmtime bug report template
2020-03-08 00:19:22 +01:00
Alex Pyrgiotis
07212780d3 CI: Use an HTTPS download link for LLVM (#1254) 2020-03-07 12:16:50 +01:00
Andrew Brown
4284491339 Translate Wasm swizzle to Cranelift swizzle 2020-03-06 15:49:53 -08:00
Andrew Brown
fa7481a681 Add x86 implementation of SIMD swizzle instruction 2020-03-06 15:49:53 -08:00
Andrew Brown
4a0f53464a Remove '%test_' prefix from SIMD filetests 2020-03-06 14:57:11 -08:00
Andrew Brown
d19f727850 Refactor SIMD filetests to use a common naming convention
All filetests now should look like `simd-[instruction category]-[test type]`, where `[test type]` is something like `run` or `binemit`.
2020-03-06 14:57:11 -08:00
Andrew Brown
442edf5c84 Refactor SIMD legalizations to separate define* function
See https://github.com/bytecodealliance/wasmtime/issues/1168
2020-03-06 14:57:11 -08:00
Andrew Brown
6e0401b83a Refactor SIMD lane instructions to separate define* function 2020-03-06 14:57:11 -08:00
Jakub Konka
42fae4e3b8 [wasi-common]: yanix now returns io::Error directly (#1242)
* Yanix now returns io::Error

This commit may seem somewhat controversial at first, but hear me
out first. Currently, Yanix would return a custom error that's a
wrapper around three other error types returned by various entities
inside Rust's `libstd`. In particular, Yanix's error type would wrap
`io::Error`, `num::TryFromIntError` and `ffi::NulError`. It turns
out that there is a natural conversion between the first and the last
and provided by the standard library, i.e., `From<ffi::NulError> for io::Error`
is provided. So at the surface it may seem that only the first two
wrapped error types are worth keeping.

Digging a little bit deeper into `libstd`, `num::TryFromIntError`
is essentially speaking only a marker that the integral conversion
went wrong. The struct implementing this error stores a unit type,
and nothing more. It therefore seems like a waste to wrap this
particular error when we could unify everything under `io::Error`.
And so, whenever we perform an int conversion, I suggest we simply
remap the error to `io::Error::from_raw_os_error(libc::EOVERFLOW)`
since this carries a comparable amount of information.

As a result of completely discarding `yanix::Error` custom error type,
we are invariably simplifying `yanix` itself, but also allowing
`wasi-common` to simplify in several places as well.

* Adapt wasi-common to changes in yanix

* Add Cargo.lock

* Unwrap try_into's where possible

* Remove unnecessary type annotation
2020-03-06 14:20:54 -08:00
Andrew Brown
55337abd3f Move filetest misplaced during repo merge 2020-03-06 12:40:27 -08:00
Alex Crichton
7e09c4c94f Fill out CI docs in the contributing section of the book (#1239)
* Fill out CI docs in the contributing section of the book

Figured it'd be good to document at least at a high level what in the
world is happening on all our PR runs.

* Tweak fuzz test comments
2020-03-06 13:13:52 -06:00
iximeow
7e0d9decbf Virtual file support (#701)
* Add support for virtual files (eg, not backed by an OS file).

Virtual files are implemented through trait objects, with a default
implementation that tries to behave like on-disk files, but entirely
backed by in-memory structures.

Co-authored-by: Dan Gohman <sunfish@mozilla.com>
2020-03-06 11:08:13 -08:00
Andrew Brown
7f7196a655 Add i64x2 integer multiplication using AVX512DQ 2020-03-06 10:53:22 -08:00
Andrew Brown
7d5075a649 Rename RexRecipeKind to RecipePrefixKind 2020-03-06 10:53:22 -08:00
Andrew Brown
2216f90916 Add an EVEX recipe (and associated recipe infrastructure) for encoding a binary operation 2020-03-06 10:53:22 -08:00
Andrew Brown
965714d675 Add encoding functions for emitting EVEX formats
Only the `reg, vvvv, rm` form is currently supported but it should not be difficult to add more forms.
2020-03-06 10:53:22 -08:00
Andrew Brown
079fcafcb1 Expand x86 registers to include 32 XMM registers
The EVEX encoding format (e.g. in AVX-512) allows addressing 32 registers instead of 16. The FPR register class currently defines 16 registers, `%xmm0`-`%xmm15`; that class is kept as-is with this change. A larger class, FPR32, is added as a super-class of FPR using a larger bank of registers, `%xmm0`-`%xmm31`.
2020-03-06 10:53:22 -08:00
Andrew Brown
1d15054310 Remove the debug crate's hard-coded dependency on register ordering 2020-03-06 10:53:22 -08:00
Andrew Brown
3f53bcb740 Remove dependency on hard-coded ordering of x86 register banks
With this change, register banks can now be re-ordered and other components (e.g. unwinding, regalloc) will no longer break. The previous behavior assumed that GPR registers always started at `RegUnit` 0.
2020-03-06 10:53:22 -08:00
Andrew Brown
518c7526d2 Fix incorrect register calculation in RegBank::unit_by_name 2020-03-06 10:53:22 -08:00
Andrew Brown
2c41648471 Wire up AVX-related settings with runtime detection in cranelift-native 2020-03-06 10:53:22 -08:00
Andrew Brown
baf71f5a5f Add AVX-related settings
Many more settings are possible but this subset is required in order to distinguish instructions that can use EVEX encodings.
2020-03-06 10:53:22 -08:00
Pat Hickey
e47de6f605 Merge pull request #1214 from froydnj/trap-exposure
cranelift-module: expose trap information when defining functions
2020-03-05 14:17:19 -08:00
Alex Crichton
3179dcf6f1 Update Cranelift's documentation after the merger. (#1238)
Update the documentation for the merger, and also for various changes in
Cranelift. Remove some old obsolete documentation, and convert the remaining
Sphinx files to Markdown. Some of the remaining content is still out of
date, but this is a step forward.
2020-03-05 15:51:12 -06:00
Nick Fitzgerald
fc692f6d36 Merge pull request #1235 from fitzgen/ci-fuzz-corpora-backtraces
CI: Run fuzzer corpora with `RUST_BACKTRACE=1`
2020-03-05 11:21:09 -08:00
Alex Crichton
85fab0ab56 Expand Func documentation, rewrite Rust embed docs (#1236)
This commit expands the documentation of the `Func` type as well as
updating the Rust embedding tutorial with more recent APIs. I wanted to
also leave space in the Rust tutorial to get more ambitious over time
with what it's documenting, but I stopped around here, curious to see
what others think about it!
2020-03-05 12:54:42 -06:00
Nick Fitzgerald
ab317bc0dd CI: Run fuzzer corpora with RUST_BACKTRACE=1
This way if we get regression panics -- like in
https://github.com/bytecodealliance/wasmtime/pull/1192 -- then we actually have
some hope of debugging them properly.
2020-03-05 10:00:48 -08:00
Yury Delendik
6f88fd9af1 Disable/ignore debug_dwarf tests in "cargo test" (#1233) 2020-03-05 11:53:39 -06:00
Nathan Froyd
2bb3096342 change interfaces to use slices instead of Vec 2020-03-05 10:19:01 -05:00
Ryan Hunt
4aa8776a9b Skip non-branching blocks now that we're using basic blocks
This is a rebase of [1]. In the long term, we'll want to simplify these
analysis passes. For now, this is simple and will reduce the number of
instructions processed in certain cases.

[1] https://github.com/bytecodealliance/cranelift/pull/866
2020-03-05 16:11:13 +01:00
Jakub Konka
135a48ca7e wasi-common error cleanup: part 1, yanix (#1226)
* Reuse std::io::Error for raw *nix errno

This commit removes custom `yanix::Errno` and instead (as was
previously suggested) reuses `std::io::Error` to generate and wrap
raw *nix errno value.

* Update wasi-common to use new Yanix error type

This commit updates `wasi-common` to use new way of handling raw
OS error in `yanix`; i.e., via re-use of `std::io::Error` instead
of a custom `Errno` enum.

* Fix formatting

* Unwrap if io::Error created from raw OS error

This commit calls `unwrap` on `err` if that one was created via
`io::Error::last_os_error()`. It also refactors error matching
in several syscalls on the BSD platform (mainly).
2020-03-05 10:08:28 +01:00
Alex Crichton
19d8ff2bf5 Remove reader_parse_test/translate_module fuzz targets (#1212)
This commit removes the two fuzz targets that we imported from cranelift
when cranelift merged in. These have both uncovered a few issues in the
fuzz targets themselves, for example:

* `translate_module` - this doesn't verify the wasm is valid a head of
  time and cranelift is known to panic on translating invalid wasm
  modules. We also already do a lot of fuzzing of translation of wasm
  modules, so this isn't necessarily buying us anything over what we're
  already fuzzing.

* `reader_parse_test` - discovered in #1205 we already found some "bugs"
  in this but it may not necessarily rise to the level of "needs to be
  run on oss-fuzz for us to find more bugs" yet. It looks like this is
  still somewhat internal so we can re-enable when we've got folks to
  fix the fuzz bugs coming in.

Closes #1205
2020-03-04 13:54:11 -06:00
Yury Delendik
d5c0f6bff8 Fix infinite loop in DWARF address transform algorithm (#1228) 2020-03-04 13:31:14 -06:00
Maciej Woś
8acfdbdd8a add more wrappers and getters (#1222) 2020-03-03 22:58:11 -06:00
Peter Huene
1a15cec63b Merge pull request #1217 from eqrion/kill-ebb/typos
Rename 'an block' to 'a block'
2020-03-03 11:59:59 -08:00
Ryan Hunt
07f335dca6 Rename 'an block' to 'a block'
Missed this in the automatic rename of 'Ebb' to 'Block'.
2020-03-03 13:21:13 -06:00
Nathan Froyd
0f49a830c9 cranelift-module: expose trap information when defining functions
The current interface of `cranelift-module` requires consumers who want
to be informed about traps to discover that information through
`Module::Product`, which is backend-specific.  Since it's advantageous
to manipulate this information in a backend-agnostic way, this patch
changes `Module::define_function{,_bytes}` to return information about
the traps contained in the function being defined.
2020-03-03 11:37:15 -05:00
Alex Crichton
77e17d8f71 Add a wasmtime-specific wasmtime_wat2wasm C API (#1206)
* Add a wasmtime-specific `wasmtime_wat2wasm` C API

This commit implements a wasmtime-specific C API for converting the text
format to the binary format. An upstream spec issue exists for adding
this to the C API, but in the meantime we can experiment with our own
version of this API and use it in the C# extension, for example!

Closes #1000

* Reorder arguments

* Use wasm_byte_vec_t for input `*.wat`

* Mark wat input as const

* Return an error message and use `fixed`

* Actually include the error message

* Use `fixed` in `Module.cs` as well
2020-03-03 10:29:20 -06:00
Yury Delendik
732c646bec Add wasmtime.h and wasi.h to package (#1211) 2020-03-03 09:21:33 -06:00
Alex Crichton
f7c2a58d23 Disable caches in CLI tests (#1204)
Avoids creating extraneous directories while testing in your home
directory.

Closes #1197
2020-03-02 11:43:47 -06:00
Alex Crichton
fe9debfed3 Update WASI submodule to update transitive wast crate (#1207)
One less version to build!
2020-03-02 11:34:04 -06:00
Darin Morrison
d68437e1e6 Update SIMD tests to use hex literals 2020-03-02 08:28:59 -08:00
Darin Morrison
c459579396 Add tests for hex parsing 2020-03-02 08:28:59 -08:00
Darin Morrison
2300eec8a5 Implement hex parsing for imm16 and imm32 2020-03-02 08:28:59 -08:00
Takanori Ishibashi
3848bf54f7 Fix link (#1203) 2020-03-02 08:57:28 -06:00
Alex Crichton
8597930eed rename PassiveElemIndex to ElemIndex and same for PassiveDataIndex (#1188)
* rename PassiveElemIndex to ElemIndex and same for PassiveDataIndex (#1411)

* rename PassiveDataIndex to DataIndex

* rename PassiveElemIndex to ElemIndex

* Apply renamings to wasmtime as well

* Run rustfmt

Co-authored-by: csmoe <csmoe@msn.com>
2020-03-02 08:55:25 -06:00