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.
2460: Added Wasmer Js API 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
This PR adds support for compiling Wasmer into JS/Wasm via wasm-bindgen, so 3rd party dependencies can use Wasmer to target the web also.
Things working:
* [x] Type introspection: we have to decide how to do it, either run our own parser on the data or rely on the future APIs for introspect Wasm types (this APIs are yet available in the browser, but a proposal is on the way: [wasm-js-types proposal](https://github.com/WebAssembly/js-types)).
* [x] Wasm-pack wasmer-js tests
* [x] Assert 0 warnings in lint
* [x] Allow for custom JS errors (via `RuntimeError`)
* Externals
* [x] Functions with and without Environments
* [x] Native functions
* [x] Dynamic functions
* [x] Memory
* [x] Globals
* [x] Tables
# Review
- [ ] Add a short description of the change to the CHANGELOG.md file
Co-authored-by: Syrus Akbary <me@syrusakbary.com>
compiler-llvm now uses the experimental.constrained intrinsics to ensure
correct behavior on FP operations when full-canonicalization is
disabled.
This patch requires TheDan64/inkwell#247
2250: Use rkyv for JIT Engine r=syrusakbary a=syrusakbary
Since we are going to switch serialization methods, the new one doesn’t have a slowdown if we read the data directly.
Thus, we can always operate with processed frame infos rather than creating a lazy structure that will be deserialized when needed.
Try it:
```shell
git clone https://github.com/wasmerio/wasmer.git -b universal-compiled-info
cd wasmer
make build-wasmer
./target/release/wasmer run lib/c-api/tests/assets/qjs.wasm --disable-cache -- -h
```
Co-authored-by: Syrus Akbary <me@syrusakbary.com>