Commit Graph

3148 Commits

Author SHA1 Message Date
losfair
3ee7f43b1c Enable nan canonicalization for cranelift backend. 2020-03-17 13:09:22 +08:00
bors[bot]
c177c44aa2
Merge #1310
1310: upgrade the blake3 dependency to 0.2 r=MarkMcCaskey a=oconnor663

Version 0.2 makes assembly implementations available. They're off by default, and I haven't enabled them here, because they require the build machine to have a C toolchain installed. But if that's already a requirement for Wasmer, we could enable them with the `"c"` feature, for both better runtime performance and faster build times.

Co-authored-by: Jack O'Connor <oconnor663@gmail.com>
2020-03-16 21:49:54 +00:00
bors[bot]
de0578441b
Merge #1307
1307: Add FreeBSD specific failure excludes. r=MarkMcCaskey a=MikaelUrankar

These tests doesn't pass on FreeBSD amd64

Co-authored-by: MikaelUrankar <mikael.urankar@gmail.com>
Co-authored-by: Mark McCaskey <5770194+MarkMcCaskey@users.noreply.github.com>
2020-03-16 21:20:33 +00:00
Jack O'Connor
1cbafeb315 upgrade blake3 to version 0.2 2020-03-16 17:12:26 -04:00
Mark McCaskey
382e244f18
Merge branch 'master' into freebsd 2020-03-16 12:53:10 -07:00
Mark McCaskey
fac27c749b
Merge branch 'master' into feature/improved-wasitests 2020-03-16 12:46:24 -07:00
Mark McCaskey
228c5baa53
Fix typo in wasitest build.rs
Co-Authored-By: Syrus Akbary <me@syrusakbary.com>
2020-03-16 12:37:23 -07:00
Nick Lewycky
29b5223b3e Canonicalize NANs produced by f.trunc and f.nearby. 2020-03-16 11:36:17 -07:00
losfair
da07ed5011 Add clif/llvm NaN spectest failure excludes. 2020-03-16 23:40:28 +08:00
losfair
5d26d92d9b Add switch to turn on/off NaN canonicalization. 2020-03-16 23:40:02 +08:00
losfair
0f663887ad Handle panics from DynamicFunc. 2020-03-16 22:49:37 +08:00
losfair
8ea7bfd563 NaN canonicalization by tracking values. 2020-03-16 00:43:19 +08:00
Syrus
5e2488c1ea Fixed lint 2020-03-14 15:38:16 -07:00
Mark McCaskey
6a5efcda98 Update wasi-tests to test multiple versions of WASI
This change also cleans up the `wasi-test` generation a bit.  It's
actually still really, really messy, but at least now it's split up
into easier to understand chunks.

There's still a lot of low-hanging fruit in terms of improving the
readibilty and maintainability of the code.
2020-03-13 15:41:50 -07:00
Syrus Akbary
c01afac783
Merge pull request #1298 from Hywan/doc-interface-types
doc(interface-types) Update the state of supported instructions
2020-03-12 09:00:53 -07:00
Ivan Enderlin
03910a51fb Merge branch 'master' into feat-interface-types-better-error 2020-03-12 14:52:15 +01:00
Ivan Enderlin
b78a6f47ab chore(interface-types) Simplify code. 2020-03-12 14:51:18 +01:00
Ivan Enderlin
f46099c67b feat(interface-types) Implement Error on errors. 2020-03-12 14:49:43 +01:00
Ivan Enderlin
64729aa8f4 feat(interface-types) Use include ranges to read the memory. 2020-03-12 14:39:15 +01:00
Ivan Enderlin
20085e84a6 doc(interface-types) Update the state of supported instructions. 2020-03-12 13:57:57 +01:00
Syrus Akbary
7617350851
Merge branch 'master' into fix/fpcc-workaround 2020-03-11 21:51:31 -07:00
bors[bot]
7b97b8abb7
Merge #1289
1289: Enable `DynamicFunc` for closures with captured environment. r=syrusakbary a=losfair

Previously we disabled `DynamicFunc` for any non-zero-sized closures to leave space for future changes. However this feature is critical for applications that needs to bring context with host functions, like integrations with dynamic lauguages. So it might be good to enable it.

A question left is: should we put this behind a feature flag or enable it by default?

@Hywan @syrusakbary 

