Commit Graph

292 Commits

Author SHA1 Message Date
Nick Lewycky
8ca3693a56 Add support for middleware to experimental_native_compile_module and make it work on compiler-llvm. 2020-11-23 13:56:17 -08:00
losfair
9d8f315d4c Update module info in-place. 2020-11-23 13:42:51 -08:00
losfair
e7dd725c6d Add module info transformation method to ModuleMiddleware. 2020-11-20 14:34:46 -08:00
bors[bot]
1a4cd326e8 Merge #1781
1781: Cranelift upgrade r=syrusakbary a=syrusakbary

<!-- 
Prior to submitting a PR, review the CONTRIBUTING.md document for recommendations on how to test:
https://github.com/wasmerio/wasmer/blob/master/CONTRIBUTING.md#pull-requests

-->

# Description

Upgrade Cranelift to `0.67`. This upgrade also enables all SIMD tests (with one small exception operator that is still not fixed in Cranelift).

<!-- 
Provide details regarding the change including motivation,
links to related issues, and the context of the PR.
-->


Co-authored-by: Syrus <me@syrusakbary.com>
Co-authored-by: Syrus Akbary <me@syrusakbary.com>
2020-10-30 04:47:24 +00:00
Syrus
b123f92f56 Simplified local_decl 2020-10-29 20:19:37 -07:00
Syrus
9bd2c47730 Upgraded Cranelift to 0.67 2020-10-29 20:19:16 -07:00
Nick Lewycky
afbfcefb03 Implement new SIMD zero-extend loads. 2020-10-29 17:14:04 -07:00
Syrus
68a0ae9615 Upgrade wasmparser to 0.63 2020-10-29 16:43:02 -07:00
Syrus
ba60630407 Upgrade wasmparser to 0.62 2020-10-29 16:21:43 -07:00
Syrus
b7792f03c2 Upgrade wasmparser to 0.60 2020-10-29 15:50:04 -07:00
jubianchi
2452b9a604 chore(doc): Add the Wasmer logo to the generated API documentation 2020-10-26 22:37:30 +01:00
Nick Lewycky
e89b1c089b Split the ABIs into separate implementations and trait files. 2020-10-23 14:09:14 -07:00
Nick Lewycky
282a16d9b0 Remove commented-out debugging code. 2020-10-22 17:33:17 -07:00
Nick Lewycky
9e2bf2615f Implement aarch64 procedure call ABI (AAPCS64).
Fix the autodetection of which Abi to pick.
2020-10-22 16:32:41 -07:00
Nick Lewycky
e4981c4f66 Add a get_abi(TargetMachine) method instead of creating X86_64SystemV directly.
A new Arm64Linux ABI is added but it's an unedited copy of the X86_64SystemV one so far.

A bunch of cleanups from clippy. Use matches! more, don't pass &Box<dyn Abi>.
2020-10-20 14:46:45 -07:00
Nick Lewycky
fa8e423404 Make abi a trait. 2020-10-20 12:53:09 -07:00
Nick Lewycky
d562c2dd9c Sometimes the store may be partially-successful before trapping, for instance if it is partways in valid memory and partways into the guard page.
Use a load instruction before the store to ensure that all the memory is addressable. The loaded value is discarded.

NB. We don't apply this to atomics. It's not clear whether atomic stores can be half-committed.

Fixes align.wast and memory_trap.wast on aarch64.
2020-10-16 16:29:45 -07:00
Nick Lewycky
a01d3d3d70 cargo fmt 2020-10-08 21:04:51 -07:00
nlewycky
1a10d2258e Merge branch 'master' into feature/dynamic 2020-08-21 10:43:09 -07:00
Nick Lewycky
5d40787856 Add a compiler-llvm CompilerFunctionKind for the whole module which can occur with the experimental API for engine-native.
Since it's no longer per-function, rename CompilerFunctionKind to CompilerKind.
2020-08-20 23:28:07 -07:00
Nick Lewycky
8a27a2938b Turn VMMemoryDefinition::current_length into a u32.
The current wasm spec limits the size to 32-bits, and attempting to use a larger size causes problems with compiler-cranelift.
2020-08-19 18:04:12 -07:00
Nick Lewycky
5a6ecd4d00 Fix dynamic memory styles in llvm.
Dynamic memory has the same struct as static memory, in particular the length field is not a pointer to a length field.

