Commit Graph

254 Commits

Author SHA1 Message Date
20758ea8af Update wasmparser to 0.77 2021-04-29 09:22:14 -07:00
c634cdcc2e Add TypedSelect support to Singlepass + LLVM
Missed this in the reftypes PR
2021-04-28 10:03:07 -07:00
9be59f809f Use FunctionBinaryReader instead of Middleware 2021-04-26 16:40:54 -07:00
8149453ff5 Merge branch 'master' into feature/reference-types 2021-03-31 08:42:26 -07:00
74a0550101 Fix bug in i64.rotr X 0 in compiler-llvm, add wasmer wast tests 2021-03-26 09:59:46 -07:00
2a541e072b Merge branch 'master' into feature/reference-types 2021-03-16 12:28:05 -07:00
cc27bb2216 Fix some verifier errors in the 64-bit computations. 2021-03-01 15:50:47 -08:00
c422fdeba2 Correct implementation of shift and rotate.
The existing implementations worked on x86-64 when instructions were emitted, but relied on UB per the LLVM IR. Add a test which checks the behaviour when the inputs are constants, so that the LLVM IR constant folder can see and exploit the UB.
2021-03-01 15:00:18 -08:00
40f40bb7d4 RefNull may return any reference type. 2021-03-01 13:40:04 -08:00
3c6168d0bb Split funcref and externref into separate LLVM types, add anyref_ty. 2021-03-01 13:22:56 -08:00
b14afa1342 Implement all reference types instructions in compiler-llvm.
Remove spectest ignores for reference types tests on llvm.

Extend llvm ABIs to pass externref and funcref.

Expose all libcalls through the Libcalls enum.

Add support for all libcalls to llvm object_file.rs, even libcalls that we aren't using.

Add missing no_mangle to libcalls.
Change 'memory' to 'memory32' in libcalls in preparation for the memory64 proposal.
Remove 'local' from 'wasmer_local_memory_copy' in libcalls to fit naming convention.
Add mangling of externref and funcref for llvm-debug-dir.
Mark 'wasmer_func_ref' readonly.
2021-03-01 11:53:12 -08:00
1e777f9a85 Move the test that a table index is in bounds to a point before we deref it.
This fixes the type of trap produced.
2021-02-24 11:19:19 -08:00
6e3f835db8 Merge branch 'master' into feature/reference-types 2021-02-10 06:36:36 -08:00
0a17424368 Update wasmparser and core spectests 2021-02-09 11:57:54 -08:00
6cfcc92d52 Implement further for compiler-cranelift; add ExternRef 2021-02-08 12:49:15 -08:00
ecf891e0ac Add extra layer of indirection for funcref, update tables
This is still a WIP, cranelift is passing spectests but singlepass has 3
failures and LLVM is not implemented correctly
2021-02-03 07:47:25 -08:00
6192143102 NFC. This utility function moved to inkwell. 2021-02-02 12:03:10 -08:00
657d3a52dd Add dereferenceable attribute to the vmctx pointer. 2021-01-27 11:08:13 -08:00
799f1fde66 Add align, nofree and nonnull to vmctx pointer.
Adding dereferenceable is still TODO.
2021-01-26 10:50:50 -08:00
65d8481acf Remove interprocedural optimization passes.
We never have more than one function defined in a module at a time.
2020-12-23 16:25:55 -08:00
271c767785 Replace all usages of to_wasm_error 2020-12-22 09:17:09 +01:00
e7dd725c6d Add module info transformation method to ModuleMiddleware. 2020-11-20 14:34:46 -08:00
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
b123f92f56 Simplified local_decl 2020-10-29 20:19:37 -07:00
afbfcefb03 Implement new SIMD zero-extend loads. 2020-10-29 17:14:04 -07:00
68a0ae9615 Upgrade wasmparser to 0.63 2020-10-29 16:43:02 -07:00
ba60630407 Upgrade wasmparser to 0.62 2020-10-29 16:21:43 -07:00
b7792f03c2 Upgrade wasmparser to 0.60 2020-10-29 15:50:04 -07:00
e89b1c089b Split the ABIs into separate implementations and trait files. 2020-10-23 14:09:14 -07:00
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
fa8e423404 Make abi a trait. 2020-10-20 12:53:09 -07:00
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
1a10d2258e Merge branch 'master' into feature/dynamic 2020-08-21 10:43:09 -07:00
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
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
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
91414df670 NFC. Import the inkwell::DLLStorageClass name. 2020-08-18 14:20:45 -07:00
36850d6230 Set the DLL storage class to export. 2020-08-17 23:23:39 -07:00
6e974b92cd Run cargo fmt 2020-08-13 18:12:43 -07:00
5049c543dc Rename wasm-common crate to wasmer-types 2020-08-13 17:59:26 -07:00
8daeff8bc8 Fix section names for MachO. 2020-08-07 17:19:55 -07:00
b027949914 Pick section names that are valid in ELF and Macho. 2020-08-06 17:50:22 -07:00
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
0e6bc3191f Fix the build post-merge that picked up SymbolRegistry. 2020-08-05 17:26:00 -07:00
afe568c5d3 Merge branch 'master' into llvm-native 2020-08-05 17:17:52 -07:00
bf0df80551 Rename CompilationNamer to SymbolRegistry.
SymbolRegistry is invertible so we can remove the wrappers.
2020-08-05 15:07:56 -07:00
64448dda40 Create new InvertibleCompilationNamer and use it to name generated functions.
Fixes build of rustc_binary2.wasm with --llvm.
2020-08-05 10:31:00 -07:00
b92b3d7b04 Split function translation into produce-Module and produce-CompiledFunction. 2020-08-05 09:57:51 -07:00
b4270525f0 Create new InvertibleCompilationNamer and use it to name generated functions.
Fixes build of rustc_binary2.wasm with --llvm.
2020-08-04 16:50:55 -07:00
29cfeeb03a Implement the remaining integer SIMD arithmetic instructions. 2020-08-03 15:56:01 -07:00