Commit Graph

6634 Commits

Author SHA1 Message Date
Yury Delendik
bef1b87be0 Write ELF image and instantiate code_memory from it (#1931)
- Create the ELF image from Compilation
- Create CodeMemory from the ELF image
- Link using ELF image
- Remove creation of GDB JIT images from crates/debug
- Move make_trampoline from compiler.rs
2020-07-07 12:51:24 -05:00
Gabor Greif
79f054f77f Correct the files' directory index when downgrading DWARF5 -> 4 (#1989)
* correct the files' directory index when downgrading DWARF5 -> 4
2020-07-07 11:20:32 -05:00
Yury Delendik
9900641674 Support reference types in the DWARF transform (#1986) 2020-07-07 09:43:03 -05:00
Nick Fitzgerald
70cef0a433 fuzzing: Enforce a maximum input length for peepmatic_compile target (#1985)
This avoids timeouts from large inputs, like
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=23906
2020-07-07 09:03:14 -05:00
Peter Huene
d6ae72abe6 Merge pull request #1983 from peterhuene/fix-unwind-info
Remove 'set frame pointer' unwind code from Windows x64 unwind.
2020-07-06 22:26:41 -07:00
Peter Huene
92864baa1f Fix module doc comment. 2020-07-06 19:02:52 -07:00
Peter Huene
b1c7c1401e Fix incorrect scaling for SaveXmm128Far.
The `SaveXmm128Far` unwind op should have a 32-bit unscaled value.

The value was accidentally scaled down by 16 while calculating whether or not
the `SaveXmm128` or `SaveXmm128Far` unwind op should be used.
2020-07-06 18:52:16 -07:00
Nick Fitzgerald
62530e4d23 Merge pull request #1975 from MaxGraey/more-peephole-opts
peepmatic: add reminder by a power of two rule
2020-07-06 16:32:16 -07:00
MaxGraey
305659427d changes according review 2020-07-07 01:55:18 +03:00
Nick Fitzgerald
22865769cb Merge pull request #1984 from fitzgen/ref-types-in-rust-api
wasmtime: Support reference types in the Rust API
2020-07-06 15:17:35 -07:00
Peter Huene
b391817c0f Add a test case for unwind with saved FPRs on Windows.
This commit adds a simple test case that reproduces the problem in
2020-07-06 14:23:01 -07:00
Peter Huene
3a33749404 Remove 'set frame pointer' unwind code from Windows x64 unwind.
This commit removes the "set frame pointer" unwind code and frame
pointer information from Windows x64 unwind information.

In Windows x64 unwind information, a "frame pointer" is actually the
*base address* of the static part of the local frame and would be at some
negative offset to RSP upon establishing the frame pointer.

Currently Cranelift uses a "traditional" notion of a frame pointer, one
that is the highest address in the local frame (i.e. pointing at the
previous frame pointer on the stack).

Windows x64 unwind doesn't describe such frame pointers and only needs
one described if the frame contains a dynamic stack allocation.

Fixes #1967.
2020-07-06 14:22:57 -07:00
Nick Fitzgerald
a7c6433773 wasmtime: Support reference types in the Rust API
This is a mix of exposing new things (e.g. a `Table::fill` method) and extending
existing support to `externref`s (e.g. `Table::new`).

Part of #929
2020-07-06 14:21:32 -07:00
Dan Gohman
cf5289c553 Begin porting yanix to WASI.
This isn't complete yet, but subsequent steps will depend on Rust libstd
and libc bindings changes that are in flight.
2020-07-06 20:20:28 +02:00
Nick Fitzgerald
25397d0c15 Merge pull request #1982 from fitzgen/fuzz-reference-types
fuzzing: Enable reference types by default
2020-07-06 10:27:09 -07:00
Daiki Ueno
2ce2dd0203 wasmtime: add build-time option for parallel compilation (#1903)
When running in embedded environments, threads creation is sometimes
undesirable. This adds a feature to toggle wasmtime's internal thread
creation for parallel compilation.
2020-07-06 11:22:05 -05:00
Nick Fitzgerald
9b56203732 fuzzing: Enable reference types by default
Part of #929
2020-07-06 09:18:52 -07:00
Nick Fitzgerald
80ff22fd18 Merge pull request #1973 from fitzgen/table-fill
wasmtime: Implement `table.fill`
2020-07-06 09:03:25 -07:00
Graham Scheaffer
ef8fe18262 Updated region versions (#1978) 2020-07-06 09:26:28 -05:00
MaxGraey
2048278d2a typo 2020-07-03 21:45:40 +03:00
Davy Duperron
8d7ba0ad76 wasmtime: fix typo in summary 2020-07-03 14:34:30 +02:00
Benjamin Bouvier
9d5be00de4 Address review comments
- put the division in the synthetic instruction as well,
- put the branch table check in the inst's emission code,
- replace OneWayCondJmp by TrapIf vcode instruction,
- add comments describing code generated by the synthetic instructions
2020-07-03 14:33:52 +02:00
Benjamin Bouvier
2115e70acb machinst x64: implement enough to support branch tables; 2020-07-03 14:33:52 +02:00
Benjamin Bouvier
f86ecdcb86 machinst x64: lower and implement div/idiv; ADD TESTS 2020-07-03 14:33:52 +02:00
Benjamin Bouvier
da30527368 machinst x64: implement one way conditional jmp 2020-07-03 14:33:52 +02:00
Benjamin Bouvier
9d1bcfb2e8 machinst x64: implement cmov 2020-07-03 14:33:52 +02:00
Benjamin Bouvier
bd88065571 machinst x64: lower binary ALU operators; 2020-07-03 14:33:52 +02:00
Benjamin Bouvier
faeed3c7a4 machinst x64: implement spills and reloads 2020-07-03 14:33:52 +02:00
Benjamin Bouvier
08efcbd9d5 machinst x64: use movss for f32 loads; 2020-07-03 11:19:32 +02:00
MaxGraey
d21ca7f2a3 fixed added fits-in-native-word contrain 2020-07-03 11:46:37 +03:00
MaxGraey
03b6c97e15 typo 2020-07-03 11:05:55 +03:00
MaxGraey
1fcb215895 trailing new line 2020-07-03 11:03:03 +03:00
MaxGraey
1033cf5748 use (isub 1 $C) instead (iadd -1 $C) 2020-07-03 11:01:35 +03:00
MaxGraey
d839d83f7e add reminder by a power of two peephole rule 2020-07-03 09:44:59 +03:00
Nick Fitzgerald
3555f97906 wasmtime: Implement table.fill
Part of #929
2020-07-02 16:59:07 -07:00
Nick Fitzgerald
d87ada209c Merge pull request #1972 from bytecodealliance/fitzgen-patch-1
readme: Make "wasmtime-go" use monospace font
2020-07-02 15:20:09 -07:00
Johnnie Birch
60681d7019 Add __dso_handle to exception list of deprecated export symbols
When compiling C to WASM with clang-8, __dso_handle is a global
that maybe exported but that currently is not whitelisted along
with __heap_base and _data_end to be handled as allowable depricated
exports. This PR adds the case for __dso_handle.
2020-07-02 14:58:53 -07:00
Nick Fitzgerald
9162563bb7 readme: Make "wasmtime-go" use monospace font
Similar to other package names.
2020-07-02 14:13:39 -07:00
Chris Fallin
b700646c93 Merge pull request #1962 from cfallin/aarch64-lowering-condbr
AArch64: avoid branches with explicit offsets at lowering stage.
2020-07-02 14:05:40 -07:00
Nick Fitzgerald
bffd54c016 wasmtime: Implement global.{get,set} for externref globals (#1969)
* wasmtime: Implement `global.{get,set}` for externref globals

We use libcalls to implement these -- unlike `table.{get,set}`, for which we
create inline JIT fast paths -- because no known toolchain actually uses
externref globals.

Part of #929

* wasmtime: Enable `{extern,func}ref` globals in the API
2020-07-02 16:04:01 -05:00
Nick Fitzgerald
3fa3ff2ece Merge pull request #1968 from alexcrichton/link-c-docs
Link to C API docs and make a landing page
2020-07-02 13:28:20 -07:00
Chris Fallin
9bc0f3eceb Merge pull request #1966 from jgouly/simd-arith
arm64: Implement basic SIMD arithmetic
2020-07-02 11:07:14 -07:00
Chris Fallin
b7ecad1d74 AArch64: avoid branches with explicit offsets at lowering stage.
In discussions with @bnjbvr, it came up that generating `OneWayCondBr`s
with explicit, hardcoded PC-offsets as part of lowered instruction
sequences is actually unsafe, because the register allocator *might*
insert a spill or reload into the middle of our sequence. We were
careful about this in some cases but somehow missed that it was a
general restriction. Conceptually, all inter-instruction references
should be via labels at the VCode level; explicit offsets are only ever
known at emission time, and resolved by the `MachBuffer`.

To allow for conditional trap checks without modifying the CFG (as seen
by regalloc) during lowering, this PR instead adds a `TrapIf`
pseudo-instruction that conditionally skips a single embedded trap
instruction. It lowers to the same `condbr label ; trap ; label: ...`
sequence, but without the hardcoded branch-target offset in the lowering
code.
2020-07-02 11:02:27 -07:00
Andrew Brown
5ed74abeee Translate Wasm narrow instructions to CLIF's snarrow and unarrow
In order to make it more clear what the incoming types are for this translation (e.g. two `I32X4`s narrow to an `I16X8`), this change explicitly sets the type to which to bitcast (if necessary) the incoming values.
2020-07-02 09:35:45 -07:00
Andrew Brown
057c93b64e Add unarrow instruction with x86 implementation
Adds a shared `unarrow` instruction in order to lower the Wasm SIMD specification's unsigned narrowing (see https://github.com/WebAssembly/simd/blob/master/proposals/simd/SIMD.md#integer-to-integer-narrowing). Additionally, this commit implements the instruction for x86 using PACKUSWB and PACKUSDW for the applicable encodings.
2020-07-02 09:35:45 -07:00
Andrew Brown
65e6de2344 Replace x86_packss with snarrow
Since the Wasm specification contains narrowing instructions (see https://github.com/WebAssembly/simd/blob/master/proposals/simd/SIMD.md#integer-to-integer-narrowing) that lower to PACKSS*, the x86-specific instruction is not necessary in the CLIF IR.
2020-07-02 09:35:45 -07:00
Andrew Brown
152d7fcee7 Fix typo and wording of CDSL error messages 2020-07-02 09:35:45 -07:00
Sergei Shulepov
ce51995828 Use smallvec for avoid allocations in the trampoline (#1965) 2020-07-02 11:24:03 -05:00
Alex Crichton
920e0984d3 Link to C API docs and make a landing page
Spice up the landing page a bit for the C API documentation and then
link to it from a few places to ensure it's discoverable.
2020-07-02 08:49:27 -07:00
Alex Crichton
47a218f908 Document the rest of the C API (#1959)
This commit fills out documentation for all remaining functions in the C
API, and additionally enables "warn if undocumented" which will fail CI
since warnings are also treated as errors.
2020-07-02 09:26:10 -05:00