5021 Commits

Author SHA1 Message Date
Mark McCaskey
344bf0716c
Merge branch 'master' into test-interface-types 2020-02-13 11:01:57 -08:00
bors[bot]
1d3ae6a00e
Merge #1213
1213: Fixed WASI isatty 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

Current WASI implementation returns a wrong response when libc `isatty` is used for `stdin`, `stdout` or `stderr`.

This PR fixes it.

<!-- 
Provide details regarding the change including motivation,
links to related issues, and the context of the PR.
-->

# Review

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


Co-authored-by: Syrus <me@syrusakbary.com>
Co-authored-by: Syrus Akbary <me@syrusakbary.com>
2020-02-13 18:42:30 +00:00
Syrus Akbary
7a45bd8a39
Merge branch 'master' into fix/isatty 2020-02-13 10:42:09 -08:00
Syrus
60e686ff76 Added change into changelog 2020-02-13 10:37:27 -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
07ba2c82b9 test(interface-types) Add wasmer-interface-types to make check. 2020-02-13 15:38:35 +01:00
Ivan Enderlin
2e2c5ab9c1 doc(changelog) Add #787. 2020-02-13 15:38:21 +01:00
bors[bot]
16245c6bd2
Merge #787
787: feat(interface-types) Implement Interface Types (WIT) r=Hywan a=Hywan

So far, this PR implements a new crate named `wasmer-interface-types`. The goal is to implement the WebAssembly Interface Types (WIT) proposal, https://github.com/WebAssembly/interface-types. Keep in mind the proposal is highly unstable and experimental.

The `wasmer-interface-types` is designed to be _runtime agnostic_, which means that there is no connection between this crate and `wasmer-runtime-core` or `wasmer-runtime` (or any backend crates). The hope is that other runtimes could use `wasmer-interface-types` according to their needs.

The `wasmer-interface-types` is composed of 4 parts:
* AST: [The WIT language, represented as an AST](https://github.com/Hywan/wasmer/blob/feat-interface-types/lib/interface-types/src/ast.rs) (it's not really abstract though),
* Decoders: So far, it contains only [one parser that reads the WIT binary language](https://github.com/Hywan/wasmer/blob/feat-interface-types/lib/interface-types/src/decoders/binary.rs) and produces an AST,
* Encoders: So far, it contains only [one compiler that transforms the AST into "WIT.wat”](https://github.com/Hywan/wasmer/blob/feat-interface-types/lib/interface-types/src/encoders/wat.rs), i.e. the textual representation of an Interface Types AST
* Instructions: WIT defines a new concept called Adapters. An adapter contains a set of instructions. Those instructions are executed when data are bound. So, in more details, this module contains:
  * [`interpreter.rs`](https://github.com/Hywan/wasmer/blob/feat-interface-types/lib/interface-types/src/interpreter/mod.rs), a stack-based interpreter, defined by:
    * A compiler that transforms a set of instructions into a set of _executable_ instructions,
    * A stack,
    * A runtime that holds the “invocation inputs” (arguments of the interpreter), the stack, and the Wasm instance (which holds the exports, the imports, the memories, the tables etc.),
  * [`stack.rs`](https://github.com/Hywan/wasmer/blob/feat-interface-types/lib/interface-types/src/interpreter/stack.rs), a very light and generic stack implementation, exposing only the API required by the interpreter,
  * [`wasm/*.rs`](https://github.com/Hywan/wasmer/blob/feat-interface-types/lib/interface-types/src/interpreter/wasm/structures.rs), a set of enums, types, and traits to represent a Wasm runtime —basically this is the part a runtime should take a look to support the `wasmer-interface-types` crate—.

Progression:

* [x] WIT binary parser,
* [x] WIT.wat compiler,
* [ ] Interpreter:
  * [ ] Wasm runtime traits to represent:
    * [x] Instance,
    * [x] Export,
    * [x] Memory,
    * [x] Import,
    * [ ] Table,
  * [x] Generic stack implementation,
  * [ ] Implemented instructions:
    * [x] `arg.get`,
    * [x] `call`,
    * [x] `call-export`,
    * [x] `read-utf8`,
    * [x] `write-utf8`,
    * [ ] `as-wasm`,
    * [ ] `as-interface`
    * [ ] `table-ref-add`
    * [ ] `table-ref-get`
    * [ ] `call-method`
    * [ ] `make-record`
    * [ ] `get-field`
    * [ ] `const`
    * [ ] `fold-seq`
    * [ ] `add`
    * [ ] `mem-to-seq`
    * [ ] `load`
    * [ ] `seq.new`
    * [ ] `list.push`
    * [ ] `repeat-until`
    * [ ] `seq-to-mem`
    * [ ] `store`
* [ ] Plug `wasmer-interface-types` into `wasmer-runtime-core`

Co-authored-by: Ivan Enderlin <ivan.enderlin@hoa-project.net>
2020-02-13 13:41:32 +00: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
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
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
bors[bot]
3fb5f548ab
Merge #1191
1191: Fix singlepass miscompilation on `Operator::CallIndirect`. r=losfair a=losfair

This fixes the 3 failing tests mentioned in https://00f.net/2019/10/22/updated-webassembly-benchmark/ .

(TODO: Add test cases?)

Co-authored-by: losfair <zhy20000919@hotmail.com>
2020-02-11 19:00:08 +00:00
losfair
2f4e9b1fe3 Update changelog. 2020-02-12 02:56:12 +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
bors[bot]
df268cff0e
Merge #1207
1207: Update Rust version used to build docs to be consistent r=syrusakbary a=MarkMcCaskey

In response to #1196 


Co-authored-by: Mark McCaskey <mark@wasmer.io>
2020-02-11 18:43:12 +00:00
Mark McCaskey
491ba27528 Update Rust version used to build docs to be consistent 2020-02-11 10:41:17 -08:00
losfair
5ca6c22cbf Merge remote-tracking branch 'origin/master' into fix/singlepass-indirect-call 2020-02-12 02:28:25 +08:00
bors[bot]
eaa081e359
Merge #1192
1192: Use `ExceptionCode` for error representation. r=losfair a=losfair

Extends https://github.com/wasmerio/wasmer/pull/1129 to all backends.

Co-authored-by: losfair <zhy20000919@hotmail.com>
2020-02-11 18:15:50 +00: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
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
cee4bed95e Update changelog 2020-02-11 03:19:15 +08: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
Syrus Akbary
4a63e09d6d
Merge pull request #1200 from wasmerio/dependabot/cargo/byteorder-1.3.4
Bump byteorder from 1.3.2 to 1.3.4
2020-02-10 09:43:40 -08:00
Syrus Akbary
27da143e59
Merge pull request #1199 from wasmerio/dependabot/cargo/blake3-0.1.4
Bump blake3 from 0.1.3 to 0.1.4
2020-02-10 09:43:21 -08:00
Syrus Akbary
f5ec7d10b6
Merge pull request #1198 from wasmerio/dependabot/cargo/indexmap-1.3.2
Bump indexmap from 1.3.1 to 1.3.2
2020-02-10 09:43:07 -08:00
Syrus Akbary
7238681132
Merge pull request #1197 from wasmerio/dependabot/cargo/hex-0.4.1
Bump hex from 0.4.0 to 0.4.1
2020-02-10 09:42:56 -08:00