Commit Graph

396 Commits

Author SHA1 Message Date
15ce8bfda7 Label the loads in intrinsics.rs, most of which are the initial accesses off the context.
Move tbaa_label to intrinsics.rs. Move TBAA pass to first in the list, it doesn't get invalidated. Add TBAA labels for internal fields.
2019-10-30 16:18:36 -07:00
74eaec968e Remove all *_tbaa fields from LLVMModuleCodeGenerator and LLVMFunctionCodeGenerator. 2019-10-30 14:05:11 -07:00
e7d1742c63 Update module to be held by Rc<RefCell<>> so that we can pass it to LLVMFunctionCodeGenerator.
Use that to generate distinct TBAA labels for distinct local variables.
2019-10-30 13:11:29 -07:00
f77d9bfe32 Initial implementation of TBAA for the LLVM backend. 2019-10-30 10:29:51 -07:00
edb6cbefca fix(runtime-core) Share the definition of Trampoline across all the backends.
This patch updates all the backends to use the definition of
`Trampoline` as defined in the `wasmer_runtime_core::typed_func`
module. That way, there is no copy of that type, and as such, it is
easier to avoid regression (a simple `cargo check` does the job).

This patch also formats the `use` statements in the updated files.
2019-10-30 13:10:34 +01:00
7fd20e3355 NFC: Fold variable into initializer. 2019-10-29 22:23:46 -07:00
9224db6d1e Don't emit bounds checks when the offset is less than the minimum memory size. 2019-10-28 15:57:16 -07:00
1a91f0e9ca Merge branch 'master' into feature/llvm-nan-but-fast 2019-10-25 12:52:47 -07:00
03a5b1fbf4 Merge #901
901: Set target triple and datalayout when creating the LLVM module. r=nlewycky a=nlewycky

We were giving LLVM a triple and datalayout only when producing native code from the LLVM IR. With this change, we tell LLVM as early as possible so that the entire optimization stack knows that it's safe to use target-specific constructs (including target intrinsics `@llvm.x86.sse2.ucomieq.sd`) as well as cost models (for autovectorization) and knowing the bitwidth of the registers so that we can know it's profitable to eliminate redundant extend/truncate casts.

Co-authored-by: Nick Lewycky <nick@wasmer.io>
2019-10-25 17:57:11 +00:00
83c63d0b27 Merge #904
904: Use getelementptr instruction instead of int_to_ptr and ptr_to_int. r=nlewycky a=nlewycky

The main part of this change is that we no longer turn pointers into integers to do arithmetic on them, then turn them back into pointers. Doing so is a signal to LLVM that it should not attempt to analyze the provenance of the pointers, disabling some optimizations. Using getelementptr allows us to perform arithmetic on pointers while keeping them in pointer types, which LLVM can then analyze.

Most of the textual change is a refactoring to reorder the operations. Previously the bounds checking and determining of the base and bounds were combined because you could put both into the same match, since both actions are performed differently depending on whether the memory is static or dynamic. In this case, we simply check the type twice and do two different things, with comments labelling the steps.

Co-authored-by: Nick Lewycky <nick@wasmer.io>
2019-10-25 17:22:25 +00:00
9c71561927 Rewrite resolve_memory_ptr to use GEPs as much as possible.
ptr_to_int and int_to_ptr are not treated the same as type-safe pointer operations. LLVM intentionally performs fewer optimizations to code using the former as compared with the latter. We don't need that in our code, standard pointer optimizations are safe for us.
2019-10-24 18:15:32 -07:00
894c5084f3 Insert allocas as a contiguous block at the top of the entry block.
This minimizes the chance we accidentally get categorized as having a dynamic alloca.
2019-10-23 19:21:12 -07:00
bc64b4ce6c Set target triple and datalayout when creating the LLVM module. 2019-10-23 16:04:29 -07:00
82f258b888 Prepare for 0.9.0 release 2019-10-23 13:40:35 -07:00
d2f9047952 Merge #899
899: Remove dead intrinsics. r=Hywan a=nlewycky



Co-authored-by: Nick Lewycky <nick@wasmer.io>
2019-10-23 12:32:09 +00:00
6410da9c24 Remove dead intrinsics. 2019-10-22 23:36:18 -07:00
92f0b1b2e3 Thread whether state tracking is enabled into the LLVM backend. 2019-10-22 23:15:05 -07:00
cf1f4c781e Merge #887
887: Get aggressive about running cargo check over all packages with all features. r=nlewycky a=nlewycky

Fixes the one issue uncovered. The capstone disassembling support in the LLVM backend was broken. Fixed by removing it. Instead, use the `--llvm-object-file` flag to get a finished object file to disassemble with any disassembler.


Co-authored-by: Nick Lewycky <nick@wasmer.io>
Co-authored-by: Mark McCaskey <mark@wasmer.io>
2019-10-21 22:43:09 +00:00
3d3aef6df3 Merge branch 'master' of github.com:wasmerio/wasmer into feature/llvm-nan-but-fast 2019-10-21 12:33:35 -07:00
813f6414e0 Remove dead functions, don't leave them commented out. 2019-10-21 11:16:51 -07:00
10dddf9904 Fix repeated typo in comment. 2019-10-18 16:34:45 -07:00
b180a2e14c Get aggressive about running cargo check over all packages with all features.
Fixes the one issue uncovered. The capstone disassembling support in the LLVM backend was broken. Fixed by removing it. Instead, use the `--llvm-object-file` flag to get a finished object file to disassemble with any disassembler.
2019-10-17 15:37:35 -07:00
2c5c1b1c2c For floating point operations, allow inputs to be arbitrary, including SNaNs.
Instead of ensuring outputs are arithmetic NaNs on every function, we tag them as pending such a check, so that a sequence of computation can have a single canonicalization step at the end.

