Commit Graph

397 Commits

Author SHA1 Message Date
Syrus Akbary
a419ccdf52 Move Webassembly objects to Store and remove Context
Co-authored-by: ptitSeb <sebastien.chev@gmail.com>
Co-authored-by: Manos Pitsidianakis <manos@wasmer.io>
2022-07-19 15:31:51 +03:00
ptitSeb
0a4ec43a95 Fix machine_arm64 that was trying to emit a sub opcode with a constant as destination (for #2959) 2022-06-22 12:55:43 +02:00
ptitSeb
e4b0b71164 Converted all machine and emitter of singlepass to use Result instead of panic (but assert are still present) 2022-06-22 11:32:44 +02:00
ptitSeb
bdad5298ba Merge branch 'master' into singlepass_multivalue 2022-06-16 16:28:58 +02:00
Manos Pitsidianakis
f744bac1a2 Store: replace new() with new_with_engine() and make new() take CompilerConfig
Since there's one engine now, it doesn't make sense to initialize a
`Store` with the engine specifically. It's an extra redundant step for
the API user.
2022-06-16 16:57:45 +03:00
Manos Pitsidianakis
8f539d134b Move wasmer_compiler/{address_map, function, module, sourceloc, trap, unwind}.rs to wasmer_types 2022-06-16 16:57:45 +03:00
Manos Pitsidianakis
b1f1939bf7 Move wasmer_compiler/{section,relocation}.rs to wasmer_types 2022-06-16 16:57:45 +03:00
Manos Pitsidianakis
feee4e3587 Move wasmer_compiler errors to wasmer_types error module 2022-06-16 16:57:45 +03:00
ptitSeb
51350acc8f Merge branch 'master' into singlepass_multivalue 2022-06-16 14:50:23 +02:00
ptitSeb
a42d1cec9a Better comment about why mov is enoug for atomic store/load 2022-06-16 13:11:17 +03:00
ptitSeb
dd66009656 Some fixes to x86_64 Singlepass compiler, when using atomics 2022-06-16 13:11:17 +03:00
ptitSeb
02be85f610 Enable multi-value handling in Singlepass compiler 2022-06-16 11:12:52 +02:00
Manos Pitsidianakis
485dde534e Fix regression on gen_import_call_trampoline_arm64()
Fix clippy lints #2942 changed the `gen_import_call_trampoline_arm64()`
code because clippy emitted a lint about the loop logic. However, the
fix was wrong and was causing incorrect binary generation on arm64.

More specifically, this was caught by test
`serialize::test_deserialize::singlepass::*` on macos M1 (arm64)
2022-06-13 14:43:55 +03:00
Wolfgang Silbermayr
5339f7cdae Fix clippy lints
Fixes: #2926
2022-06-09 16:05:53 +02:00
Manos Pitsidianakis
00f9a3c8d7 Remove loupe dependency
Closes #2731
Closes #2744
2022-06-08 14:12:49 +03:00
Manos Pitsidianakis
33654c1a1d Release version 2.3.0 2022-06-06 22:27:57 +03:00
ptitSeb
9095fe1668 Added correct instruction traking for stand alone emited IllegalOp in Singlepass (to fix Trap opcode tracking) 2022-05-04 16:50:26 +02:00
ptitSeb
1dba3cb900 Merge branch 'master' into feat/TrapInformation_improvments 2022-05-03 16:15:57 +02:00
ptitSeb
28d23396ac Merge branch 'master' into feat/TrapInformation_improvments 2022-05-03 15:36:49 +02:00
ptitSeb
0c7ea79bfc Cleanup:
Removed conditionnal toml on wasm for VM as it's not builded in that configuration
Added unwind to wasm build
Moved Trap back to vm (from types) as it's used only on Runtime
Move MemoryError back to vm (from types) as it's used on Runtime only scenario
Some cleanup and lint fixes
Removed wasm build case from vfs/host_fs as it's not used
2022-05-03 09:34:13 +02:00
ptitSeb
8010cb88e7 Created stand-alone wasmer-compiler, builded only as a .wasm target for now
Removed leftover trace of compiler feature in compiler-cli
Excluded the new wasmer-compiler-cli from lint test, like wasmer-cli it's based on
2022-05-03 09:32:34 +02:00
ptitSeb
fd2db37014 Removed cfg conditionnal compilation in link, to allow cross-link between different bitness (wasm32 vs 64bits) 2022-05-03 09:32:34 +02:00
ptitSeb
e745ceab7a Moved TableStyle and MemoryStyle to wasmer-types (and compiler-single pass do not depend from vm anymore) 2022-05-03 09:32:34 +02:00
ptitSeb
eb7ef52521 Move VMOffset (and a few friends) to wasmer_types, and adapted compiler-singlepass to use it 2022-05-03 09:32:34 +02:00
ptitSeb
d5bbfd0768 Moved TrapCode enum to wasmer_types, and adapted compiler and wompiler-singlepass 2022-05-03 09:32:34 +02:00
Manos Pitsidianakis
77af8ba634 Fix some clippy lints
Before:
```
% make lint 2>&1 | grep warnings | sort | uniq
error: could not compile `wasmer-cli` due to previous error; 25 warnings emitted
warning: `compiler-test-derive` (lib) generated 8 warnings
warning: `test-generator` (lib) generated 4 warnings
warning: `wasi-test-generator` (bin "wasi-test-generator") generated 8 warnings
warning: `wasmer-cache` (lib) generated 4 warnings
warning: `wasmer-cli` (lib) generated 25 warnings
warning: `wasmer-compiler-cranelift` (lib) generated 50 warnings
warning: `wasmer-compiler-singlepass` (lib) generated 228 warnings
warning: `wasmer-compiler` (lib) generated 3 warnings
warning: `wasmer-emscripten` (lib) generated 182 warnings
warning: `wasmer-engine-dummy` (lib) generated 6 warnings
warning: `wasmer-engine-dylib` (lib) generated 37 warnings
warning: `wasmer-engine-staticlib` (lib) generated 16 warnings
warning: `wasmer-engine-staticlib` (lib) generated 7 warnings
warning: `wasmer-engine-universal` (lib) generated 11 warnings
warning: `wasmer-engine` (lib) generated 15 warnings
warning: `wasmer-object` (lib) generated 5 warnings
warning: `wasmer-types` (lib) generated 31 warnings
warning: `wasmer-vfs` (lib) generated 4 warnings
warning: `wasmer-vm` (lib) generated 40 warnings
warning: `wasmer-wasi-experimental-io-devices` (lib) generated 11 warnings
warning: `wasmer-wasi-types` (lib) generated 3 warnings
warning: `wasmer-wasi` (lib) generated 13 warnings
warning: `wasmer-wast` (lib) generated 11 warnings
warning: `wasmer` (lib) generated 54 warnings
```

After:
```
warning: `wasmer-cli` (lib) generated 16 warnings
warning: `wasmer-compiler-cranelift` (lib) generated 48 warnings
warning: `wasmer-compiler-singlepass` (lib) generated 213 warnings
warning: `wasmer-emscripten` (lib) generated 170 warnings
warning: `wasmer-engine-dummy` (lib) generated 6 warnings
warning: `wasmer-engine-dylib` (lib) generated 4 warnings
warning: `wasmer-engine-staticlib` (lib) generated 14 warnings
warning: `wasmer-engine-staticlib` (lib) generated 5 warnings
warning: `wasmer-engine-universal` (lib) generated 9 warnings
warning: `wasmer-engine` (lib) generated 12 warnings
warning: `wasmer-object` (lib) generated 3 warnings
warning: `wasmer-types` (lib) generated 7 warnings
warning: `wasmer-vm` (lib) generated 36 warnings
warning: `wasmer-wasi-experimental-io-devices` (lib) generated 6 warnings
warning: `wasmer-wasi-types` (lib) generated 3 warnings
warning: `wasmer-wasi` (lib) generated 9 warnings
warning: `wasmer-wast` (lib) generated 9 warnings
warning: `wasmer` (lib) generated 42 warnings
```
2022-04-20 18:25:04 +03:00
Manos Pitsidianakis
1e786f9980 compiler-singlepass: remove enable_stack_check flag
Flag was not used anywhere in the code, stack checks are always enabled.

Closes #2844
2022-04-20 00:50:41 +03:00
Amanieu d'Antras
4c946257cf Update Cranelift to 0.82 2022-04-06 16:23:32 +01:00
Amanieu d'Antras
3ad9552e2e Update wasmparser to 0.83 2022-04-06 16:23:32 +01:00
ptitSeb
b5f4d47370 Merge branch 'master' into feat/TrapInformation_improvments 2022-04-04 16:19:55 +02:00
ptitSeb
61263bc914 Use Undefined instruction with payload to carry over TrapInformation without using an vector or hashmap on Singlepass 2022-04-04 16:16:35 +02:00
ptitSeb
dec097e500 Merge branch 'master' into feat/singlepass_ehframe 2022-03-17 15:52:42 +01:00
ptitSeb
32603a2f4c Simplifed generation of unwind info in singlepass codegen 2022-03-17 12:20:57 +01:00
ptitSeb
aebcb3e693 Renamed 'gen_unwind_info' to 'gen_dwarf_unwind_info' for better clarity 2022-03-17 12:03:25 +01:00
ptitSeb
324a2517a1 Merge branch 'master' into feat/singlepass_ehframe 2022-03-17 10:57:39 +01:00
ptitSeb
dab1d2b46a Merge branch 'master' into feat/singlepass_dylib 2022-03-16 16:04:22 +01:00
bors[bot]
fc794ab4e3 Merge #2807
2807: Run Wasm code on a separate stack r=Amanieu a=Amanieu

This uses the [corosensei](https://crates.io/crates/corosensei) crate to
run Wasm code on a separate stack from the main thread stack.

In trap handlers for stack overflows and memory out of bounds accesses,
we can now check whether we are executing on the Wasm stack and reset
execution back to the main thread stack when returning from the trap
handler.

When Wasm code needs to perform an operation which may modify internal
data structures (e.g. growing a memory) then execution must switch back
to the main thread stack using on_host_stack. This is necessary to avoid
leaving internal data structure in an inconsistent state when a stack
overflow happens.

In the future, this can also be used to suspend execution of a Wasm
module (#1127) by modeling it as an async function call.

Fixes #2757
Fixes #2562


Co-authored-by: Amanieu d'Antras <amanieu@gmail.com>
2022-03-16 13:24:50 +00:00
ptitSeb
44faa7e86a Merge branch 'master' into feat/singlepass_dylib 2022-03-16 10:15:45 +01:00
ptitSeb
fd62d3e9dc Merge branch 'master' into feat/singlepass_dylib 2022-03-15 14:22:15 +01:00
ptitSeb
80cee07df9 Removed unused emit_ldr_label and emit_nop arm64 emiter 2022-03-15 14:14:52 +01:00
Amanieu d'Antras
fe9d2d8d22 Release version 2.2.1 2022-03-15 11:02:31 +00:00
Amanieu d'Antras
2b86fe802f Fix stack probing typo 2022-03-14 22:14:22 +00:00
Amanieu d'Antras
054e524001 Fix stack probing in the singlepass compiler
Stack probes must be done before the stack pointer is adjusted. This
ensures that the stack pointer is still within the bounds of the stack
when inspected by the signal handler.
2022-03-14 22:14:22 +00:00
ptitSeb
f1b23b3af1 Small cleanup 2022-03-11 16:06:09 +01:00
ptitSeb
408847ee75 Added support for Windows x64 in Singlepass for Unwind infos 2022-03-11 16:01:07 +01:00
ptitSeb
3bc9505cd7 Added some support for Eh_frame generation on Aarch64 singlpass 2022-03-08 14:24:43 +01:00
ptitSeb
d8c9f0ebdd Added a emit_unwind_op helper 2022-03-04 16:41:05 +01:00
ptitSeb
e7fff40a27 More fix for no-unwind build 2022-03-03 16:43:02 +01:00
ptitSeb
9e56f563a9 Fix for no-unwind build 2022-03-03 15:46:30 +01:00
ptitSeb
16d2b78776 Filling some FDE information on x86_64 now 2022-03-03 14:41:28 +01:00