Also, send the correct trap code.
2020-08-19 17:43:05 -07:00
Nick Lewycky
91414df670 NFC. Import the inkwell::DLLStorageClass name. 2020-08-18 14:20:45 -07:00
Nick Lewycky
9c5e682585 Export the wasmer metadata when building a DLL. 2020-08-18 14:18:07 -07:00
Nick Lewycky
36850d6230 Set the DLL storage class to export. 2020-08-17 23:23:39 -07:00
Nick Lewycky
9e89ee9b7b Call a callback to emit the merged object file. 2020-08-17 23:21:36 -07:00
Mark McCaskey
6e974b92cd Run cargo fmt 2020-08-13 18:12:43 -07:00
Mark McCaskey
5049c543dc Rename wasm-common crate to wasmer-types 2020-08-13 17:59:26 -07:00
Nick Lewycky
57b9612352 Fix invalid LLVM IR when using dynamic memories. 2020-08-11 13:32:42 -07:00
Syrus
dd4f27accc Fixed ARM cross compilation 2020-08-11 12:23:11 -07:00
Nick Lewycky
6b1df05582 Explain why we switch away from large code model when PIC is enabled.
Note that I don't explain why Small vs Medium. I'm not sure myself.
2020-08-10 16:32:35 -07:00
Nick Lewycky
45dcee1282 When we're building PIC we don't need the large code model. Try small.
Only mangle darwin to linux when PIC is disabled (the reason we do it is to avoid LLVM forcably enabling PIC for us).
2020-08-07 18:13:56 -07:00
Nick Lewycky
8daeff8bc8 Fix section names for MachO. 2020-08-07 17:19:55 -07:00
Nick Lewycky
15b3a35e0c Don't clone function body data. 2020-08-07 14:31:36 -07:00
Nick Lewycky
037922bbf2 Change this API to return an Option that's None when it's unimplemented and Some(Result<...>) when it is. 2020-08-07 14:26:53 -07:00
nlewycky
b5d9c29d42 Pass target BinaryFormat through when targeting native object files
Co-authored-by: Syrus Akbary <me@syrusakbary.com>
2020-08-07 14:18:01 -07:00
Syrus
701973ffae Make Native Engine work with conditional native compilation 2020-08-07 11:35:42 -07:00
Syrus
f445cc73dd Fixed trampoline section name. 2020-08-06 18:20:17 -07:00
Nick Lewycky
b027949914 Pick section names that are valid in ELF and Macho. 2020-08-06 17:50:22 -07:00
Nick Lewycky
ace5072169 Try producing the binary format native to each platform if we're going to try to dlopen/LoadLibrary it. 2020-08-06 17:40:27 -07:00
Nick Lewycky
c68e7da972 Emit dynamic trampoline for each function index, not just each signature.
Emit names for trampolines when building through that experimental native pipeline.
2020-08-06 13:39:41 -07:00
Nick Lewycky
ed878db40d Use wasmer_raise_trap and wasmer_probestack in compiler-llvm.
As a linux-only temporary hack, export those two symbols from the wasmer binary.

Note: is a bit of a hack and works on linux only.
2020-08-06 12:12:17 -07:00
Nick Lewycky
2c2da8ec3c Wire up experimental_native_compile_module for LLVM.
Move Symbol and SymbolRegistry to wasmer_compiler crate.
2020-08-05 17:44:52 -07:00
Nick Lewycky
0e6bc3191f Fix the build post-merge that picked up SymbolRegistry. 2020-08-05 17:26:00 -07:00
Nick Lewycky
afe568c5d3 Merge branch 'master' into llvm-native 2020-08-05 17:17:52 -07:00
Nick Lewycky
02c62657f5 Add experimental_native_compile_module and initial implementation changing native engine to use it. 2020-08-05 17:12:17 -07:00
Nick Lewycky
bf0df80551 Rename CompilationNamer to SymbolRegistry.
SymbolRegistry is invertible so we can remove the wrappers.
2020-08-05 15:07:56 -07:00
Nick Lewycky
9ca46f4f2d Include trampolines in the generated object file. 2020-08-05 14:20:47 -07:00
Nick Lewycky
0b62c775de Verify the post-merge bitcode before codegen. 2020-08-05 12:12:47 -07:00
Nick Lewycky
8057083d1f Initial commit of LLVMCompiler::compile_native_object.
Entirely untested.

Works by doing function generation including optimization passes in parallel, then generating bitcode and passing that along to be reparsed into a new module and then module-linked into a single merged module to be emitted as an object file.
2020-08-05 11:25:56 -07:00