Commit Graph

355 Commits

Author SHA1 Message Date
losfair
c1619026d5 Swap code lazily when tiering up from singlepass to LLVM.
Does not handle long-running functions, but should work at least.
2019-08-09 04:26:17 +08:00
losfair
0d604b754b Commented out code for saving semantics of internal values. 2019-08-08 21:54:39 +08:00
losfair
b113f5a24b longjmp turns out to work on Windows. Remove custom unwinding code. 2019-08-08 03:19:19 +08:00
losfair
4b1d337ebe Custom setjmp/longjmp to avoid SEH. (will it work?) 2019-08-07 00:38:42 +08:00
losfair
b50fd31adb Use setjmp/longjmp to handle LLVM exceptions. 2019-08-07 00:06:35 +08:00
dependabot-preview[bot]
a036a306d5
Bump regex from 1.2.0 to 1.2.1
Bumps [regex](https://github.com/rust-lang/regex) from 1.2.0 to 1.2.1.
- [Release notes](https://github.com/rust-lang/regex/releases)
- [Changelog](https://github.com/rust-lang/regex/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/regex/compare/1.2.0...1.2.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-08-05 08:36:27 +00:00
Brandon Fish
2f70a199e4 Add deny dead_code lint and fix one error 2019-08-01 20:46:35 -06:00
Nick Lewycky
83aa9c67c7 Replace throw() with noexcept. Unlike throw(), noexcept indicates that the function does not throw.
Before C++17, throw() was equivalent to wrapping the function in a try {} catch
{ std::unexpected(); }. In C++17 throw() was made equivalent to noexcept and
in C++20 throw() was removed.
2019-08-01 17:13:23 -07:00
Nick Lewycky
ac49e57c2d Run clang-format-8 over the C++ code. No functionality change. 2019-08-01 17:12:46 -07:00
Nick Lewycky
536f9813dc Implement InternalEvent::Breakpoint in the llvm backend.
Enable now-working metering unit tests when run with the llvm backend.
2019-08-01 12:44:25 -07:00
losfair
9ed5094f86 Resolve semantics for more values. 2019-08-01 23:28:39 +08:00
Syrus
0dfa1f68a8 Formatted code 2019-07-31 23:51:12 -07:00
Syrus
ebce7d0371 Updated dependencies 2019-07-31 23:42:54 -07:00
Syrus
a6461c3b14 Removed explicit hashbrown dependency 2019-07-31 23:18:38 -07:00
Syrus
6245daaa84 Update dependencies to latest versions 2019-07-31 23:04:03 -07:00
Mark McCaskey
20e424c11e update wasmparser and clif-fork dependencies 2019-08-01 10:13:25 +09:00
nlewycky
54b5c642dc
Merge branch 'master' into features/llvm-metering 2019-07-31 13:13:07 -07:00
Nick Lewycky
931d556de1 Add support for internal fields. 2019-07-31 13:10:51 -07:00
Syrus
fccf68c734 Updated version to 0.6.0 2019-07-31 10:28:45 -07:00
Syrus Akbary
0256a6eb88
Merge branch 'master' into features/llvm-windows 2019-07-30 17:38:36 -07:00
Syrus
97c6956d98 Added llvm in windows support to Changelog 2019-07-30 15:56:25 -07:00
Syrus
22f8b3f3dc Improved LLVM compilation for Unix 2019-07-30 15:32:21 -07:00
Syrus
89178732cc Fixed unix errors 2019-07-30 15:23:03 -07:00
Nick Lewycky
bdb1c4c44e Fix inkwell assertion due to treating vector as float. Fix llvm backend fatal error due to missing support for fminimum/fmaximum. 2019-07-30 14:59:04 -07:00
Syrus Akbary
12f8f3d085 First working version of LLVM in Windows 2019-07-30 14:47:53 -07:00
Nick Lewycky
3e7545a278 Fix the Trunc[SU] operations, makes conversions.wast pass. 2019-07-30 12:42:25 -07:00
losfair
0a7f95ee06 Allow a range of instruction offsets to be used in ip lookup. 2019-07-30 22:25:15 +08:00
Nick Lewycky
11f66d287b Improve NaN handling by canonicalizing NaNs before most operations.
Not handled here is @llvm.minnum and @llvm.maxnum which should be replaced with
@llvm.minimum and @llvm.maximum, but using those currently leads to LLVM backend
fatal errors.
2019-07-28 22:53:48 -07:00
Nick Lewycky
2f021f0e2a LLVM srem is undefined in cases where i32.rem_s and i64.rem_s are defined. 2019-07-28 22:53:48 -07:00
losfair
efb5277d1d Stack parsing now works with LLVM. 2019-07-27 02:50:49 +08:00
Marek Vavruša
659f088c4f llvm-backend: export FunctionCodeGenerator and ModuleCodeGenerator
This is in line with the singlepass-backend to be able to use LLVM MCG with
a StreamingCompiler.
2019-07-24 18:46:35 -07:00
Syrus
76daa7b3fd Improved Wasmer Backends documentation 2019-07-24 18:06:59 -07:00
losfair
cc4f0e31a6 TwoHalves & trying to get cowsay to compile again 2019-07-25 02:44:28 +08:00
Nick Lewycky
f763de94ab Update to wabt 0.9.0. 2019-07-24 10:03:08 -07:00
Nick Lewycky
16fe3ce0af Merge branch 'master' into simd 2019-07-23 13:51:15 -07:00
Nick Lewycky
fe2bd6ad6c Add missing names to LLVM instructions. 2019-07-23 13:19:27 -07:00
Mark McCaskey
ad7e3b52d3 Prepare for release of 0.5.7 2019-07-23 11:20:59 -07:00
Nick Lewycky
18307bb79c Improve panic/unreachable/unimplemented usage. Refactor a little. 2019-07-22 12:15:56 -07:00
losfair
0133b92bec Populating LLVM stack maps into MSM/FSM. 2019-07-23 02:55:43 +08:00
Nick Lewycky
775c120b38 Update to newer wasmerio/wabt-rs. 2019-07-19 15:48:50 -07:00
Nick Lewycky
cd25356858 Fix shuffle and enable tests. Add support for new load_splat instructions.
Updates to wasmparser 0.34.0 and picks up a newer wasmerio/wabt.
2019-07-19 15:19:58 -07:00
Nick Lewycky
3e009c5971 Reformat. 2019-07-18 13:40:24 -07:00
Nick Lewycky
3be6a024aa Fix bugs in V128 support based on results from testing against simd spec test.
These is one test failure remaining with V128 global variables.

* Fix trunc_sat. We need both the largest float that can be converted to an int
  and the largest int, they are not the same number.
* Implement calling of functions that take V128 by passing in two i64's.
* Improve support for V128 in spectests. Parse binary modules with the same
  features as the outer spectest. Fix compilation error involving Result in
  emitted .rs file. Handle V128 in more cases when producing .rs file. Parse
  the wast script with SIMD enabled.
* Adjust the WAVM spectest so that it parses with WABT and mostly passes with
  wasmer. Wabt is particular about ints not having decimal places and floats
  having decimal places. Wasmer does not support mutable globals or shared
  memory. Tests of shuffles are disabled. Some assert_invalid tests that wabt
  won't even parse are disabled.
2019-07-18 12:52:59 -07:00
losfair
2e030c9c4a Parsing LLVM stackmaps. 2019-07-19 02:02:15 +08:00
losfair
a14a8e4c50 Emit stack map at critical points. 2019-07-18 02:43:04 +08:00
Nick Lewycky
eeac6d5d2d Merge branch 'master' of github.com:wasmerio/wasmer into simd 2019-07-16 19:16:45 -07:00
Mark McCaskey
19f544e489 update to 0.5.6 2019-07-16 13:12:21 -07:00
nlewycky
278adf678a
Merge branch 'master' into nlewycky/llvm 2019-07-11 16:48:46 -07:00
Nick Lewycky
7fb88251d4 Simplify trap_if_not_representable_as_int.
Fix typo in function name. Use two fcmp instructions instead of unpacking the bits of the IEEE float and using integer arithmetic to determine details about its value.
2019-07-11 16:46:37 -07:00
Nick Lewycky
7045030532 Try a new list of optimization passes.
A few notes:
a) the inliner doesn't help because all the calls are indirect and not even opt -O2 can figure out which functions they're actually calling.
b) aggressive instruction combining is not a super-set of the instruction combiner. Instcombine is made up of a large number (probably 10,000s) of patterns, and some particularly slow ones were taken out and moved to the aggressive instruction combiner. Aggressive instcombine *only* runs that handful of optimizations, which fired zero times on our example wasm files.
c) NewGVN is not ready for production, it has asserts that fire when building sqlite or cowsay. This is why sqlite didn't build with the llvm backend.
d) Scalar-replacement-of-aggregates (sroa) is a strict superset of promote-memory-to-registers (mem2reg), and you probably want sroa because it's usually faster. It also fires 10,000s more times than mem2reg on lua.wasm.
e) Aggressive-dead-code-elimination was only deleting as much regular dead-code-elimination, but is slower because it depends on a postdominator tree (PDT) analysis that. Other passes don't need PDT so we'll have to build it for just this one pass (as opposed to regular dominator-tree which is reused by many passes). I've replaced this with bit-tracking dead-code-elimination which deletes more code than dce/adce.
2019-07-11 14:48:07 -07:00
Johan Andersson
b41040cc59 Update to nix 0.14.
Instead of using a mix of nix 0.12 & 0.13
2019-07-11 12:28:56 +02:00
bors[bot]
0c4a8f77d2 Merge #543 #544
543: update version numbers to 0.5.5 r=MarkMcCaskey a=MarkMcCaskey



