Commit Graph

520 Commits

Author SHA1 Message Date
Nick Lewycky
2812a3330f Use abi::args_to_call in indirect calls too. 2020-06-02 15:44:39 -07:00
Nick Lewycky
f762690dfb Use abi::args_to_call when placing a direct call. 2020-06-02 15:44:39 -07:00
Nick Lewycky
4f9d8a5012 Initial commit of SysV ABI implementation. 2020-06-02 15:44:39 -07:00
Nick Lewycky
14188bed44 Revert "Ignore multi-value errors on LLVM too, for now."
This reverts commit 486dedc601.
2020-06-02 15:44:39 -07:00
nlewycky
6e98f39568 Remove commented-out debugging cruft.
This was made obsolete by PR #79.
2020-06-02 11:03:36 -07:00
Syrus Akbary
367dff887a Update lib/compiler-llvm/src/config.rs
Co-authored-by: nlewycky <nick@wasmer.io>
2020-06-01 14:12:57 -07:00
Syrus Akbary
1b84525921 Update lib/compiler-llvm/src/trampoline/wasm.rs
Co-authored-by: nlewycky <nick@wasmer.io>
2020-06-01 14:12:50 -07:00
Syrus Akbary
903c1b23be Update lib/compiler-llvm/src/translator/code.rs
Co-authored-by: nlewycky <nick@wasmer.io>
2020-06-01 14:12:44 -07:00
Syrus
18528fc251 Merge branch 'master' into llvm-callbacks 2020-06-01 13:55:36 -07:00
Syrus
2a9ce436f9 Added LLVM callbacks 2020-06-01 13:54:26 -07:00
Nick Lewycky
311b8d8d24 NFC. Borrow a str instead of a String. Pointed out by cargo clippy. 2020-06-01 11:04:13 -07:00
Syrus
abbd39c50b Refactor trampoline compilation 2020-05-29 19:37:03 -07:00
Syrus
28c6462f76 Merge branch 'master' into llvm-dynamic-trampoline 2020-05-29 17:00:57 -07:00
Nick Lewycky
45e80dec7b Add support for dynamic trampolines in compiler-llvm. 2020-05-29 16:56:41 -07:00
Nick Lewycky
d597a97aa1 Annotate atomicrmw and cmpxchg with volatile if needed. 2020-05-28 14:04:19 -07:00
Nick Lewycky
fd37486040 Update to a newer inkwell. 2020-05-28 14:04:19 -07:00
Syrus
17bca3cf8e Use minor versions instead of patch 2020-05-27 17:42:47 -07:00
Nick Lewycky
fd64edf4c8 Return a FunctionCache instead of its members. 2020-05-27 16:28:00 -07:00
Nick Lewycky
fce259befa Cache lookup of memory_grow and memory_size functions. 2020-05-27 14:55:46 -07:00
Nick Lewycky
d88e875e60 Cache function lookups. 2020-05-27 14:55:46 -07:00
Nick Lewycky
74355b0b03 NFC. Move looking up a function in the same wasm module to CtxType.
This is a straight refactor, this doesn't add caching yet.
2020-05-27 14:55:46 -07:00
Nick Lewycky
9eba8f798f Implement all TODOs for TBAA labels. 2020-05-27 12:18:02 -07:00
nlewycky
a46a249b0c Merge pull request #60 from wasmerio/llvm-dupe-type-code
Code cleanup. Remove reimplementation of type_to_llvm_ptr, use the one in intrinsics instead.
2020-05-26 15:49:00 -07:00
nlewycky
f1268a3b28 Merge pull request #59 from wasmerio/llvm-volatile-memaccess
Prevent loads and stores from being deleted.
2020-05-26 15:26:20 -07:00
Nick Lewycky
b035ebada2 Code cleanup. Remove reimplementation of type_to_llvm_ptr, use the one in intrinsics instead. 2020-05-26 15:22:24 -07:00
Nick Lewycky
bd8ffd6a17 Remove dead argument from CtxType::memory. 2020-05-26 14:59:59 -07:00
Nick Lewycky
7a1ac7b843 Don't mark loads and stores volatile when they're bounds checked at runtime. 2020-05-26 14:57:11 -07:00
Nick Lewycky
3d654d2c25 Add function that marks loads/store volatile. Static/dynamic condition is TODO.
Now that we apply three annotations to every user memory access, factor it out into a new function to apply them.

