83195a1498
Use abi::func_type_to_llvm
when producing an LLVM function type from wasm types.
...
This renames `func_sig_to_llvm` to `func_type_to_llvm` and deletes the old version in intrinsics::. The new version returns a list of attributes along with the type. Update callers to set these attributes on the function or call site.
2020-06-02 15:44:39 -07:00
e5ea5789ea
Use args_to_call
and rets_from_call
in both calls and indirect calls.
2020-06-02 15:44:39 -07:00
2812a3330f
Use abi::args_to_call
in indirect calls too.
2020-06-02 15:44:39 -07:00
f762690dfb
Use abi::args_to_call
when placing a direct call.
2020-06-02 15:44:39 -07:00
6e98f39568
Remove commented-out debugging cruft.
...
This was made obsolete by PR #79 .
2020-06-02 11:03:36 -07:00
903c1b23be
Update lib/compiler-llvm/src/translator/code.rs
...
Co-authored-by: nlewycky <nick@wasmer.io >
2020-06-01 14:12:44 -07:00
2a9ce436f9
Added LLVM callbacks
2020-06-01 13:54:26 -07:00
d597a97aa1
Annotate atomicrmw and cmpxchg with volatile if needed.
2020-05-28 14:04:19 -07:00
fd64edf4c8
Return a FunctionCache instead of its members.
2020-05-27 16:28:00 -07:00
fce259befa
Cache lookup of memory_grow and memory_size functions.
2020-05-27 14:55:46 -07:00
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
9eba8f798f
Implement all TODOs for TBAA labels.
2020-05-27 12:18:02 -07:00
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
b035ebada2
Code cleanup. Remove reimplementation of type_to_llvm_ptr, use the one in intrinsics instead.
2020-05-26 15:22:24 -07:00
bd8ffd6a17
Remove dead argument from CtxType::memory.
2020-05-26 14:59:59 -07:00
7a1ac7b843
Don't mark loads and stores volatile when they're bounds checked at runtime.
2020-05-26 14:57:11 -07:00
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
2089c0a163
Support variable memory indices in the TBAA labelling too.
2020-05-26 14:57:11 -07:00
07ec1fc004
Make memory_index a variable, we'll be reusing it soon.
2020-05-26 14:57:11 -07:00
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
8a6f3beef5
memory_plans is a member, we don't need to pass it around.
2020-05-26 11:25:32 -07:00
b7747ec9de
Merge branch 'master' into llvm-probestack
2020-05-26 09:40:33 -07:00
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
300c684742
Emit stack probes in LLVM.
2020-05-22 09:42:58 -07:00
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
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
a3a4a74596
Plain refactor the ELF loading to its own file. NFC.
2020-05-21 12:18:22 -07:00
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
dde6bc5269
Remove the C++ code.
...
This is replaced in reborn by the engines.
2020-05-20 15:41:11 -07:00
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
1a22b5414e
The 'name' parameter was always "". Remove them.
2020-05-20 14:15:24 -07:00
f2c781b3b2
Turn splat_vector into a method.
2020-05-20 14:12:00 -07:00
9eb1392988
Turn apply_pending_canonicalization into a method.
2020-05-20 14:05:14 -07:00
df527f2cf1
Turn trap_if_misaligned into a method.
2020-05-20 13:57:51 -07:00
159b2938b9
Turn three trap_if_* functions into methods.
2020-05-20 13:52:12 -07:00
7ea973f6a8
Turn v128_into_* into methods.
2020-05-20 13:43:42 -07:00
3e76e2d1f1
Fixed comments
2020-05-19 22:08:48 -07:00
bdb58903c0
Merge branch 'master' into simplify-vmctx
2020-05-19 22:05:08 -07:00
c76a3d83db
Make LLVM work with one-vmctx imported functions
2020-05-19 21:38:10 -07:00
fbd716374d
Make trunc_sat_scalar() a member of LLVMFunctionCodeGenerator.
2020-05-19 21:37:35 -07:00
093f32c4b9
Make trunc_sat() a member of LLVMFunctionCodeGenerator.
2020-05-19 21:35:29 -07:00
09e057338a
Renamed Module to ModuleInfo
2020-05-19 18:47:50 -07:00
c5696101f8
Simplify TBAA label to a string. If the caller wants to construct a complex one, they can do so. NFC.
2020-05-19 15:13:24 -07:00
063863eb87
Add a trap code for misaligned atomic accesses. Called "unaligned" because that's what the thread proposal spectest uses. Use it in LLVM.
2020-05-19 12:36:27 -07:00
88bc330761
Remove commented-out code.
2020-05-19 11:52:34 -07:00
ae6f0dadb2
Stop naming instructions with numbered names.
...
LLVM will number instructions if you don't provide a name, so we get %7 instead of %s7 from calling state.var_name(). LLVM doesn't assign the numbers until printing out the LLVM IR as text, which we never do in a normal run of wasmer.
If you're editing a .ll text by hand and you're worried about messing up the numbering, use `opt --instnamer` to assign autogenerated names to all numbered instructions.
2020-05-19 09:54:20 -07:00
976493c756
Merge pull request #31 from wasmerio/llvm-memorydefinition-cache
...
Cache lookup of VMMemoryDefinition.
2020-05-18 20:03:48 -07:00
0df99b5dbc
Cache lookup of VMMemoryDefinition.
...
To add to the cache, mutability is required, so now `resolve_memory_ptr` must be `&mut self` which means that `translate_operator` may not hold those convenient immutable references across the whole function.
The search and replace to implement the above changes affected some commented out code, that code is removed.
MemoryStyle grows PartialEq and Eq so that we can check what the memory style is without a match expression.
2020-05-18 19:59:50 -07:00
363dbb3b08
Fixed lint issues
2020-05-18 14:55:55 -07:00
dff7cf28c9
Fix invalid LLVM IR for global.get/set of imported globals.
...
In passing, refactor global accesses and cache the address computations and values of const globals.
Also includes some cargo fmt fixes.
2020-05-18 14:35:23 -07:00