544: Use bitcast instead of alloca+load+ptrcast+store sequence. r=MarkMcCaskey a=nlewycky



Co-authored-by: Mark McCaskey <mark@wasmer.io>
Co-authored-by: Mark McCaskey <markmccaskey@users.noreply.github.com>
Co-authored-by: Nick Lewycky <nick@wasmer.io>
Co-authored-by: nlewycky <nick@wasmer.io>
2019-07-11 00:51:31 +00:00
Nick Lewycky
7f00dc3cdb Reformat. 2019-07-10 15:33:32 -07:00
Nick Lewycky
8faff26c31 Give float_bits bitcast instruction a name. 2019-07-10 15:31:18 -07:00
Nick Lewycky
e4123433a1 Reformat. 2019-07-10 14:28:07 -07:00
Nick Lewycky
53907b0ab2 Update inkwell to our own copy until upstream supports LLVM 8.
LLVM 8 support from https://github.com/lumen/inkwell/tree/llvm8 .
2019-07-10 14:23:47 -07:00
Nick Lewycky
bb30434392 This .into_iter() call is equivalent to .iter() and will not move the array. 2019-07-10 13:54:36 -07:00
Nick Lewycky
fdc13563b8 Initial implementation of SIMD in the LLVM backend. 2019-07-10 13:54:32 -07:00
Nick Lewycky
77afcea9dc Add V128 stubs to allow LLVM backend to build again. 2019-07-10 13:48:12 -07:00
Nick Lewycky
0a1bdd449e Update to @llvm.minimum/@llvm.maximum which requires LLVM 8.
The @llvm.minnum/@llvm.maxnum intrinsics don't produce correct (for wasm) outputs in all cases.
2019-07-10 13:48:12 -07:00
Nick Lewycky
ea83924547 Update to LLVM 8.0. 2019-07-10 13:48:12 -07:00
Nick Lewycky
b8d2aee80f Update wabt to 0.8 release. 2019-07-10 13:48:12 -07:00
Nick Lewycky
1e86e32d40 Use bitcast instead of alloca+load+ptrcast+store sequence. 2019-07-10 10:24:14 -07:00
Mark McCaskey
4752492974 update version numbers to 0.5.5 2019-07-09 17:43:04 -07:00
Mark McCaskey
99ebb782dc update to version 0.5.4 2019-07-05 13:35:55 -07:00
losfair
a3dcc0e240 Merge remote-tracking branch 'origin/master' into feature/osr 2019-07-04 23:56:45 +08:00
Mark McCaskey
535da4c34a update to version 0.5.3 for wapm bug fix 2019-07-03 14:35:39 -07:00
Mark McCaskey
83da82d844 update for release wasmer 0.5.2 2019-07-02 14:13:45 -07:00
Nick Lewycky
b8f0292c0a Update to wasmpaser 0.32.1. 2019-07-02 10:00:19 -07:00
Nick Lewycky
adb257a40f Reformat. 2019-07-01 16:15:13 -07:00
Nick Lewycky
9fc713f9b1 Update for new wasmparser.rs version. 2019-07-01 16:11:38 -07:00
Nick Lewycky
fe38cc915b Update to newer cranelift which also requires an update to wasmparser 0.31.0. 2019-07-01 15:27:17 -07:00
losfair
650f67a339 Merge remote-tracking branch 'origin/master' into feature/osr 2019-07-01 21:15:35 +08:00
losfair
967027003d Full preemptive snapshot/resume. 2019-06-27 15:49:43 +08:00
Nick Lewycky
70247a0c6e Simplify construction of floating point constants. 2019-06-25 16:05:22 -07:00
Nick Lewycky
55394b4f06 Void type in llvm may only be used as a function return type. You may not form a pointer to void or use it as a structure member.
Fixes assertion failure initializing llvm backend.
2019-06-25 16:05:22 -07:00
Mark McCaskey
09177ac3ae update version numbers to 0.5.1, add changelog entry 2019-06-24 12:45:40 -07:00
Mark McCaskey
7bdfb2be51 update version numbers and changelog for 0.5.0 2019-06-17 12:56:28 -07:00
losfair
69944c1dc2 Fix ctx layout in LLVM. 2019-06-05 02:13:10 +08:00
Brandon Fish
66f9049a06 Reset LLVM related code to master 2019-06-02 19:36:26 -05:00
Brandon Fish
995ecefa92 Cargo fmt 2019-06-02 09:49:21 -05:00
losfair
8019505e65 Merge remote-tracking branch 'origin/feature/clif-cgapi' into feature/metering 2019-05-31 15:40:05 +08:00
losfair
b834b4ff36 Metering for LLVM. 2019-05-31 15:36:08 +08:00
losfair
fd8675324c Merge remote-tracking branch 'origin/master' into feature/metering 2019-05-29 11:16:05 +08:00
Brandon Fish
8069cdac16 Merge branch 'master' into feature/clif-cgapi 2019-05-26 12:04:45 -05:00
Brandon Fish
6ca311f92d Fix compilation errors and warnings 2019-05-26 11:13:37 -05:00
Johan Andersson
8018453266 Update wasmparser 0.29.2 -> 0.30.0 2019-05-24 23:18:08 +02:00
losfair
9919dd73c8 Merge remote-tracking branch 'origin/master' into feature/metering 2019-05-23 20:18:11 +08:00
Brandon Fish
04d6ccc95c Pass module info to FCG as Arc 2019-05-21 23:44:31 -05:00
Brandon Fish
e34e625009 Implement MCG.next_function in other backends 2019-05-19 11:45:16 -05:00
Syrus
4ddffb8285 Update libraries versions to 0.4.2 2019-05-16 14:39:13 -07:00
losfair
6aa87a0bbf Add the internals field and necessary structures for metering. 2019-05-17 01:10:21 +08:00
losfair
fac4c452c6 Fix LLVM backend. 2019-05-14 18:49:02 +08:00
Brandon Fish
2aefa731a6 Add deny for unreachable patterns and unused unsafe 2019-05-12 00:33:02 -05:00
Brandon Fish
85158ac22a Add some initial deny for unused_imports and unused_variables
Additional unused variable fix on unix

