Commit Graph

37 Commits

Author SHA1 Message Date
Alex Crichton
a7d90af19d Update wasmparser and wast dependencies (#1663)
Brings in updates to SIMD spec ops renumbering.
2020-05-05 16:13:14 -05:00
Jef
957677c6f5 Integrate Lightbeam with latest Wasmtime master (#1232)
* Implement trap info in Lightbeam

* Start using wasm-reader instead of wasmparser for parsing operators

* Update to use wasm-reader, some reductions in allocation, support source location tracking for traps, start to support multi-value

The only thing that still needs to be supported for multi-value is stack returns, but we need to make it compatible with Cranelift.

* Error when running out of registers (although we'd hope it should be impossible) instead of panicking

* WIP: Update Lightbeam to work with latest Wasmtime

* WIP: Update Lightbeam to use current wasmtime

* WIP: Migrate to new system for builtin functions

* WIP: Update Lightbeam to work with latest Wasmtime

* Remove multi_mut

* Format

* Fix some bugs around arguments, add debuginfo offset tracking

* Complete integration with new Wasmtime

* Remove commented code

* Fix formatting

* Fix warnings, remove unused dependencies

* Fix `iter` if there are too many elements, fix compilation for latest wasmtime

* Fix float arguments on stack

* Remove wasm-reader and trap info work

* Allocate stack space _before_ passing arguments, fail if we can't zero a xmm reg

* Fix stack argument offset calculation

* Fix stack arguments in Lightbeam

* Re-add WASI because it somehow got removed during rebase

* Workaround for apparent `type_alias_impl_trait`-related bug in rustdoc

* Fix breakages caused by rebase, remove module offset info as it is unrelated to wasmtime integration PR and was broken by rebase

* Add TODO comment explaining `lightbeam::ModuleContext` trait
2020-04-29 16:26:40 -07:00
Gabor Greif
d9d69299bb A few typofixes (#1623)
* a few typofixes

* more tyops
2020-04-28 19:18:05 -05:00
Benjamin Bouvier
2810af0ad1 fix lightbeam warning; 2020-04-24 11:51:35 +02:00
Benjamin Bouvier
f4c4a84b84 cranelift codegen: pass source locations with external relocations; 2020-04-07 11:52:39 +02:00
Nick Fitzgerald
2af544de8b Update to cranelift 0.58.0 and enable (but ignore) reference types and bulk memory tests (#926)
* Update cranelift to 0.58.0

* Update `wasmprinter` dep to require 0.2.1

We already had it in the lock file, but this ensures we won't ever go back down.

* Ensure that our error messages match `assert_invalid`'s

The bulk of this work was done in
https://github.com/bytecodealliance/wasmparser/pull/186 but now we can test it
at the `wasmtime` level as well.

Fixes #492

* Stop feeling guilty about not matching `assert_malformed` messages

Remove the "TODO" and stop printing warning messages. These would just be busy
work to implement, and getting all the messages the exact same relies on using
the same structure as the spec interpreter's parser, which means that where you
have a helper function and they don't, then things go wrong, and vice versa. Not
worth it.

Fixes #492

* Enable (but ignore) the reference-types proposal tests

* Match test suite directly, instead of roundabout starts/endswith

* Enable (but ignore) bulk memory operations proposal test suite
2020-02-07 16:47:55 -06:00
Alex Crichton
9dffaf9d57 Update wasmparser dependency (#912)
* Update wasmparser dependency

Closes #905

* Fix lightbeam compilation
2020-02-06 12:25:32 -06:00
Sergei Pepyakin
eb183d7ab3 Run rustfmt 1.41 (#877) 2020-01-30 21:03:50 +01:00
Jef
4141daae68 Merge pull request #672 from pventuzelo/refactoring_error_handling_lightbeam
[lightbeam] Refactoring Error handling + remove panicking calls in lightbeam backend
2019-12-17 17:43:18 +01:00
Patrick Ventuzelo
d1866f0e09 [lightbeam] replace asserts by Errors in module.rs / translate_only (#713)
* replace assert by Errors

* add better errors message module.rs
2019-12-16 20:51:07 -08:00
Patrick Ventuzelo
e9c2905795 fix introduced clippy warning 2019-12-13 10:55:21 +01:00
Patrick Ventuzelo
a8cef86826 cargo fmt 2019-12-10 14:07:50 +01:00
Patrick Ventuzelo
c4511d53e1 Merge master & correct errors 2019-12-10 14:07:22 +01:00
Hero Bird
3716a863be [lightbeam] Fix clippy warnings + update dependencies (#661)
* [lightbeam] fix compiler warnings

* [lightbeam] fix sign mask clippy warning

* [lightbeam] fix clippy warning: match -> if let

* [lightbeam] fix some hex-literal clippy warnings

* [lightbeam] fix some more simple clippy warnings

* [lightbeam] convert if -> match (clippy suggestion)

* [lightbeam] fix some more clippy warnings

* [lightbeam] add #Safety section to doc comment of execute_func_unchecked

* [lightbeam] rename into_temp_reg -> put_into_temp_register

* [lightbeam] rename to_temp_reg -> clone_to_temp_register

* [lightbeam] rename into_reg -> put_into_register

* [lightbeam] rename to_reg -> clone_to_register

* [lightbeam] rename into_temp_loc -> put_into_temp_location

* [lightbeam] apply rustfmt

* [lightbeam] update dynasm 0.5.1 -> 0.5.2

* [lightbeam] update wasmparser 0.39.1 -> 0.44.0

* [lightbeam] update other dependencies
2019-12-10 12:39:48 +01:00
Patrick Ventuzelo
9daa8e7f38 fix cargo fmt error 2019-12-10 12:00:48 +01:00
Patrick Ventuzelo
0e2f7600b2 bump wasmparser to 0.44.0 + fix error due to change wasmparser operator names 2019-12-10 11:57:21 +01:00
Patrick Ventuzelo
e4d60d23ed fix one bug + refactor Option handling in some func 2019-12-05 19:50:41 +01:00
Patrick Ventuzelo
414d4bb4f5 add detail br_if error 2019-12-05 15:19:58 +01:00
Patrick Ventuzelo
e968b9313b improve format 2019-12-05 15:18:53 +01:00
Patrick Ventuzelo
2b24d17425 replace assert by if/error in function_body 2019-12-05 15:17:20 +01:00
Patrick Ventuzelo
b664428da7 cargo fmt 2019-12-05 15:16:32 +01:00
Patrick Ventuzelo
3d6b1876ac replace assert with if - Err 2019-12-05 14:53:21 +01:00
Patrick Ventuzelo
f212d9ce6a replace expect by Error for backend code 2019-12-05 13:47:59 +01:00
Patrick Ventuzelo
362469e5a9 remove unreachable! + cargo fmt 2019-12-05 13:24:33 +01:00
Patrick Ventuzelo
07c850051d fix all warning, cargo test OK 2019-12-05 13:16:02 +01:00
Patrick Ventuzelo
b8f33c3c94 remove expect from pop func and add return value other wasm opcode functions 2019-12-05 10:41:10 +01:00
Patrick Ventuzelo
dcc68dfafc use Result for a lot of lightbeam func, refactoring error handling 2019-12-05 10:22:36 +01:00
Patrick Ventuzelo
027f6117d6 remove panic, expect and unimplemented from microwasm + use Result as return value for some functions (#652) 2019-12-03 11:58:29 -08:00
XAMPPRocky
2109935fef Remove custom TryInto (#646) 2019-12-02 17:36:13 -08:00
Alex Crichton
39e57e3e9a Migrate back to std:: stylistically (#554)
* Migrate back to `std::` stylistically

This commit moves away from idioms such as `alloc::` and `core::` as
imports of standard data structures and types. Instead it migrates all
crates to uniformly use `std::` for importing standard data structures
and types. This also removes the `std` and `core` features from all
crates to and removes any conditional checking for `feature = "std"`

All of this support was previously added in #407 in an effort to make
wasmtime/cranelift "`no_std` compatible". Unfortunately though this
change comes at a cost:

* The usage of `alloc` and `core` isn't idiomatic. Especially trying to
  dual between types like `HashMap` from `std` as well as from
  `hashbrown` causes imports to be surprising in some cases.
* Unfortunately there was no CI check that crates were `no_std`, so none
  of them actually were. Many crates still imported from `std` or
  depended on crates that used `std`.

It's important to note, however, that **this does not mean that wasmtime
will not run in embedded environments**. The style of the code today and
idioms aren't ready in Rust to support this degree of multiplexing and
makes it somewhat difficult to keep up with the style of `wasmtime`.
Instead it's intended that embedded runtime support will be added as
necessary. Currently only `std` is necessary to build `wasmtime`, and
platforms that natively need to execute `wasmtime` will need to use a
Rust target that supports `std`. Note though that not all of `std` needs
to be supported, but instead much of it could be configured off to
return errors, and `wasmtime` would be configured to gracefully handle
errors.

The goal of this PR is to move `wasmtime` back to idiomatic usage of
features/`std`/imports/etc and help development in the short-term.
Long-term when platform concerns arise (if any) they can be addressed by
moving back to `no_std` crates (but fixing the issues mentioned above)
or ensuring that the target in Rust has `std` available.

* Start filling out platform support doc
2019-11-18 22:04:06 -08:00
Alex Crichton
399295a708 Remove all checked in *.wasm files to the repo (#563)
* Tidy up the `hello` example for `wasmtime`

* Remove the `*.wat` and `*.wasm` files and instead just inline the
  `*.wat` into the example.

* Touch up comments so they're not just a repeat of the `println!`
  below.

* Move `*.wat` for `memory` example inline

No need to handle auxiliary files with the ability to parse it inline!

* Move `multi.wasm` inline into `multi.rs` example

* Move `*.wasm` for gcd example inline

* Move `*.wat` inline with `import_calling_export` test

* Remove checked in `lightbeam/test.wasm`

Instead move the `*.wat` into the source and parse it into wasm there.

* Run rustfmt
2019-11-13 13:00:06 -06:00
Dan Gohman
061b453255 Remove unneeded extern crate, macro_use, and tidy uses. 2019-11-08 17:55:38 -08:00
Dan Gohman
31f8f124f5 Delete spurious commas. 2019-11-08 17:15:37 -08:00
Dan Gohman
e8f08193fc Reformat some long lines and macros. 2019-11-08 17:15:37 -08:00
Dan Gohman
1a0ed6e388 Use the more-asserts crate in more places.
This provides assert_le, assert_lt, and so on, which can print the
values of the operands.
2019-11-08 15:24:53 -08:00
Dan Gohman
e691bf36f3 Reorganize tests (#523)
* Refactor Lightbeam's tests.

This refactors Lightbeam's tests.rs file into several pieces, separating
quickcheck tests into their own file, and moving tests which can be run as
wast tests into `tests/misc_testsuite`, and creating a tests directory
for the rest.

* Remove the old filetests tests.

These are all covered by misc_testsuite and spec_testsuite tests.

* rustfmt

* Remove the "bench" feature.
2019-11-08 16:16:12 -06:00
Dan Gohman
22641de629 Initial reorg.
This is largely the same as #305, but updated for the current tree.
2019-11-08 06:35:40 -08:00