Commit Graph

449 Commits

Author SHA1 Message Date
Manos Pitsidianakis
62f07efb08 c-api: Add wasm_*_same functions to global,memory,table 2022-07-19 15:31:51 +03:00
Amanieu d'Antras
9e53e70767 Rework the way the Context is passed into function using it 2022-07-19 15:31:51 +03:00
Amanieu d'Antras
738a66f719 Implement the new Context API for the core API
Co-authored-by: ptitSeb <sebastien.chev@gmail.com>
2022-07-19 15:31:51 +03:00
Amanieu d'Antras
f16bd35d3c Remove old ref-counted extern support from compiler-cranelift
It was never fully implemented and we're moving to a different way of
tracking ExternRef lifetimes.
2022-07-19 15:31:51 +03:00
ptitSeb
2b8aa5174e Allow debugging of EXC_BAD_INSTRUCTION on macOS 2022-07-01 16:03:10 +02:00
Manos Pitsidianakis
a6173f9746 Remove wasmer-{artifact,engine} and merge it into wasmer-compiler and wasmer-vm 2022-06-16 16:57:45 +03:00
Manos Pitsidianakis
699bd3f8ca Update rkyv dependency to 0.7.38 2022-06-16 16:57:45 +03:00
Manos Pitsidianakis
4a80830566 lib/types: remove ArchivableIndexMap struct
rkyv supports IndexMap via a feature flag, so having our own IndexMap
type is unnecessary.
2022-06-16 16:57:45 +03:00
Manos Pitsidianakis
065734bb05 Make rkyv dependency required 2022-06-16 16:57:45 +03:00
Johnathan Sharratt
b0709e4153 Implemented multithreading and fixed a number of bugs with WASIX 2022-06-15 19:26:57 +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
7aeb55a64e Avoid code duplication with a local function to process the Illegal Opcode 2022-05-11 15:41:35 +02:00
ptitSeb
1ef6811c0f Cleanup and a bit of refactoring to use more of rust syntax 2022-05-04 18:01:44 +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
1f3613c881 Split Artifact to have ArtifactCreate that handles only the creation part, not the run part 2022-05-03 09:32:34 +02:00
ptitSeb
1783aa50f1 Also moved enum Trap out of vm 2022-05-03 09:32:34 +02:00
ptitSeb
3d7ae9e21f Moved LibCall enum to wasmer_types, and compiler is no longer dependant of wasmer_vm 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
ptitSeb
f1af6f654d Fixed Windows build 2022-04-05 15:59:25 +02:00
ptitSeb
c9ac582d6e Fixed a typo on Windows build 2022-04-05 14:49:23 +02:00
ptitSeb
20082263b2 Added TrapInformation in UD payload decoding for Windows too 2022-04-05 13:58:11 +02:00
ptitSeb
9282057545 Made a static out of the 0xc0 constant used for ud payload 2022-04-05 13:42:07 +02:00
ptitSeb
27b90ffe37 Simplifed this piece of code for better readability 2022-04-04 20:24:24 +02:00
ptitSeb
01663b433c Fix compilation, but 3 tests are still failing on singlepass 2022-04-04 17:23:02 +02: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
Amanieu d'Antras
a1f6a2228e Use a pool of stack for running Wasm code
Previous we would allocate a new stack on every entry into Wasm code.
This PR caches the stacks in a pool which allows them to be reused.
2022-03-18 17:25:08 +00: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
Amanieu d'Antras
fe9d2d8d22 Release version 2.2.1 2022-03-15 11:02:31 +00:00
Amanieu d'Antras
c4e1c5f9ff Add back workaround for LLDB debugging on macOS 2022-03-14 22:14:22 +00:00
Amanieu d'Antras
742c20a340 Update corosensei to 0.1.2 2022-03-14 22:14:22 +00:00
Amanieu d'Antras
3d52bf2f8f Don't try generating a backtrace on stack overflow 2022-03-14 22:14:22 +00:00
Amanieu d'Antras
f9d1cfdeb5 Fix calling host functions directly from the API 2022-03-14 22:14:22 +00:00
Amanieu d'Antras
ca6f83c7d2 Run Wasm code on a separate stack
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
2022-03-14 22:14:22 +00:00
Amanieu d'Antras
4dd1634218 Release version 2.2.0 2022-02-28 17:19:14 +00:00
Amanieu d'Antras
15f9d2646f Release version 2.2.0-rc1 2022-02-15 19:10:24 +00:00
Amanieu d'Antras
4e27e1164c Release version 2.2.0-rc1 2022-01-27 23:59:27 +00:00
Amanieu d'Antras
ffb9cd33b9 Use trampolines for all libcalls in engine-universal and engine-dylib
In both of these engines, the compiled code may be loaded in memory far
from the Wasmer runtime which means that libcalls may not be reachable
through the normal relocation types. Instead a trampoline is needed to
allow reaching any address in the 64-bit address space.

In the case of engine-dylib, this is even worse since the symbols are
not exported by the executable without some special linker flags. The
solution here is to manually patch in the addresses at load time into
a data table of function pointers.
2022-01-20 11:47:20 +00:00
Amanieu d'Antras
fb7a572415 Use exact version for Wasmer crate dependencies
We don't guarantee API compatibility between internal Wasmer crates when
making minor version bumps.
2022-01-19 21:35:09 +00:00
Amanieu d'Antras
ebcea4a5c4 Release v2.1.1 2021-12-21 12:19:50 +01:00
Amanieu d'Antras
c650ffea33 Version 2.1.0 2021-11-30 23:46:54 +00:00
Amanieu d'Antras
d0b7cae7ee Avoid using the FuncDataRegistry for functions defined or imported by an
instance.
2021-11-25 14:36:34 +00:00
Amanieu d'Antras
cbd169add2 Upgrade rkyv to 0.7 2021-11-19 10:32:34 +00:00