Remove unused import on unix

Remove unused windows import
2019-05-11 09:23:25 -05:00
Brandon Fish
54095fcd67 Clean up commented out code in LLVM codegen 2019-05-07 22:53:48 -05:00
losfair
e53d5a91ca Remove transmutes. 2019-05-07 19:20:18 +08:00
Brandon Fish
9c0cbc9775 Remove previous LLVM parser code 2019-05-06 23:41:31 -05:00
Brandon Fish
87a94657d0
Merge branch 'master' into feature/llvm-cgapi 2019-05-06 22:39:20 -05:00
Mark McCaskey
e5dc94c7d6 update version number to 0.4.1 2019-05-06 18:02:39 -07:00
Brandon Fish
0926a5020e Implement caching for parser refactor 2019-05-05 20:11:47 -05:00
Brandon Fish
4770277b15 Remove parser refactor commented out code, unused imports and fields 2019-05-05 14:28:40 -05:00
Brandon Fish
e1138a553b Fix LLVM refactor unreachable depth 2019-05-05 13:56:02 -05:00
Brandon Fish
1864733ab8 Merge branch 'master' into feature/llvm-cgapi 2019-05-05 13:25:51 -05:00
Brandon Fish
60c0504bdf Implement llvm returns in function code generator finalize 2019-05-04 12:07:21 -05:00
Brandon Fish
c5caf9b6db Update LLVM FCG begin_body 2019-05-03 00:14:25 -05:00
Mark McCaskey
2646765671
Merge branch 'master' into update-version-numbers-to-4 2019-05-01 09:27:38 -07:00
Brandon Fish
b016ec6b34 Add start_of_code_block to function 2019-04-30 23:44:34 -05:00
Brandon Fish
0ee2ba0ee6 Implement more of next_function and finalize 2019-04-30 23:22:41 -05:00
Brandon Fish
ec253c73ab Implement feed_local 2019-04-30 20:11:44 -05:00
bors[bot]
82cf572245 Merge #404 #406
404: Update to newer common wasmparser version r=xmclark a=bjfish