There's an extra wriggle for SIMD. The Wasm type system only indicates them as V128, so it's possible that we might do computations as F32x4Add, I8x16Add, F64x2Add in a row with no other computations in between. Thus, most SIMD functions apply pending canonicalizations to their inputs, even integer SIMD operations.
2019-10-17 11:55:01 -07:00
2695093a03 Merge #863
863: Rewrite Min/Max to handle all cases correctly. Fixes 545 spectest failures. r=nlewycky a=nlewycky

# Description
The llvm backend was not quite following the Wasm spec for {F32,F64,F32x4xF64x2}{Min,Max}. We used the `@llvm.minnum` and `@llvm.maxnum` intrinsics which don't handle the corner cases the same. When we tried to use `@llvm.minimum` and `@llvm.maximum` which do, we get an internal error from the x86 backend. I was hoping that crash would go away with the upgrade to LLVM 9, but it does not.

Reimplement these operations using plain LLVM instructions.

# Review

- [x] Add a short description of the the change to the CHANGELOG.md file


Co-authored-by: Nick Lewycky <nick@wasmer.io>
2019-10-09 22:24:07 +00:00
88f126a00b Merge #870
870: Fix unused value warning due to inkwell API change. NFC. r=nlewycky a=nlewycky

# Description
Fix unused value warning due to inkwell API change. No functionality change.

Co-authored-by: Nick Lewycky <nick@wasmer.io>
2019-10-08 23:56:10 +00:00
c61cbf6c0b Add a comment. 2019-10-08 11:25:10 -07:00
afddbb2b2a Remove unused value warning due to inkwell API change. NFC. 2019-10-07 17:16:52 -07:00
9cdfb48d0c The i1 argument is actually named "is_zero_undef" which we want to be false.
Fixes the test failures that showed up on mac.
2019-10-07 17:11:59 -07:00
749691ca2a Add a comment explaining why we don't use the intrinsics for these. 2019-10-04 11:50:11 -07:00
1a7f00f0af Rewrite Min/Max to handle all cases correctly.
Fixes 545 spectest failures.
2019-10-03 18:19:12 -07:00
c77cbc1f40 Prepare for 0.8.0 release 2019-10-02 15:40:35 -07:00
9be72e6808 Fix some other files too 2019-09-30 22:50:04 -07:00
c69cdeca9b Update cranelift backend to fork version 0.44.0 2019-09-25 23:37:39 -05:00
7bf306eb27 Use flat-square style in downloads button 2019-09-24 13:42:17 -07:00
621ef56ab6 lmproved READMEs to use Azure Pipelines badges and better lgo 2019-09-24 13:36:31 -07:00
a1a88c6eb8 Use the default features for wasmparser 2019-09-21 13:59:08 -05:00
f48d6f6690 Cranelift backend update to fork of clif version 0.43.1 2019-09-21 13:06:54 -05:00
bf396ec76d Remove patch version in deps when not necessary 2019-09-20 16:11:09 -07:00
726269a52c fix missing info error 2019-09-17 12:05:00 +02:00
4190f01195 remove panic and unimplemented in llvm-backend and runtime-core 2019-09-17 12:03:03 +02:00
59597b9e83 Switch from PIC+Default (small) to Static+Large. Should fix flaky test failures. 2019-09-16 10:49:39 -07:00
8dd82c05e6 Implement atomic load and store instructions with actual atomics in the LLVM backend.
Includes a run of `cargo update` to pick up the newer inkwell required.
2019-09-13 12:05:55 -07:00
33811cde37 Fix mistake in version update; generate lock file 2019-09-12 12:49:11 -07:00
0f4d266e4e Prepare for 0.7.0 release 2019-09-12 12:44:38 -07:00
009bb67686 Bump lazy_static from 1.3.0 to 1.4.0
Bumps [lazy_static](https://github.com/rust-lang-nursery/lazy-static.rs) from 1.3.0 to 1.4.0.
- [Release notes](https://github.com/rust-lang-nursery/lazy-static.rs/releases)
- [Commits](https://github.com/rust-lang-nursery/lazy-static.rs/compare/1.3.0...1.4.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-09-09 23:02:16 +00:00
d8471e2b6a Improved docs with custom logo and favicon 2019-09-03 17:06:31 -07:00
616b768529 Bump winapi from 0.3.7 to 0.3.8
Bumps [winapi](https://github.com/retep998/winapi-rs) from 0.3.7 to 0.3.8.
- [Release notes](https://github.com/retep998/winapi-rs/releases)
- [Commits](https://github.com/retep998/winapi-rs/compare/0.3.7...0.3.8)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-09-02 09:11:48 +00:00
212e2be166 Remove -fno-rtti 2019-08-22 22:58:08 -07:00
613e4de9fc Fix LLVM object loader exceptions. 2019-08-22 18:57:26 -07:00
bdcd73cd63 Unblock signals in LLVM trap handler. 2019-08-22 17:45:52 -07:00