Commit Graph

2437 Commits

Author SHA1 Message Date
Jakub Konka
d458fb6815 Clean up BSD vs Linux implementation details
This commit moves a couple of things around:
* separates the logic of `path_unlink_file` into separate impls
  for linux and BSD-style nixes
* moves implementation consts into appropriate impl modules: linux
  or bsd
* cleans up `utime_now` and `utime_omit` for BSD-style nixes
2019-10-17 11:15:01 +02:00
Jakub Konka
f1f6b3780b Fixes CraneStation/wasmtime#396
This commit fixes an issue with incorrect handling of /dev/(u)random
on Linux. It turns out that `nix::unistd::isatty` call handled only
the POSIX spec case where `ENOTTY` is returned in case the passed
in file descriptor is OK but not a TTY, whereas on Linux this is not
always the case. On Linux, it can be the case that `EINVAL` is returned
instead and this case AFAIK is not handled by the `nix` crate. This
commit fixes this by using `libc::isatty` syscall directly and checking
the return values.
2019-10-17 10:38:58 +02:00
Marcin Mielniczuk
968fb19f17 Add a typesafe enum for file type 2019-10-15 19:25:05 +09:00
Marcin Mielniczuk
5dad532a43 Use cvt from the cvt crate in winx 2019-10-15 17:15:10 +09:00
Artur Jamro
872f6aa03d Fix opt_level builder flag (#411) 2019-10-10 12:14:45 -07:00
Dan Gohman
8e593506dc Don't run the spec_testsuite tests if the submodule isn't checked out. (#409)
* Don't run the spec_testsuite tests if the submodule isn't checked out.

This way, if someone checks out the repository without checking out the
submodules, they can still run "cargo test".

Also, fix a warning in the generated test runner code.

* Print a message if the spec_testsuite submodule is not enabled.

* Move the `#[cfg(test)]` to the top-level `mod`.
2019-10-09 13:34:09 -07:00
Dan Gohman
fd3efad781 Various clippy fixes. (#403) 2019-10-09 13:32:52 -07:00
Dan Gohman
9465668199 Fix a TODO comment. (#405)
The parameter to defined_func_index is in the defined-function space, so calling
func_index on it works to translate it into module space.
2019-10-09 09:33:41 -07:00
Dan Gohman
6494728101 Update the README.md. (#410)
* Update the README.md.

Feature the wasmtime.dev website, update WASI content.

With Lightbeam moving into the Wasmtime repo, it's no longer necessary
to use git submodules to build Wasmtime.
2019-10-09 08:19:52 -07:00
Dan Gohman
8e1b44b29c Make more code work with no_std. (#407)
* Make more code work with no_std.

no_std support is still incomplete, but this patch takes care of the
bulk of the straightforward parts.
2019-10-08 16:53:32 -07:00
Dan Gohman
c0b37bb713 Merge pull request #406 from sunfishcode/wabt-workaround
Improve the workaround for what is now wabt issue #59.
2019-10-07 10:21:13 -07:00
Dan Gohman
292323229c Improve the workaround for what is now wabt issue #59.
wabt's ScriptParser doesn't appear to handle paths containing
directories, so just use basenames for now.
2019-10-07 06:00:43 -07:00
Dan Gohman
53291a8497 Merge pull request #397 from sunfishcode/integrate-lightbeam
Integrate Lightbeam
2019-10-04 20:06:04 -07:00
Dan Gohman
6ef46e0497 Use the Lightbeam cargo feature. 2019-10-04 18:12:06 -07:00
Marcin Mielniczuk
692bb27209 Correct the clippy::use_self lint where possible. (#114) 2019-10-04 18:10:30 -07:00
Dan Gohman
fb2a89a1b1 Fix compilation error by bringing in Lightbeam. 2019-10-04 17:36:14 -07:00
Dan Gohman
5ccdf13b11 Rename --always-cranelift to --cranelift.
Also, enable use of Lightbeam in wasm2obj.
2019-10-04 17:02:31 -07:00
Dan Gohman
36756613b8 Merge remote-tracking branch 'origin/master' into integrate-lightbeam 2019-10-04 16:11:12 -07:00
Jakub Konka
daa3c3aeef Update wasi-common version 2019-10-03 23:59:18 +02:00
Jakub Konka
603f7a9f22 Misc testsuite feature gated (#113)
* Put misc_testsuite behind a feature gate

This PR puts building and generating of misc_testsuite behind
a feature gate "misc_testsuite". This is mainly to allow projects
which pull `wasi-common` as a dependency not to have to have
`wasm32-wasi` target installed in order to build it as it currently
is.

* Update the CI

* Rename feature to wasm_tests

* Explain integration testing in the README
2019-10-03 23:08:55 +02:00
Jakub Konka
da59c95f0c Update dependencies and use Once::new() instead of ONCE_INIT 2019-10-03 10:59:45 +02:00
dependabot-preview[bot]
6749015c26 Update target-lexicon requirement from 0.4.0 to 0.8.1
Updates the requirements on [target-lexicon](https://github.com/CraneStation/target-lexicon) to permit the latest version.
- [Release notes](https://github.com/CraneStation/target-lexicon/releases)
- [Commits](https://github.com/CraneStation/target-lexicon/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-10-03 10:03:59 +02:00
dependabot-preview[bot]
cf9cbbb519 Update cranelift-wasm requirement from 0.41.0 to 0.44.0
Updates the requirements on [cranelift-wasm](https://github.com/CraneStation/cranelift) to permit the latest version.
- [Release notes](https://github.com/CraneStation/cranelift/releases)
- [Commits](https://github.com/CraneStation/cranelift/compare/v0.41.0...v0.44.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-10-03 10:00:46 +02:00
dependabot-preview[bot]
c097f567a9 Update cranelift-native requirement from 0.41.0 to 0.44.0
Updates the requirements on [cranelift-native](https://github.com/CraneStation/cranelift) to permit the latest version.
- [Release notes](https://github.com/CraneStation/cranelift/releases)
- [Commits](https://github.com/CraneStation/cranelift/compare/v0.41.0...v0.44.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-10-03 09:58:19 +02:00
Jakub Konka
b4c60f0c36 Merge pull request #111 from CraneStation/dependabot/cargo/rand-0.7
Update rand requirement from 0.6 to 0.7
2019-10-03 09:54:18 +02:00
dependabot-preview[bot]
183611d796 Update rand requirement from 0.6 to 0.7
Updates the requirements on [rand](https://github.com/rust-random/rand) to permit the latest version.
- [Release notes](https://github.com/rust-random/rand/releases)
- [Changelog](https://github.com/rust-random/rand/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-random/rand/compare/0.6.0...0.7.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-10-03 07:53:58 +00:00
dependabot-preview[bot]
825ed4f4d4 Update cranelift-entity requirement from 0.41.0 to 0.44.0
Updates the requirements on [cranelift-entity](https://github.com/CraneStation/cranelift) to permit the latest version.
- [Release notes](https://github.com/CraneStation/cranelift/releases)
- [Commits](https://github.com/CraneStation/cranelift/compare/v0.41.0...v0.44.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-10-03 09:52:12 +02:00
Dan Gohman
1017cbbf63 Update the compile fuzzer for Lightbeam changes. 2019-10-02 14:27:21 -07:00
Dan Gohman
8d89c3b479 Add options to wasmtime and wasm2obj to pick compilation strategy. 2019-10-02 13:59:49 -07:00
Dan Gohman
d4353f03cb Don't check assert_trap tests when Lightbeam is enabled.
Lightbeam doesn't yet produce trap metadata, so it can't yet match the
expected `assert_trap` messages. Disable them for now.
2019-10-02 13:42:26 -07:00
Dan Gohman
7092499c10 Update wasmtime-rust for new API. 2019-10-02 12:52:44 -07:00
Dan Gohman
c43803b19c Update dependencies. 2019-10-02 12:32:31 -07:00
Dan Gohman
239f412616 Test Lightbeam. 2019-10-02 12:32:18 -07:00
Dan Gohman
5bf2fc0ffa Don't enable Lightbeam tests if Lightbeam isn't enabled. 2019-10-02 12:06:00 -07:00
Dan Gohman
65b8afabe6 Make use of Lightbeam configurable.
This adds a `--always-lightbeam` option as well as an `--always-cranelift`
option, to allow the compilation strategy to be selected via the
command-line. This also enables regular testing for Lightbeam.
2019-10-02 11:54:06 -07:00
Dan Gohman
8c524815c3 Update dependencies. 2019-10-02 11:00:28 -07:00
Dan Gohman
8d52e389f8 Update Lightbeam for various API changes. 2019-10-02 10:10:32 -07:00
Dan Gohman
9757f7194c Merge Lightbeam into Wasmtime. 2019-10-02 09:49:38 -07:00
Dan Gohman
4cf15bd8c4 Remove the Lightbeam submodule. 2019-10-02 09:48:05 -07:00
Dan Gohman
5832eff76f Merge remote-tracking branch 'yurydelendik-lightbeam/cranelift-32' 2019-10-02 09:45:54 -07:00
Dan Gohman
8298a7a8b5 Merge remote-tracking branch 'jlb6740-lightbeam/update_cranelift_cg_ver_44' 2019-10-02 09:44:35 -07:00
Dan Gohman
6e963b670e Delete .rustfmt.toml 2019-10-02 09:34:09 -07:00
Dan Gohman
25a7e00d50 Delete .gitignore 2019-10-02 09:33:58 -07:00
Dan Gohman
6d5937dee0 Move lightbeam into a subdirectory. 2019-10-02 09:26:36 -07:00
Peter Huene
cb38b48156 Fix memory leaks in extern conversion functions in C API. (#395)
This fixes the memory leaks in the following functions which should not be
returning "owned" pointers:

* `wasm_extern_as_func`
* `wasm_func_as_extern`
* `wasm_extern_as_global`
* `wasm_global_as_extern`
* `wasm_extern_as_memory`
* `wasm_extern_as_table`

Additionally, this commit implements the `wasm_memory_as_extern` and
`wasm_table_as_extern` functions.

Fixes #394.
2019-10-02 05:54:36 -07:00
Johnnie Birch
5096d7cf92 Updates Cranelift Codegen dependence to 0.44
In trying to build the lightbeam feature in wasmtime there are
compile errors mostly related to outdated or missing trait
definitions. This patch moves the current cranelift codegen
dependence to 0.44 in support of that, though other changes
are still needed in wasmtime to get the feature to build.
2019-10-01 08:45:19 -07:00
Dan Gohman
6b2f3ebf7c Begin sketching out a new high-level fs API. (#91)
* Begin sketching out a new high-level `fs` API.

This is a very preliminary sketch of #83. It doesn't even compile yet,
but it shows a possible high-level structure of such an API.

* Stub out more functionality.

* Switch from a lazy_static WasiCtx to a borrowed one.

* Reformat some comments.

* Code-quote `Self`.

* Implement error translation for Windows.

* Calls to `fd_close` are now unsafe.

* Implement a few more functions.
2019-09-30 11:27:53 -07:00
Dan Gohman
a679412dd0 Sync with lucet-wasi (#106)
* Open /dev/null for writing as well as reading.

Port this fix to wasi-common:

b905c44483

* Remove all remaining uses of `std::mem::uninitialized`.

Patch inspired by:

2d6519d051

* Replace libc::memcpy() calls with std::ptr::copy_nonoverlapping()

Port this fix to wasi-common:

a3f3a33e9b

* Pass `WasiError` by value.

It's a `u16` underneath, so we can pass it by value.

* Avoid unnecessary explicit lifetime parameters.

* Use immutable references rather than mutable references.

Patch inspired by:

54baa4c38c
2019-09-30 19:22:11 +02:00
Jean-Bapiste Lepesme
e1b9c01d94 Fix opt_level setting passed to cranelift
With 92a19e9398 the optimisation levels of cranelift were renamed, without this change trying to use the -o flag on wasmtime runtime results in "error: Unexpected value for a setting, expected any among none, speed, speed_and_size".

"best" was renamed "speed_and_size", although I think "speed" is more adapted to wastime.

Bye,
JB.
2019-09-30 09:38:00 -07:00
Peter Huene
406bc7895a Implement reading module table imports in API. (#387)
This commit implements populating the table imports of a module from the API.

It also allows for `anyref` in table types as per the reference types proposal.
2019-09-27 05:50:54 -07:00