- versions should match to have matching types in a common parser
- the `0.29.2` version matches the current parser version of cranelift-wasm

406: Cleanup some clippy warnings r=xmclark a=bjfish

Cleaned up some
- long literal lacking separators
- unneeded return

Co-authored-by: Brandon Fish <brandon.j.fish@gmail.com>
2019-04-30 15:37:12 +00:00
losfair
21dd01c3aa Fix LLVM backend compilation and segfaults. 2019-04-30 15:52:43 +08:00
Brandon Fish
01ba789eed Cleanup some long literal lacking separators 2019-04-29 23:49:00 -05:00
Brandon Fish
a127b770b3 Update to newer common wasmparser version 2019-04-29 23:34:48 -05:00
Mark McCaskey
d020ffd759 update version to 0.4.0 2019-04-29 13:26:51 -07:00
Brandon Fish
53bebf9c73 Add initial progress to add LLVM to module refactor 2019-04-29 00:13:34 -05:00
Mackenzie Clark
9ab7199fe5
Merge branch 'master' into feature/cleanup-imports-unsafe 2019-04-24 08:37:06 -07:00
Lachlan Sneff
706ddabf61 Hook up error propagation 2019-04-22 15:06:40 -07:00
Brandon Fish
9e93565a49 Cleanup build warnings imports and unnecessary unsafe 2019-04-20 20:37:39 -05:00
Lachlan Sneff
087a826222 fix tests on more time uh huh 2019-04-19 14:09:41 -07:00
Lachlan Sneff
c3ef1f8421 Remove commented-out code 2019-04-19 14:00:03 -07:00
Lachlan Sneff
443663aa3f Add caching support to llvm backend 2019-04-19 13:54:48 -07:00
Lachlan Sneff
4dd64ed72e Remove UserTrapper trait 2019-04-18 10:00:15 -07:00
Lachlan Sneff
57e24c957c
Merge branch 'master' into feature/remove-call-protected 2019-04-12 12:44:59 -07:00
Mark McCaskey
d507253372 update crate version numbers to 0.3.0 2019-04-12 12:19:46 -07:00
Lachlan Sneff
0d30c957a2 Fix llvm test 2019-04-12 10:33:30 -07:00
Lachlan Sneff
75cc65a8c5 Update llvm backend to new backend abstraction 2019-04-12 10:05:50 -07:00
Lachlan Sneff
60ac7a5b49 Remove unneeded semicolon 2019-04-11 12:13:36 -07:00
Lachlan Sneff
c898439817 Add well placed unwind(allowed) attribute 2019-04-11 12:07:54 -07:00
Lachlan Sneff
1cb3fbea0a Add support for panicking/returning err back to llvm 2019-04-10 14:17:10 -07:00
Lachlan Sneff
cc656b26a9 Add implementations for typed func errors to cranelift and llvm 2019-04-09 17:09:33 -07:00
bors[bot]
593720dfc5 Merge #310
310: fix(llvm-lint) Clean up various warnings r=Hywan a=Hywan