Co-authored-by: losfair <zhy20000919@hotmail.com>
2020-03-12 04:25:34 +00:00
Mark McCaskey
fffdba395d Prepare for 0.16.2 release 2020-03-11 19:15:31 -07:00
Mark McCaskey
c3865c919c Allow zero length arrays and check base offset for being out of bounds 2020-03-11 19:10:15 -07:00
Mark McCaskey
dc9cc3292c Prepare for 0.16.1 release 2020-03-11 16:00:21 -07:00
losfair
6c7f49a223 Put fat DynamicFuncs behind a feature flag. 2020-03-12 03:14:57 +08:00
Mark McCaskey
aaab59f69c Update deps in llvm and singlepass too 2020-03-11 12:00:36 -07:00
losfair
5edd1b5ab7 Enable DynamicFunc for closures with environment. 2020-03-12 02:58:36 +08:00
losfair
9930d54aaa Merge remote-tracking branch 'origin/fix/fpcc-workaround' into fix/fpcc-workaround 2020-03-12 02:53:19 +08:00
Mark McCaskey
ac3d9a37ae Update some dependencies manually, removing duplicate deps 2020-03-11 11:52:43 -07:00
losfair
fc9f1bc8b3 Merge remote-tracking branch 'origin/master' into fix/fpcc-workaround 2020-03-12 02:51:40 +08:00
losfair
adabfa02b0 Move feed_* into closures. 2020-03-12 02:51:22 +08:00
Mark McCaskey
d7d5f5b894 Prepare for 0.16.0 release 2020-03-11 11:15:07 -07:00
Ivan Enderlin
7d6bc577b7 feat(interface-types) Reformat the instructions. 2020-03-10 17:49:35 +01:00
Ivan Enderlin
f0c97a1b81 feat(interface-types) Use better errors.
The new `errors` module contains structure to represent errors,
instead of using basic strings. The first usage is in the interpreter
itself.
2020-03-10 17:49:35 +01:00
Ivan Enderlin
c1e40f165e fix: Revert a file that wasn't a commit candidate. 2020-03-10 15:58:27 +01:00
Ivan Enderlin
52312ff0ad feat(interface-types) Remove the 'input lifetime on Instruction. 2020-03-10 10:37:09 +01:00
Ivan Enderlin
717914f82b Merge branch 'master' into feat-interface-types-instructions-string-and-memory 2020-03-10 10:33:56 +01:00
Ivan Enderlin
e9de8f9999 feat(interface-types) write-utf8 is renamed string-to-memory. 2020-03-10 10:27:17 +01:00
Ivan Enderlin
1b0bda82dd feat(interface-types) Rename write-utf8 to string-to-memory. 2020-03-10 10:25:58 +01:00
Heyang Zhou
e521dfe8c1
Fix typo (2)
Co-Authored-By: nlewycky <nick@wasmer.io>
2020-03-10 12:38:55 +08:00
Heyang Zhou
cfbcd886d0
Fix typo (1)
Co-Authored-By: nlewycky <nick@wasmer.io>
2020-03-10 12:38:39 +08:00
losfair
3e63f1aaa9 Deprecate wasmer_trampoline_buffer_builder_add_callinfo_trampoline. 2020-03-10 12:37:40 +08:00
losfair
7d2d89b606 Resolve review comments. 2020-03-10 12:28:54 +08:00
losfair
7e2ede3960 Fix floating point return values. 2020-03-10 03:16:22 +08:00
losfair
fc114ac671 Merge remote-tracking branch 'Hywan/test-runtime-core-polymorphic-host-functions' into fix/fpcc-workaround 2020-03-10 02:47:00 +08:00
losfair
65962f0186 Add a translation layer before import call in singlepass. 2020-03-10 02:46:13 +08:00
losfair
79613e42d7 Prettier format panic message in spectest. 2020-03-10 02:45:31 +08:00
bors[bot]
674d18ed66
Merge #1281
1281: feat(interface-types) Rename `call` to `call-core`, and remove `call-export` r=syrusakbary a=Hywan

The latest standard removes `call-export` and has a single `call-core` instruction.

Co-authored-by: Ivan Enderlin <ivan.enderlin@hoa-project.net>
2020-03-09 18:03:28 +00:00
losfair
3ff3554345 Merge remote-tracking branch 'origin/master' into fix/fpcc-workaround 2020-03-10 01:29:15 +08:00
Ivan Enderlin
39d491e465 feat(interface-types) read-utf8 is renamed memory-to-string. 2020-03-09 15:06:35 +01:00
Ivan Enderlin
3cc4c6142c doc(interface-types) Improve the README.md. 2020-03-09 14:53:11 +01:00
Ivan Enderlin
637ff1e316 feat(interface-types) Rename call to call-core, and remove call-export. 2020-03-09 14:33:17 +01:00
bors[bot]
b292292267
Merge #1262
1262: Update to latest inkwell which adds context lifetime to basic blocks. r=nlewycky a=nlewycky

The latest inkwell adds lifetimes to basic blocks and also changes most APIs to pass them without reference.

Co-authored-by: Nick Lewycky <nick@wasmer.io>
2020-03-06 22:51:22 +00:00
Mark McCaskey
f8d34e0b57 Add WasmPtr access edge case test 2020-03-05 15:08:09 -08:00
Mark McCaskey
eb4c1bdace Prevent 0 length utf8 strings from WasmPtr too 2020-03-05 13:31:37 -08:00
Mark McCaskey
1c6424a754 Fix WasmPtr to work with accesses accessing the final valid byte
This also returns `None` for all accesses of zero sized types and
arrays of length 0.  Because the array accesses have a non-inclusive
length, length of 0 is not valid.  These checks prevent returning
empty slices that point just outside of memory bounds.
2020-03-05 13:23:50 -08:00
losfair
e62095da5d runtime-core: Move ArgumentRegisterAllocator into state. 2020-03-06 00:37:48 +08:00
losfair
a5de17fb18 runtime-core: Correctly allocate floating point registers for trampolines. 2020-03-05 22:49:58 +08:00
Ivan Enderlin
4d3e8ee117 test(runtime-core) Test polymorphic host functions with more types. 2020-03-05 14:17:04 +01:00
Mark McCaskey
c295adbaa8 Prepare for 0.15.0 release 2020-03-04 12:26:19 -08:00
Mark McCaskey
69fd76af10 Improve support for preopened directories in WASI syscalls
Also filters our default logging more and improves some debug statements
2020-03-04 11:51:24 -08:00
bors[bot]
b2e6535aa0
Merge #1264
1264: feat(interface-types) Implement lifting and lowering instructions r=Hywan a=Hywan

