Commit Graph

6452 Commits

Author SHA1 Message Date
Nick Fitzgerald
7d350c673c Merge pull request #1778 from alexcrichton/disable-peepmatic-macro-tests
Disable tests for the peepmatic-macro crate
2020-05-28 08:46:12 -07:00
whitequark
880e692fd4 x86: add encoding for bnot.b1.
Fixes #1743.

Co-authored-by: iximeow <git@iximeow.net>
2020-05-28 08:43:25 -07:00
Andrew Brown
b017844bef Fix interpreter semantics of 'irsub_imm'
Previously it used `arg - imm` but the functionality should be a wrapping `imm - arg` (see `cranelift/codegen/meta/src/shared/instructions.rs`).
2020-05-28 16:28:27 +02:00
Alex Crichton
caada922e8 Disable tests for the peepmatic-macro crate
I'm not actually sure that it's possible to write `#[test]` in a
`proc-macro` crate. Regardless I don't think it's too too conventional,
so let's disable this for now.

Closes #1775
2020-05-28 07:07:32 -07:00
teapotd
fbac2e53f9 Make vconst BxN match specification 2020-05-27 09:37:13 -07:00
Andrew Brown
628a9f0eaa Print more detailed test run failures (#1764) 2020-05-27 09:04:46 -05:00
Andrew Brown
4e016afca3 Add trace-level logging to interpreter 2020-05-26 18:45:25 +02:00
Andrew Brown
ca0c24e346 Avoid recursion in Interpreter::block 2020-05-26 18:45:25 +02:00
Chris Fallin
6ead7527af Merge pull request #1748 from akirilov-arm/simd_store
Enable the wast::Cranelift::spec::simd::simd_store test for AArch64
2020-05-26 09:21:36 -07:00
Dan Gohman
3715e19c67 Reactor support. (#1565)
* Reactor support.

This implements the new WASI ABI described here:

https://github.com/WebAssembly/WASI/blob/master/design/application-abi.md

It adds APIs to `Instance` and `Linker` with support for running
WASI programs, and also simplifies the process of instantiating
WASI API modules.

This currently only includes Rust API support.

* Add comments and fix a typo in a comment.

* Fix a rustdoc warning.

* Tidy an unneeded `mut`.

* Factor out instance initialization with `NewInstance`.

This also separates instantiation from initialization in a manner
similar to https://github.com/bytecodealliance/lucet/pull/506.

* Update fuzzing oracles for the API changes.

* Remove `wasi_linker` and clarify that Commands/Reactors aren't connected to WASI.

* Move Command/Reactor semantics into the Linker.

* C API support.

* Fix fuzzer build.

* Update usage syntax from "::" to "=".

* Remove `NewInstance` and `start()`.

* Elaborate on Commands and Reactors and add a spec link.

* Add more comments.

* Fix wat syntax.

* Fix wat.

* Use the `Debug` formatter to format an anyhow::Error.

* Fix wat.
2020-05-26 10:39:40 -05:00
Ömer Sinan Ağacan
c619136752 Remove Eq bound of ReservedValue trait
A full Eq implementation is no needed for ReservedValue, as we only need
to check whether a value is the reserved one. For entities (defined with
`entity_impl!`) this doesn't make much difference, but for more
complicated types this avoids generating redundant `Eq`s.
2020-05-26 10:27:55 +02:00
bjorn3
eeb1e141ba Add some assertions to cranelift_frontend 2020-05-26 10:17:08 +02:00
Andrew Brown
6e7276e48d Replace single use of Frame::with_parameters with Frame::set_all 2020-05-26 09:56:58 +02:00
Andrew Brown
d73cb48c29 Add logging to frame operations 2020-05-26 09:56:58 +02:00
Andrew Brown
c92917de15 Fix typo in sadd_sat instruction definition 2020-05-26 09:55:26 +02:00
teapotd
9e70a64728 Legalize sret call arguments 2020-05-25 20:03:24 +02:00
teapotd
b18846057f Add system_v legalizer tests for i128 args 2020-05-25 20:03:24 +02:00
teapotd
6465003899 Run popcnt.i128 legalization test on x86_64 2020-05-25 20:03:24 +02:00
teapotd
0f55bb4b8d Always check if struct-return parameter is needed 2020-05-25 20:03:24 +02:00
Anton Kirilov
8a928830ac Enable the wast::Cranelift::spec::simd::simd_store test for AArch64
Copyright (c) 2020, Arm Limited.
2020-05-24 22:53:07 +01:00
Chris Fallin
51f9ac2150 Merge pull request #1741 from cfallin/filetest-vcode-compile
Merge `vcode` filetest mode into `compile`.
2020-05-22 18:57:21 -07:00
Chris Fallin
48573b52b2 Merge vcode filetest mode into compile.
I hadn't realized before that the filetest backend for `test vcode` is
doing essentially what `compile` is doing, but for new (`MachInst`)
backends: it is just getting a disassembly and running it through
filecheck. There's no reason not to reuse `test compile` for the AArch64
tests as well.

This was motivated by the desire to have "this IR compiles successfully"
tests work on both x86 and AArch64. It seems this should work fine by
adding multiple `target` directives when a test case should be
compile-tested on multiple architectures.
2020-05-22 17:28:48 -07:00
Chris Fallin
73537e72c0 Merge pull request #1732 from jgouly/copysign-fpu
arm64: Use FPU instrctions for Fcopysign
2020-05-22 17:25:33 -07:00
Peter Huene
f36539130b Merge pull request #1734 from peterhuene/fix-saved-fprs
Cranelift: Fix FPR saving and shadow space allocation for Windows x64.
2020-05-22 12:06:37 -07:00
Pat Hickey
d57fea20ca Merge pull request #1717 from bytecodealliance/pch/wiggle_auto_borrow_checking
Automate borrow checking in wiggle
2020-05-22 09:35:12 -07:00
Nick Fitzgerald
193f9c9e15 Merge pull request #1746 from whitequark/i64-divrem-libcalls
cranelift: add i64.[us]{div,rem} libcalls
2020-05-22 08:50:12 -07:00
whitequark
b2e8ed4dc9 cranelift: add i64.[us]{div,rem} libcalls.
These libcalls are useful for 32-bit platforms.
2020-05-22 11:41:56 +00:00
Peter Huene
ce5f3e153b Only update XMM save unwind operation offsets when using a FP.
This commit prevents updating the XMM save unwind operation offsets when a
frame pointer is not used, even though currently Cranelift always uses a
frame pointer.

This will prevent incorrect unwind information in the future when we start
omitting frame pointers.
2020-05-21 16:46:30 -07:00
Peter Huene
54f9cd255f Re-enable tests that were excluded due to the previous limitation. 2020-05-21 15:57:15 -07:00
Peter Huene
2cd5ed1880 Address code review feedback. 2020-05-21 15:57:11 -07:00
Pat Hickey
bc1f538385 wiggle: fix tests 2020-05-21 15:47:48 -07:00
Pat Hickey
561f9e084a wig: bugfixes (sorry, thought i had tested before committimg) 2020-05-21 14:21:47 -07:00
whitequark
26ee986c2f runtime: handle traps on Windows x32. (#1740) 2020-05-21 15:07:05 -05:00
Alex Crichton
036c8ec8c5 Fix assertion about length/capacity in C API (#1736)
I recently saw some [errors] crop up in wasmtime-go's CI, so let's be
sure to convert to `Box<[T]>` which guarantees the length/capacity of
the vector are equal.

[errors]: https://github.com/bytecodealliance/wasmtime-go/runs/694744570
2020-05-21 15:06:30 -05:00
Pat Hickey
d19a09a4be wig: wiggle now puts BorrowChecker inside GuestMemory 2020-05-21 12:40:39 -07:00
Pat Hickey
9f763375de error name change fixup 2020-05-21 12:38:06 -07:00
Pat Hickey
96d6884d33 wiggle: get BorrowChecker from GuestMemory method 2020-05-21 12:37:14 -07:00
Pat Hickey
3920d8c1f3 code review fix 2020-05-21 12:22:47 -07:00
Pat Hickey
ba82ddcf37 borrow out of handles: change error name and describe behavior in comment 2020-05-21 12:22:19 -07:00
whitequark
e5635f4bc9 winx: do not link directly to ntdll.dll. (#1739)
The documentation for RtlNtStatusToDosError explicitly tells to call
it via GetProcAddress. The documentation for NtQueryInformationFile
does not, but similar considerations apply because there is normally
no import library for ntdll.

The main reason to use GetProcAddress though is because MinGW does
include an import library for ntdll, this import library contains
a definition of setjmp, and because of the way rustc orders linker
arguments, this definition of setjmp conflicts with and gets picked
over the one in msvcrt. Using setjmp from ntdll is undesirable as it
is an undocumented API and it is missing from wine, making it harder
to develop wasmtime using a cross-compiler.

Fixes #1738.
2020-05-21 13:56:20 -05:00
Joey Gouly
02c3f238f8 arm64: Use FPU instrctions for Fcopysign
Copyright (c) 2020, Arm Limited.
2020-05-21 18:14:12 +01:00
Alex Crichton
68f0d2f6d0 Enable env_logger in the C API (#1737)
This commit ensures that `env_logger` and `RUST_LOG` are configured to
work with the C API.
2020-05-21 11:02:49 -05:00
Peter Huene
78c3091e84 Fix FPR saving and shadow space allocation for Windows x64.
This commit fixes both how FPR callee-saved registers are saved and how the
shadow space allocation occurs when laying out the stack for Windows x64
calling convention.

Importantly, this commit removes the compiler limitation of stack size for
Windows x64 that was imposed because FPR saves previously couldn't always be
represented in the unwind information.

The FPR saves are now performed without using stack slots, much like how the
callee-saved GPRs are saved. The total CSR space is given to `layout_stack` so
that it is included in the frame size and to offset the layout of spills and
explicit slots.

The FPR saves are now done via an RSP offset (post adjustment) and they always
follow the GPR saves on the stack. A simpler calculation can now be made to
determine the proper offsets of the FPR saves for representing the unwind
information.

Additionally, the shadow space is no longer treated as an incoming argument,
but an explicit stack slot that gets laid out at the lowest address possible in
the local frame. This prevents `layout_stack` from putting a spill or explicit
slot in this reserved space. In the future, `layout_stack` should take
advantage of the *caller-provided* shadow space for spills, but this commit does
not attempt to address that.

The shadow space is now omitted from the local frame for leaf functions.

Fixes #1728.
Fixes #1587.
Fixes #1475.
2020-05-20 15:37:30 -07:00
Chris Fallin
c9e3b71c39 Merge pull request #1729 from cfallin/machinst-branch-opt
Fix MachBuffer branch optimization.
2020-05-20 14:43:57 -07:00
Chris Fallin
13e12908a6 MachBuffer branch opts: comments approximating a semi-formal correctness proof. 2020-05-20 14:12:19 -07:00
Pat Hickey
37514b730f wig: alex has convinced me that this BorrowChecker creation is correct 2020-05-20 12:51:28 -07:00
Pat Hickey
b130a64d19 wasi-common fixes 2020-05-20 12:51:28 -07:00
Pat Hickey
04fb4acc6a wasi-common: WIP translating to use automated borrow checking 2020-05-20 12:51:28 -07:00
Pat Hickey
3643f2d164 wig: create a BorrowChecker just to get things compiling. Needs fixing. 2020-05-20 12:51:28 -07:00
Pat Hickey
056a7d0729 wiggle: redo docs for auto borrow checking 2020-05-20 12:51:28 -07:00