These patches remove various warnings raised by `rustc`.
Only 2 warnings remain.

Co-authored-by: Ivan Enderlin <ivan.enderlin@hoa-project.net>
Co-authored-by: Mackenzie Clark <mackenzie.a.z.c@gmail.com>
2019-04-01 10:18:56 +00:00
Mackenzie Clark
124563a556
Merge branch 'master' into fix-llvm-lints 2019-03-30 18:11:40 -07:00
Mackenzie Clark
ca41c6dd6b
Merge branch 'master' into fix-llvm-example 2019-03-30 18:10:20 -07:00
Ivan Enderlin
316cbc54ab doc(lib) Add basic README.md. 2019-03-29 10:17:24 +01:00
Ivan Enderlin
8179dd6f96 fix(llvm-backend) Remove sign_type from generate_trampoline. 2019-03-29 10:09:56 +01:00
Ivan Enderlin
34b4f2fb11 fix(llvm-backend) Mark some variables as unused. 2019-03-29 10:09:39 +01:00
Ivan Enderlin
5cd45cbc28 fix(llvm-backend) Mark a variable as unused. 2019-03-29 10:09:10 +01:00
Ivan Enderlin
b03980f8c9 fix(llvm-backend) Remove unused variables or functions. 2019-03-29 10:08:43 +01:00
Ivan Enderlin
76d26d97ac fix(llvm-backend) Remove Intrinsics.ctx_ty, CtxType.ctx_ty, and .ctx_ptr_ty`. 2019-03-29 10:07:38 +01:00
Ivan Enderlin
7645a812d9 fix(llvm-backend) Remove unused variables. 2019-03-29 10:07:08 +01:00
Ivan Enderlin
00e4b25111 fix(llvm-backend) No need to enumerate items in this iterator. 2019-03-29 10:06:31 +01:00
Ivan Enderlin
20378de0e7 fix(llvm-backend) llvm_sig variable is not used here. 2019-03-29 10:06:11 +01:00
Ivan Enderlin
e3f39fc127 fix(llvm-backend) parse_function doesn't need a Module. 2019-03-29 10:05:39 +01:00
Ivan Enderlin
dea4705dcb fix(llvm-backend) LLVMBackend::new doesn't use instrinsics yet. 2019-03-29 10:04:56 +01:00
Ivan Enderlin
91f40639b7 fix(llvm-back) Mark WasmTrapType as deadcode.
This enum is not used directly by Rust, but used externally.
2019-03-29 10:04:09 +01:00
Ivan Enderlin
a1ca7069af fix(llvm-backend) Remove unused imports. 2019-03-29 10:03:40 +01:00
Ivan Enderlin
ddf532ddb5 fix(llvm-backend) Remove an example.rs file. 2019-03-29 09:43:21 +01:00
Mackenzie Clark
5294eb6b0d merge and respond to feedback 2019-03-28 11:41:45 -07:00
Mark McCaskey
a0e20667b5 add small fix 2019-03-28 10:08:41 -07:00
Mark McCaskey
c51d44578d simplify borrowing inference of compiler config in llvm backend 2019-03-27 14:25:29 -07:00
Mark McCaskey
51c2111d53 pass compiler_config along to other backends 2019-03-27 14:18:34 -07:00
Mackenzie Clark
0c7808b1d3 reset a cargo manifests 2019-03-12 13:58:33 -07:00
Mackenzie Clark
f2488ac410 remove feature flag on custom sections 2019-03-12 13:36:11 -07:00
Mackenzie Clark
f7f4fbf08a add the feature flag for llvm backend 2019-03-12 11:59:50 -07:00
Syrus
e591cd0607 Use wasmerio fork of inkwell 2019-03-11 10:03:40 -07:00
Lachlan Sneff
17eada53f3
feat(runtime) Get ready for tiering (#257)
* Add local_function field to context

* Add local call indirection to llvm

* local call indirection

* Fix  vm test

* Fix cranelift local call indirection

* Fix unwinding on nightly
2019-03-08 15:15:16 -08:00
Syrus
3a4325c5a3 Only use llvm in non windows envs 2019-03-07 18:26:29 -08:00
Syrus
671ff09e6a Use LLVM 5 for Windows 2019-03-07 18:06:47 -08:00
Lachlan Sneff
0e5d1172d6 Just install the signal handler once 2019-03-05 16:50:49 -08:00
Lachlan Sneff
48b36a3b01 Runs on linux and also hopefully ci 2019-03-05 14:54:44 -08:00
Lachlan Sneff
fa3ef2e88d Remove .llvmenv 2019-03-05 13:34:22 -08:00
Lachlan Sneff
276e5125b5 Filter out -fno-exceptions from llvm-config --cxxflags 2019-03-05 13:23:26 -08:00
Lachlan Sneff
c86c910054 Add partiality to float truncation 2019-03-05 11:50:56 -08:00
Lachlan Sneff
f2b927bcd8 Remove debug print 2019-03-04 20:00:56 -08:00
Lachlan Sneff
fe8f8a0132 Add illegal arithmetic runtime error 2019-03-04 19:56:02 -08:00
Lachlan Sneff
3be7144892 Some cleanup 2019-03-04 17:37:05 -08:00
Lachlan Sneff
2969409ca7 Add hacky reinterpret instructions and pop used arguments off the value stack 2019-03-04 16:44:46 -08:00
Lachlan Sneff
25c0cef5f7 Up to 1242 passing spectests 2019-03-04 15:51:45 -08:00
Lachlan Sneff
7ef2c0dece Fix execute after free issue with llvm (and presumably cranelift?) 2019-03-04 14:41:56 -08:00
Lachlan Sneff
039ebdcf75 Fix merge errors and update llvm to use the new runtime error type. 2019-03-04 13:10:28 -08:00
Lachlan Sneff
deea9e98a4 Add import names, whoops. 2019-03-04 10:19:38 -08:00
Lachlan Sneff
3f9dbca17f List specific supported features for validator. 2019-03-03 22:47:34 -08:00
Lachlan Sneff
ab550f46fc Fix bug resulting from comparing the memory base instead of the memory offset to the memory bounds. 2019-03-03 22:11:40 -08:00
Lachlan Sneff
ae3b2b2a42 Add bounds checking for memory accesses on dynamic memories 2019-03-03 21:56:30 -08:00
Lachlan Sneff
87c453a0ec Add check for table bounds on call_indirect. 2019-03-03 21:38:35 -08:00
Lachlan Sneff
51cf9dde05 Move SSA value caches to the entry block.
The supporting framework around LLVM will make sure to only compute values once if they
are known to never change. Previously, these values were attempted to be reused from places where
the users may not dominate the creation of the value. To avoid that, they are always created
in the entry block now.
2019-03-03 21:13:37 -08:00
Brandon Fish
c07298e58e Make capstone optional with a feature 2019-03-03 16:02:20 -06:00
Brandon Fish
aae256b407 Add tag to fix cast ptr lint error 2019-03-03 15:34:20 -06:00
Brandon Fish
97a70327d0 Fix compilation of test example 2019-03-03 15:13:20 -06:00
Brandon Fish
2c765c87c5 Update locals reading to use count 2019-03-03 12:55:29 -06:00
Lachlan Sneff
e362b56b07 Turns out we can just throw an exception from the signal handler
without any fancy tricks.

This has been tested on macos, hopefully it works on linux too.
2019-03-03 02:15:53 -08:00
Lachlan Sneff
9cfda6800f Try to return an error from call_protected when an exception occurs.
Something breaks pretty drastically sometimes, not sure why.
2019-03-02 19:08:15 -08:00
Lachlan Sneff
caf2205936 Add a signal handler for macos and linux.
Implementation Notes:
- To avoid setjmp, longjmp, and the mess that those create, we instead set the interrupting
    context of the signal handler to return into the `throw_trap` routine. To my surprise,
    this actually works. The stack ends up getting unwound normally and the memory-oob error
    is caught by the trampoline.
2019-03-02 17:00:05 -08:00
Lachlan Sneff
57bfa9b0a4 Remove multiple throwing functions, just use one. 2019-03-02 14:16:02 -08:00
Lachlan Sneff
9a90689b93 Add preliminary support for throwing and catching uncatchable exceptions.
Additional info:
- WebAssembly "traps" are uncatchable, but are still caught by the trampoline caller.
2019-03-02 12:57:35 -08:00
Lachlan Sneff
5760f6006a Start implementing exception handling by adding frame descriptor entry processing.
- Soon, we should be able basic exceptions.
2019-03-02 10:56:02 -08:00
Lachlan Sneff
87ddf4f855 Add personality function.
- This is part of supporting exceptions in the future.
2019-03-02 10:20:18 -08:00
Lachlan Sneff
a6fc06c908 Fix more compiling issues
Specifically:
- Don't truncate the list of local parameters.
- If the default destination in a br_table instruction is a loop, don't pop any results.
2019-03-02 10:04:44 -08:00
Lachlan Sneff
362e5aa160 Fix issue caused by dangling instruction.
- Come on inkwell, I thought you were better than this.
2019-03-01 20:28:27 -08:00
Lachlan Sneff
f0ac76517a Start running spectests
Additional info:
- Execution is turned off, this is just to make sure the backend can compile the entire specsuite.
- That being said, trampolines are implemented and protected call works (just doesn't protect).
2019-03-01 17:11:20 -08:00
Lachlan Sneff
3717c5720d Get control flow (at least according to the llvm verifier) working.
Next up:
- Importing vm intrinsics.
2019-03-01 15:48:43 -08:00
Lachlan Sneff
51c9091fc5 Start work on generating trampolines 2019-02-28 18:26:47 -08:00
Lachlan Sneff
6a20676fa9 Actually unmap the code after it's done being used 2019-02-28 17:20:18 -08:00
Lachlan Sneff
359ac5abec Connect part of the llvm backend to the runtime 2019-02-28 13:18:00 -08:00
Lachlan Sneff
d4ae5cdd40 Get function addresses from llvm-compiled code 2019-02-28 12:31:39 -08:00
Lachlan Sneff
5d77769381 Hopefully finish the memory manager implementation for llvm RuntimeDyLd 2019-02-27 17:21:20 -08:00
Lachlan Sneff
4f833876e0 Start work on object loader using llvm's RuntimeDyld api. 2019-02-25 18:08:06 -08:00
Lachlan Sneff
2a913f5663 Implement table, partial call_indirect 2019-02-22 17:34:55 -08:00
Lachlan Sneff
108973dabe Start producing object files with llvm 2019-02-15 16:02:20 -08:00