For the moment, WIT defines [a bunch of lifting and lowering instructions](https://github.com/WebAssembly/interface-types/blob/master/proposals/interface-types/working-notes/instr.md). The encoders, the decoders and the AST support them, but we didn't have any instruction implementations for them. This PR implements the instructions for real.

To handle casting failure, I decided to use the `TryFrom` trait, instead of `as`, such as:

```rust
let x: i32 = 128;
let y: i8 = x.try_into().unwrap(); // fails
```

while:

```rust
let x: i32 = 128;
let y: i8 = x as _; // just overflows silently
```

Not all `*x` instructions aren't implement _yet_.

Co-authored-by: Ivan Enderlin <ivan.enderlin@hoa-project.net>
2020-03-04 13:43:33 +00:00
Mark McCaskey
4a6c96382d Update wording of doc comment from feedback 2020-03-03 17:04:52 -08:00
Mark McCaskey
469e43312a Improve WasmPtr documentation 2020-03-03 16:16:29 -08:00
losfair
f499dea0a7 Merge remote-tracking branch 'origin/master' into feature/polymorphic-v2 2020-03-04 01:56:52 +08:00
losfair
d9e744d9dc Resolve review comments. 2020-03-04 01:56:48 +08:00
Ivan Enderlin
de53659ee7 feat(interface-types) Implement s64-to-i32x and u64-to-i32x
Actually, `s64-to-i32` and `u64-to-i32` already error when overflow
happens.
2020-03-03 17:17:26 +01:00
Ivan Enderlin
c157bdaf63 test(interface-types) Test when lowering or lifting fails because of the value. 2020-03-03 17:10:10 +01:00
Ivan Enderlin
6576dfd64b test(interface-types) Add test cases for errors. 2020-03-03 17:04:26 +01:00
Ivan Enderlin
30e72eb796 feat(interface-types) Implement lifting and lowering instructions. 2020-03-03 16:57:05 +01:00
MikaelUrankar
da04dab436 Add FreeBSD specific failure excludes. 2020-03-03 12:13:56 +01:00
Nick Lewycky
3e0d299227 Update to latest inkwell which adds context lifetime to basic blocks. 2020-03-02 14:25:30 -08:00
bors[bot]
115a6573a9
Merge #1261
1261: Fix our side of wasmparser typo. r=MarkMcCaskey a=nlewycky

This is a `cargo update` plus change to fix for ac6df05378 .


Co-authored-by: Nick Lewycky <nick@wasmer.io>
2020-03-02 21:53:13 +00:00
Nick Lewycky
d5581331a2 Fix our side of wasmparser typo. 2020-03-02 11:16:21 -08:00
MikaelUrankar
48fcc8af09 Recognize FreeBSD 2020-03-02 15:41:41 +01:00
Syrus
7a88a320c7 Allow / in mapdir wasm path 2020-02-29 08:47:25 -08:00
Syrus
3f456db4ad Updated headers 2020-02-29 08:45:48 -08:00
losfair
d443ad8d40 Remove outdated comment. 2020-02-29 11:15:09 +08:00
losfair
4012645aee Fix CodeMemory doc comments. 2020-02-29 11:13:34 +08:00
bors[bot]
85a3bb7148
Merge #1244
1244: feat(interface-types) Update to last standard version r=MarkMcCaskey a=Hywan

WIP

Co-authored-by: Ivan Enderlin <ivan.enderlin@hoa-project.net>
2020-02-28 18:35:28 +00:00
losfair
2ddf9ad4c8 Disallow "fat" closures. 2020-02-28 22:16:29 +08:00
losfair
6516243e8a Merge remote-tracking branch 'origin/master' into feature/polymorphic-v2 2020-02-28 11:54:13 +08:00
losfair
31a72e59fb Rename ErasedFunc to DynamicFunc and fix leaky PolymorphicContext. 2020-02-28 11:41:36 +08:00
Mark McCaskey
91808b9df2 Update test-rest to explicitly test each crate 2020-02-27 14:22:26 -08:00
losfair
32915f0077 Merge remote-tracking branch 'origin/master' into feature/polymorphic-v2 2020-02-27 23:49:10 +08:00
Mark McCaskey
0593965459 Make gdb jit symbol weak linking default in llvm-backend features 2020-02-26 19:41:53 -08:00
Mark McCaskey
b5cbb9df60 Fix test and build for musl 2020-02-26 19:07:30 -08:00
Mark McCaskey
dbb2ececf8 Work around unstable linkage attribute 2020-02-26 18:32:40 -08:00
Mark McCaskey
a089cf5a0c Link GDB JIT exposed global and fn as "linkonce"
This is required because LLVM exposes its own
2020-02-26 18:05:24 -08:00
Mark McCaskey
3691c80b7d Add generate_debug_info field to test 2020-02-26 17:29:18 -08:00
Mark McCaskey
56e47c17b0 Revert Wasm parsing to improved old style, fixing singlepass 2020-02-26 16:35:25 -08:00
Mark McCaskey
cb20cd9b2d Merge branch 'master' into feature/debug-prototype2 2020-02-26 14:39:02 -08:00
Mark McCaskey
a8b4f2a1e4 Update clif option string, fix table parsing to match AnyFunc 2020-02-26 13:25:41 -08:00
Mark McCaskey
0a92d9c65e Update LLVM backend to wasmparser 0.51.3 2020-02-26 13:07:31 -08:00
Mark McCaskey
21fd95d760 Update wasmparser to 0.51.3 and clif forks to 0.59 2020-02-26 12:51:56 -08:00
Ivan Enderlin
c0933c52ca feat(interface-types) Fix clippy errors and warnings. 2020-02-26 17:02:52 +01:00
Ivan Enderlin
bff63e3fad Merge branch 'master' into feat-interface-types-update-to-last-standard-version 2020-02-26 16:22:56 +01:00
Ivan Enderlin
4e82d59ea1 feat(interface-types) Implement lifting and lowering instructions.
List from https://github.com/WebAssembly/interface-types/blob/master/proposals/interface-types/working-notes/instr.md.
2020-02-26 16:20:39 +01:00
Ivan Enderlin
f951b6aa53 feat(interface-types) Remove abandonned instructions. 2020-02-26 15:48:00 +01:00
Ivan Enderlin
350a30507f fix(interface-types) arg.get's index is of type u32. 2020-02-26 15:42:29 +01:00
Ivan Enderlin
3653c42e23 test(interface-types) Test adapter to binary. 2020-02-26 15:38:59 +01:00
Ivan Enderlin
4b7cd3a875 doc(interface-types) Fix a typo. 2020-02-26 15:34:04 +01:00
Ivan Enderlin
45283d4f52 test(interface-types) Fix all tests based on previous commits. 2020-02-26 15:32:14 +01:00
losfair
eb89720d5a Merge remote-tracking branch 'origin/feature/polymorphic-v2' into feature/polymorphic-v2 2020-02-26 17:09:10 +08:00
losfair
b0877b26e5 Add safety notice for TrampolineBufferBuilder::remove_global. 2020-02-26 17:07:56 +08:00
Heyang Zhou
a438a644b6
fold() -> sum()
Co-Authored-By: Ivan Enderlin <ivan.enderlin@wanadoo.fr>
2020-02-26 17:01:36 +08:00
Heyang Zhou
292e42addc
Update lib/runtime-core/src/typed_func.rs
Co-Authored-By: Ivan Enderlin <ivan.enderlin@wanadoo.fr>
2020-02-26 17:01:16 +08:00
losfair
262d431b49 Remove unneeded allow(dead_code). 2020-02-26 16:59:31 +08:00
losfair
a0ea1af71f Remove pub(self). 2020-02-26 16:54:33 +08:00
losfair
96d9e39913 Specify imports instead of using a *. 2020-02-26 13:40:02 +08:00
Mark McCaskey
52d4dac450 Rename feed_event's loc to source_loc 2020-02-25 17:15:17 -08:00
Mark McCaskey
6f5ebb564c Allow building clif-backend without wasm-debug 2020-02-25 17:08:09 -08:00
losfair
40d823e298 Merge remote-tracking branch 'origin/master' into feature/polymorphic-v2 2020-02-26 01:45:18 +08:00
losfair
80f824e708 Auto-release trampolines. 2020-02-26 01:45:11 +08:00
losfair
b7c9c1843a Add dynamic executable memory allocation & tests to trampolines. 2020-02-26 01:44:50 +08:00
Mark McCaskey
ce21910077 Prepare for 0.14.1 release
0.14.1 differs from 0.14.0 primarily in that the GNU/Linux build is
built on Ubuntu 16.04 instead of 18.04, meaning we'll use an earlier
version of GLIBC.
2020-02-24 13:20:12 -08:00
losfair
b67acbc0e3 Add ErasedFunc for type-erased functions. 2020-02-25 01:19:19 +08:00
Ivan Enderlin
0c5d46eec9 feat(interface-types) Re-implement interface kinds.
Adopt a flat structure: Flat resolved imports, flat resolved exports,
flat resolved types etc.

Also, use the latest textual format for adapters & co.
2020-02-24 18:12:01 +01:00
losfair
2020901d75 Merge remote-tracking branch 'origin/master' into feature/polymorphic-v2 2020-02-25 00:56:46 +08:00
Ivan Enderlin
c64febdad6 feat(interface-types) Re-implement Type.
The semantics of “types” have changed since the previous draft. Now, a
type is like a regular WebAssembly type but with Interface Types.
2020-02-24 16:23:31 +01:00
Ivan Enderlin
d1ed647efc feat(interface-types) Forwarded adapters have been removed. 2020-02-24 15:56:11 +01:00
Ivan Enderlin
8538e3be33 feat(interface-types) The “helper adapter” has been removed. 2020-02-24 15:49:03 +01:00
Ivan Enderlin
ac68325cc9 feat(interface-types) Update interface types.
According to the last working notes, new interface types are s8, s16,
s32, s64, u8, u16, u32, u64, f32, f64, string, anyref, i32, and i64.

Their binary reprensentations are changing too, from 0x00 to 0x0d.
2020-02-24 15:37:03 +01:00
Mark McCaskey
d7fca539c1 Make JitCodeDebugInfoEntryHandleInner Send and Sync 2020-02-21 15:10:58 -08:00
Mark McCaskey
40e4dddc4b Add updates from feedback
Co-authored-by: Ivan Enderlin <ivan.enderlin@wanadoo.fr>
2020-02-21 14:33:32 -08:00
Nick Lewycky
a56660bfe9 Remove LLVMModuleCodeGenerator::signatures_raw which is a clone of a mapping available in ModuleInfo. 2020-02-21 13:31:49 -08:00
Nick Lewycky
642e6c3db1 Fix typo in comment. 2020-02-21 11:44:31 -08:00
losfair
f717d4c779 Merge remote-tracking branch 'origin/master' into feature/spectest-check-excluded 2020-02-22 01:26:10 +08:00
losfair
f2084982d4 Make excludes more specialized. 2020-02-22 01:25:14 +08:00
Ivan Enderlin
6b667805d7
Merge branch 'master' into doc-readme-logo 2020-02-21 13:41:35 +01:00
Ivan Enderlin
1e52d4b9b2 doc(readme) Fix logo. 2020-02-21 13:39:43 +01:00
Ivan Enderlin
48f8823879 Merge branch 'master' into feat-interface-types-decoders-wat 2020-02-21 12:24:52 +01:00
Ivan Enderlin
80d0b5116f doc(interface-types) Add intra links. 2020-02-21 12:23:58 +01:00
Ivan Enderlin
0afd308c44 feat(interface-types) Add the parse public API.
Also rename `kw` to `keyword`.
2020-02-21 12:23:20 +01:00
Mark McCaskey
3d6e915108
Merge branch 'master' into feature/debug-prototype2 2020-02-20 17:48:02 -08:00
Mark McCaskey
7c5f8251e3 Flatten tuple in return type, conditionally remove more jit debug code 2020-02-20 16:59:59 -08:00
Mark McCaskey
1374bf0806 Prepare for 0.14.0 release 2020-02-20 13:15:29 -08:00
Mark McCaskey
0ec08b5bbd Add updates from feedback 2020-02-20 13:06:50 -08:00
losfair
3fa62461e6 Specify excludes separately for linux/macos singlepass. 2020-02-21 03:47:17 +08:00
losfair
456d2dc2a8 Match against both target OS and family. 2020-02-21 03:47:01 +08:00
Syrus
aa0f33203c Reuse doc file for capi docs 2020-02-20 11:24:54 -08:00
losfair
c1f1a82854 Check for unused excludes. 2020-02-21 03:23:44 +08:00
Mark McCaskey
65a9e04f3c Add updates from feedback
Co-authored-by: Nick Lewycky <nick@wasmer.io>
2020-02-20 11:20:40 -08:00
Ivan Enderlin
2ef13cdc81 fix(interface-types) Remove #[allow(unused)]. 2020-02-20 15:16:35 +01:00
Ivan Enderlin
5e00153d29 feat(interface-types) Decode instructions in WIT's text format. 2020-02-20 15:13:11 +01:00
Ivan Enderlin
cda53a57b5 feat(interface-types) Replace nom by wast for decoding WIT's text format. 2020-02-20 14:43:58 +01:00
Syrus Akbary
8933f3208e
Merge branch 'master' into feature/release-capi 2020-02-19 19:03:57 -08:00
Syrus
edeabd419b Add links for API Docs 2020-02-19 18:58:22 -08:00
Syrus
40fb54c58f Improved Wasmer C API artifacts 2020-02-19 18:54:32 -08:00
Syrus
d93d878aa4 Fixed runtime doc links 2020-02-19 18:53:10 -08:00
Mark McCaskey
3bca20d3d3 Add changelog entry, clean up 2020-02-19 16:37:43 -08:00
Mark McCaskey
64cc59179a
Merge branch 'master' into feature/debug-prototype2 2020-02-19 16:13:35 -08:00
Mark McCaskey
a2e531bda4 Update to use published wasm-debug; make dep optional in clif-backend 2020-02-19 15:53:36 -08:00
Mark McCaskey
68af917d4c Update field names in wasm-debug types 2020-02-19 15:46:43 -08:00
Ivan Enderlin
00e36508d6 feat(interface-types) Parse Adapter in the WAT decoders. 2020-02-19 17:41:06 +01:00
Ivan Enderlin
2e78cf1fc0 feat(interface-types) Parse Import in the WAT decoders. 2020-02-19 17:20:18 +01:00
Ivan Enderlin
c97122899d feat(interface-types) Start implementing the WAT decoder. 2020-02-19 16:12:06 +01:00
Mark McCaskey
1ac59a31f6 Add various small improvements, update attributions file 2020-02-18 17:31:12 -08:00
Mark McCaskey
3653a448f5 Clean up code, add documentation, implement pieces properly 2020-02-18 16:51:02 -08:00
bors[bot]
3d4d6eb366
Merge #1223
1223: feat(runtime-core) Implement `TryFrom<native_type>` for `Value` r=Hywan a=Hywan

Extracted from #1018.

This PR implements `TryFrom` for `Value`. It is required to support dynamically-typed values for polymorphic host functions.

This PR also refactors the code by using a macro (`value_conversions!`) to implement `From` and `TryFrom` in one shot.

Co-authored-by: Ivan Enderlin <ivan.enderlin@hoa-project.net>
Co-authored-by: Ivan Enderlin <ivan.enderlin@wanadoo.fr>
2020-02-18 09:14:40 +00:00
Ivan Enderlin
e9333c5790
Merge branch 'master' into feat-runtime-core-value-try-from 2020-02-18 10:01:03 +01:00
Ivan Enderlin
cc93f3197b
Merge branch 'master' into feat-interface-types-encoders-binary 2020-02-18 09:57:29 +01:00
Mark McCaskey
c005f94a55 Add clippy::missing_safety_doc lint to wasi, misc clean up 2020-02-17 15:15:04 -08:00
Syrus Akbary
abd44e9fba
Merge branch 'master' into feat-runtime-core-cleanup-typed-func 2020-02-17 13:00:13 -08:00
Ivan Enderlin
8d31f0b7e9
Merge branch 'master' into feat-runtime-core-wasm-extern-type-macros 2020-02-17 20:57:27 +01:00
bors[bot]
adc651def6
Merge #1224
1224: fix(runtime-core) Remove warnings r=Hywan a=Hywan

Because we can use the `impl_traits!` macro with only one identifier,
a warning is emitted saying the parenthesis are useless for this
specific usecase. They are required for all the other usecases
though. We can safely ignore this warning.

Co-authored-by: Ivan Enderlin <ivan.enderlin@hoa-project.net>
Co-authored-by: Ivan Enderlin <ivan.enderlin@wanadoo.fr>
2020-02-17 19:34:57 +00:00
Ivan Enderlin
7f0e220f70
Merge branch 'master' into fix-runtime-core-warnings 2020-02-17 20:34:05 +01:00
Ivan Enderlin
8d8a5f6d5a
Merge branch 'master' into feat-runtime-core-cleanup-typed-func 2020-02-17 20:33:35 +01:00
bors[bot]
1158951d5c
Merge #1221
1221: doc(interface-types) Add a `README.md` file r=MarkMcCaskey a=Hywan

Just a small `README.md`, so that users aren't totally loss.

Co-authored-by: Ivan Enderlin <ivan.enderlin@hoa-project.net>
2020-02-17 19:15:58 +00:00
losfair
ed826cb389 Cleanup various FIXMEs and remove protect_unix. 2020-02-18 02:35:19 +08:00
Ivan Enderlin
9013d52ea4 doc(runtime-core) Hide some traits and structs in the documentation.
Those are not necessary for the user. It's only internal
implementation, that must be public because it ends up in public
types, but the compiler infers everything automatically.
2020-02-17 16:03:54 +01:00
Ivan Enderlin
ad77803243 fix(runtime-core) Rename ExternalFunction to HostFunction. 2020-02-17 16:02:23 +01:00
Ivan Enderlin
533609ff70 chore(runtime-core) Move one statement to be closer to the definition. 2020-02-17 16:01:01 +01:00
Ivan Enderlin
2ee1e80f3b feat(runtime-core) Allow dynamic signature for polymorphic host functions.
This patch adds a new field in `Func`: `signature`. It contains the
signature of the host function.

For non-polymorphic host functions, the signature is computed from the
`Args` and `Rets` implementation parameters at compile-time.

For polymorphic host functions though, to be fully dynamic, the
signature given to `new_polymorphic` is used in `Func` as the correct
signature.
2020-02-17 15:50:12 +01:00
Ivan Enderlin
ad20a008e0 fix(runtime-core) Use explicit dyn for trait objects. 2020-02-17 15:30:25 +01:00
Ivan Enderlin
ff154999f3 fix(runtime-core) Remove warnings.
Because we can use the `impl_traits!` macro with only one identifier,
a warning is emitted saying the parenthesis are useless for this
specific usecase. They are required for all the other usecases
though. We can safely ignore this warning.
2020-02-17 15:20:21 +01:00
Ivan Enderlin
1d1ffcc10a feat(runtime-core) Implement TryFrom<native_type> for Value. 2020-02-17 14:56:43 +01:00
Ivan Enderlin
9088f6b9e2 feat(runtime-core) Simplify WasmExternType implementations with macros. 2020-02-17 14:53:09 +01:00
Ivan Enderlin
d6cd1fa6c4 doc(interface-types) Add a README.md file. 2020-02-17 14:48:58 +01:00
Ivan Enderlin
306d19274b test(interface-types) Test roundtrip: AST to binary to AST. 2020-02-17 13:55:59 +01:00
Ivan Enderlin
8736f0548e test(interface-types) Fix one bug and write the test suite. 2020-02-17 13:55:59 +01:00
Ivan Enderlin
1149158589 feat(interface-types) Add the binary encoder. 2020-02-17 13:55:59 +01:00
Syrus Akbary
a21cf6d4c3
Added link to a custom ABI example repo
https://github.com/wasmerio/wasmer-rust-customabi-example
2020-02-16 12:48:20 -08:00
losfair
7b0f7ee55e Merge remote-tracking branch 'origin/master' into feature/polymorphic-v2 2020-02-16 00:39:27 +08:00
losfair
5f4561e5ef Fix compilation error on Aarch64. 2020-02-16 00:28:43 +08:00
Mark McCaskey
923e4ac83a Add command line flag, make debug crate optional, clean up API 2020-02-14 12:34:25 -08:00
Mark McCaskey
23275d07f6 Improve clif verifier error message 2020-02-14 11:45:11 -08:00
Mark McCaskey
5e3147db08 Enable clif verifier in debug mode, fix issue with verifier 2020-02-14 11:32:49 -08:00
losfair
12373bb872 Func::new_polymorphic 2020-02-15 01:31:49 +08:00
losfair
2fe6e6f039 Global trampoline buffer. 2020-02-15 01:31:33 +08:00
Ivan Enderlin
0c4c9107d5 fix(interface-types) Remove a dbg! macro. 2020-02-14 12:19:29 +01:00
Mark McCaskey
c8e3a0925b
Merge branch 'master' into feature/changed-memory-view 2020-02-13 16:04:43 -08:00
Syrus Akbary
7a45bd8a39
Merge branch 'master' into fix/isatty 2020-02-13 10:42:09 -08:00
Syrus
61c85b3fbf Improved fd_write debugging 2020-02-13 10:35:48 -08:00
Syrus
c287170166 Fixed wasi isatty tests when being generated 2020-02-13 10:33:27 -08:00
Ivan Enderlin
c697e6812f Merge branch 'master' into feat-interface-types 2020-02-13 14:40:46 +01:00
Ivan Enderlin
7f8d9165d4 fix(interface-types) Clean up cargo features. 2020-02-13 14:38:05 +01:00
Ivan Enderlin
eb2f9db230 feat(interface-types) Forbids unsafe code. 2020-02-13 14:36:17 +01:00
Ivan Enderlin
9559747394 doc(interface-types) Add #[deny(missing_docs)]. 2020-02-13 14:34:45 +01:00
Ivan Enderlin
ae6e26158f chore(interface-types) Simplify code. 2020-02-13 14:26:50 +01:00
Ivan Enderlin
6891517c8b chore(encoders) Changing unimplemented!() to todo!(). 2020-02-13 14:24:07 +01:00
Ivan Enderlin
13cee90d17 feat(encoders) Implement ToString instead of From<…> for String. 2020-02-13 14:19:31 +01:00
Ivan Enderlin
722727bd56 chore(decoders) Simplify code. 2020-02-13 13:56:30 +01:00
Ivan Enderlin
d8f923091f chore(decoders) Simplify code. 2020-02-13 13:54:26 +01:00
Ivan Enderlin
3f0c32bf44 fix(decoders) Remove the unsafe block in the string parser.
Instead of using `str::from_utf8_unchecked`, this patch updates the
code to use `str::from_utf8` and handles the error appropriately.
2020-02-13 13:52:23 +01:00
Ivan Enderlin
370fd6d866 feat(decoders) Improve LEB parser in the binary module.
The LEB parser is renamed `uleb`. It now checks for overflow, and
badly-formed bits, resp. `TooLarge` or `Eof`. More test cases are
added, whose from the DWARF 4 standard.
2020-02-13 13:36:18 +01:00
Ivan Enderlin
1ad42d81cb doc(interface-types) Improve documentation of decoders::binary::leb. 2020-02-13 11:41:02 +01:00
Ivan Enderlin
b7941f4019 feat(interface-types) Ensure ast::Type is always well-formed.
As @MarkMcCaskey noted, `Type` can be corrupted because `field_names`
and `field_types` must have the same length. This patch removes the
public visibility, and adds methods like `new`, `add_field`,
`field_names` and `field_types` to encapsulate `Type` internal data.
2020-02-13 11:24:29 +01:00
Syrus
62e1526037 Fixed WASI isatty 2020-02-12 23:00:30 -08:00
Mark McCaskey
e34e0bb897 Clean up, everything works 2020-02-12 17:09:30 -08:00
Ivan Enderlin
13b9cb3995 doc(interface-types) Improve the documentation of the interpreter module. 2020-02-12 17:37:06 +01:00
Ivan Enderlin
6b0e43b7c4 doc(interface-types) Improve the documentation of the instruction module. 2020-02-12 16:01:33 +01:00
Ivan Enderlin
b3c102da37 doc(interface-types) Improve documentation of the instruction module.
Also, rename `RepeatWhile` to `RepeatUntil`.
2020-02-12 15:59:41 +01:00
Ivan Enderlin
98c73099c3 doc(interface-types) Improve documentation of the macros module. 2020-02-12 15:52:15 +01:00
Mark McCaskey
5e3c5f703f Fix validation issue, cast to the correct type 2020-02-11 16:35:42 -08:00
Mark McCaskey
93dcb63348 Maybe improve safety of MemoryView Deref 2020-02-11 14:13:25 -08:00
bors[bot]
f2d9a49e3f
Merge #1208
1208: Fix trap handling bug on Windows and add test r=MarkMcCaskey a=MarkMcCaskey

Resolves #1204

# Review

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


Co-authored-by: Mark McCaskey <mark@wasmer.io>
2020-02-11 21:54:49 +00:00
Mark McCaskey
132645e0d0 Fix trap handling bug on Windows and add test 2020-02-11 13:24:26 -08:00
losfair
c6861d1827 Merge remote-tracking branch 'origin/master' into fix/singlepass-indirect-call 2020-02-12 02:55:48 +08:00
losfair
01e570d60a Add test for PR 1191. 2020-02-12 02:54:27 +08:00
losfair
5ca6c22cbf Merge remote-tracking branch 'origin/master' into fix/singlepass-indirect-call 2020-02-12 02:28:25 +08:00
losfair
3999728e39 Merge remote-tracking branch 'origin/master' into feature/remove-wasm-trap-info 2020-02-12 02:14:30 +08:00
losfair
2071a4bddf Fix LLVM invoke_trampoline. 2020-02-12 02:14:07 +08:00
Mark McCaskey
0564000da3 Add wip debugging code 2020-02-11 09:52:21 -08:00
Syrus Akbary
97328b3af7
Fixed typo 2020-02-10 13:24:11 -08:00
bors[bot]
9d80584c97
Merge #1202
1202: doc(runtime-c-api) Improve documentation of the `memory` module r=syrusakbary a=Hywan

Address https://github.com/wasmerio/wasmer/issues/1203.

As part of the daily doc routine, this patch improves the documentation of `memory` module.

This patch also handles more null pointers.

Co-authored-by: Ivan Enderlin <ivan.enderlin@hoa-project.net>
2020-02-10 19:55:02 +00:00
losfair
cc4b512bde Fix clif trap code conversions. 2020-02-11 03:16:56 +08:00
losfair
b40edd4512 Fix failures on test compilation. 2020-02-11 03:03:05 +08:00
losfair
e17d8f20b8 Merge remote-tracking branch 'origin/master' into feature/remove-wasm-trap-info 2020-02-11 02:52:14 +08:00
Ivan Enderlin
c5b963b81b doc(interface-types) Improve documentation of the wat module. 2020-02-10 17:12:32 +01:00
Ivan Enderlin
55ae0e474e doc(interface-types) Add a doctest for decoders::binary::parse. 2020-02-10 16:48:25 +01:00
Ivan Enderlin
98fb0697d1 test(interface-types) Test the parse parser. 2020-02-10 16:39:34 +01:00
Ivan Enderlin
9fda6f9451 doc(interface-types) Improve documentation of the binary module. 2020-02-10 16:39:06 +01:00
Ivan Enderlin
2fc1fbb7ec doc(interface-types) Improve documentation of the ast module. 2020-02-10 15:44:28 +01:00
Ivan Enderlin
d667cb8e2f doc(interface-types) Improve documentation of the ast module. 2020-02-10 15:41:41 +01:00
Ivan Enderlin
36c7dbd92f feat(interface-types) Rename ImportedFunction to Import.
So that we are consistent with `Export`.
2020-02-10 15:41:10 +01:00
Ivan Enderlin
32325c1861 doc(interface-types) Improve module descriptions. 2020-02-10 15:27:04 +01:00
Ivan Enderlin
d63508f19e doc(interface-types) Improve documentation of the stack module. 2020-02-10 15:23:28 +01:00
Ivan Enderlin
e098934328 doc(interface-types) Improve documentation of the crate itself. 2020-02-10 15:22:56 +01:00
Ivan Enderlin
5ed5ac82c0 test(interface-types) Improve test cases for Stack. 2020-02-10 15:22:22 +01:00
Ivan Enderlin
102ebe87f8 chore(interface-types) Format code. 2020-02-10 14:41:40 +01:00
Ivan Enderlin
0b0a89bf0f test(interface-types) Fix a documentation message. 2020-02-10 14:41:06 +01:00
Ivan Enderlin
60a905698d feat(interface-types) Use nom 5.1. 2020-02-10 14:05:13 +01:00
Ivan Enderlin
fe14c5c06b chore(interface-types) Update crate version. 2020-02-10 13:32:04 +01:00
Ivan Enderlin
ba16d12b1a Merge branch 'master' into feat-interface-types 2020-02-10 13:25:57 +01:00
Ivan Enderlin
c8af1b1fb7 feat(interface-types) Remove dev-dependencies to any runtime. 2020-02-10 13:15:52 +01:00
Ivan Enderlin
b56240010c feat(interface-types) Simplify code. 2020-02-10 13:14:46 +01:00
Ivan Enderlin
207d69fdbd feat(interface-types) Change Instance::local_or_import(&self) to Instance::local_or_import(&mut self).
It allows the instance to create or update locals/imports when the
`local_or_import` function is called. It's not ideal, but fine enough
for a first step.
2020-02-10 13:14:19 +01:00
Ivan Enderlin
99c9fc44dc chore(interface-types) The tests/ directory has moved in wasmer-runtime-core-tests. 2020-02-10 13:13:03 +01:00