We do this for the load and stores, but not yet the atomicrmw's.
2020-05-26 14:57:11 -07:00
Nick Lewycky
2089c0a163 Support variable memory indices in the TBAA labelling too. 2020-05-26 14:57:11 -07:00
Nick Lewycky
07ec1fc004 Make memory_index a variable, we'll be reusing it soon. 2020-05-26 14:57:11 -07:00
Nick Lewycky
c82fe5fe8f Add a MemoryIndex parameter to resolve_memory_ptr.
It's always zero today, but it won't always be.
2020-05-26 14:57:05 -07:00
Nick Lewycky
8a6f3beef5 memory_plans is a member, we don't need to pass it around. 2020-05-26 11:25:32 -07:00
Nick Lewycky
3c9c214b2c Less editorializing. 2020-05-26 10:41:20 -07:00
Nick Lewycky
b81e241cdf Add support for producing .o files as PIC.
We then can't handle the relocations in those .o files, but it's progress.
2020-05-26 10:41:13 -07:00
nlewycky
b7747ec9de Merge branch 'master' into llvm-probestack 2020-05-26 09:40:33 -07:00
Ivan Enderlin
ea9eb29daf Merge pull request #56 from wasmerio/feat-compiler-llvm-clean-up-comments
chore(compiler-llvm) Clean up comments
2020-05-25 21:49:57 +02:00
Ivan Enderlin
b5f0caf4be chore(compiler-llvm) Clean up comments. 2020-05-25 21:15:02 +02:00
Nick Lewycky
630be7733d Add llvm 'readonly' attribute to calls of the memory size function.
In passing, delete a lot of dead code. Remove old VM intrinsics for memory.size, memory.grow and breakpoints.
2020-05-22 16:55:57 -07:00
Nick Lewycky
300c684742 Emit stack probes in LLVM. 2020-05-22 09:42:58 -07:00
Nick Lewycky
b97a7cb2fc Implement missing error handling.
Expand acronym in comment.
2020-05-21 14:30:45 -07:00
Nick Lewycky
4d791d3e55 Rename mem_buf_slice to contents.
The callers are slicing a memory buffer, but that's not relevant to this function's API.
2020-05-21 13:56:05 -07:00
Nick Lewycky
c02cd76623 Refactor trampoline generation to use load_object_file. 2020-05-21 13:53:48 -07:00
Nick Lewycky
3764e7b9f8 Change load_object_file to take a RelocationTarget instead of a LocalFunctionIndex.
This removes its last connection to the implementation details of having a wasm_module, which we don't want to have to rely on when building trampolines.

There currently isn't a RelocationTarget for a trampoline function that refers to itself (none of been observed to done so yet), so we make the RelocationTarget optional.
2020-05-21 13:40:08 -07:00
Nick Lewycky
02f7e58c01 Change load_object_file to take a callback that converts symbol names into relocation targets.
This change means that load_object_file no longer needs a ModuleInfo, which trampoline generation doesn't have.
2020-05-21 13:32:03 -07:00
Nick Lewycky
a3a4a74596 Plain refactor the ELF loading to its own file. NFC. 2020-05-21 12:18:22 -07:00
Nick Lewycky
11cfe08919 Factor common string out to a constant. 2020-05-20 17:42:30 -07:00
Nick Lewycky
a47a3068f4 Remove #![allow(unused_imports, dead_code)] and fix resulting issues.
Fix nearly-all issues found by clippy too.
2020-05-20 17:18:23 -07:00
Nick Lewycky
dde6bc5269 Remove the C++ code.
This is replaced in reborn by the engines.
2020-05-20 15:41:11 -07:00
nlewycky
2c9ba69767 Merge pull request #40 from wasmerio/llvm-fcg-methods
Turn free functions into methods on LLVMFunctionCodeGenerator.
2020-05-20 14:45:09 -07:00
Nick Lewycky
c522e01165 Remove redundant close-and-reopen of impl block.
Move trap_if_misaligned up so it can join the impl block above it.
2020-05-20 14:18:34 -07:00