Commit Graph

2437 Commits

Author SHA1 Message Date
Dan Gohman
0653ae2c9c Fix compilation errors. 2019-09-26 19:37:23 -07:00
Dan Gohman
7899784663 Replace println error handling.
Use `panic!` and log macros for error handling instead of `println!`.
2019-09-26 19:37:23 -07:00
Dan Gohman
053fb3433e Fix compilation error. 2019-09-26 17:22:41 -07:00
Dan Gohman
34766f64ea Recognize "wasi_unstable_preview0" in addition to "wasi_unstable". 2019-09-26 17:22:41 -07:00
Andrew Brown
0667a2897d Ignore simd_const test when glibc has a floating point parsing issue 2019-09-26 15:46:18 -07:00
Andrew Brown
68de2247bc Avoid errors when converting V128 for the wasm-c-api
For this to work the wasm-c-api must add support for the V128 type (e.g. through __uint128_t)
2019-09-26 15:46:18 -07:00
Andrew Brown
03a9f0e461 Run SIMD const spec test 2019-09-26 15:46:18 -07:00
Andrew Brown
ce8e8662ff Enable SIMD in WAST testsuites 2019-09-26 15:46:18 -07:00
Andrew Brown
bb244d52d5 Pass enabled features (e.g. --enable-simd) on to WABT when running WAST files 2019-09-26 15:46:18 -07:00
Andrew Brown
fb1c473342 Alter invocation of functions to use 16-byte invocation arguments 2019-09-26 15:46:18 -07:00
Andrew Brown
5bd422b429 Add V128 type 2019-09-26 15:46:18 -07:00
Andrew Brown
290b51a5f6 Update wabt and spec test suite
Update wabt (see issue in https://github.com/pepyakin/wabt-rs/pull/56). Due to changes in wabt, the spec tests are updated as well.
2019-09-26 15:46:18 -07:00
Sergey Pepyakin
58e3e65bc8 Update lightbeam to rustfmt-ed revision 2019-09-26 15:44:47 -07:00
Dan Gohman
86142f2e94 Use r# to escape strings which may be rust keywords. (#379)
This is a minor simplification, replacing a hardcoded list of keywords.
2019-09-26 13:44:43 -07:00
Artur Jamro
bbd7e91d1c Reformat code with new rustfmt (#28) 2019-09-26 22:30:20 +02:00
Peter Huene
4288f33440 Fix borrow scope for store in WrappedCallable impl for WasmtimeFn.
This PR fixes the borrow scope of store in the `WrappedCallable` impl of
`WasmTimeFn` such that it does not remain borrowed across the call to
`wasmtime_call_trampoline`. By limiting the scope of the borrow, the
implementation can be reentered if an exported function calls an imported
function, which in turn calls another exported function.

Fixes #365.
2019-09-26 12:55:58 -07:00
Dan Gohman
a666e14279 Temporarily switch to the rustfmt branch of lightbeam.
This is branched from master to apply rustfmt, as a temporary measure to
fix the CI.
2019-09-26 12:45:29 -07:00
Dan Gohman
10845134f7 Update to latest walrus, wasmparser, and wasm-webidl-bindings. 2019-09-26 12:34:58 -07:00
Peter Huene
622a630acd Implement wasm_module_imports. (#384)
This commit implements `wasm_module_imports` and a few related APIs so that
import information can be read about a module.
2019-09-26 13:57:33 -05:00
Artur Jamro
286d2515f9 Check trap code in test suite assertions 2019-09-26 11:43:41 -07:00
Yury Delendik
b0fe01397b Use HOST call convension in Func signature (#383) 2019-09-26 13:10:41 -05:00
Dan Gohman
f6f2995275 Update to the latest spec_testsuite.
This pulls in the fix in https://github.com/WebAssembly/spec/pull/1076.
2019-09-25 22:07:48 -07:00
dependabot-preview[bot]
340cb3dcf5 Update wasmparser requirement from 0.38.0 to 0.39.1
Updates the requirements on [wasmparser](https://github.com/yurydelendik/wasmparser.rs) to permit the latest version.
- [Release notes](https://github.com/yurydelendik/wasmparser.rs/releases)
- [Commits](https://github.com/yurydelendik/wasmparser.rs/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-09-25 21:27:30 -07:00
Paul Jackson
ab8707223c clarify posix_fallocate vs fd_allocate in docs 2019-09-25 21:21:57 -07:00
Yury Delendik
b41e918ec3 [wasmtime-api] Fixes wasm_exporttype_type leak 2019-09-25 21:19:34 -07:00
Dan Gohman
e2efa6318b Remove feature(alloc) declarations which are no longer needed. 2019-09-25 17:57:25 -07:00
Artur Jamro
fa9175f9e5 Trap registry 2019-09-25 17:56:08 -07:00
Artur Jamro
d1706117e5 Enable cache system by default 2019-09-25 16:48:18 -07:00
Artur Jamro
512b1196fd Cache worker tests 2019-09-25 14:41:14 -07:00
Jakub Konka
d33036a3b5 Fix path_rename on *nix hosts
The fix contains an errno remapping in macOS case where in case
when we try to rename a file into a path with a trailing slash an
ENOENT is returned. In this case, if the destination does not exist,
an ENOTDIR should be thrown as is thrown correctly on Linux hosts.
Thus, as a fix, if an ENOENT is thrown, an additional check is
performed to see whether the destination path indeed contains
a trailing slash, and if so, the errno is adjusted to ENOTDIR
to match the POSIX/WASI spec.
2019-09-25 22:20:39 +02:00
Artur Jamro
134bf467e7 Update cranelift to 0.44.0 2019-09-25 13:04:10 -07:00
Nick Fitzgerald
1848cc0868 deps: Update cranelift-* to 0.43.1 2019-09-25 13:04:10 -07:00
Artur Jamro
dde1c6ba58 Cache configuration documentation 2019-09-23 16:03:28 -07:00
Artur Jamro
1c22211d57 Refactor cache configuration 2019-09-23 12:48:36 -07:00
Marius Wachtler
c3a519d3a1 wasm2obj: add -O / --optimize command line option 2019-09-23 12:46:52 -07:00
Mark Bestavros
bd613ecafd Utilize cranelift-codegen's new all-arch feature to maintain architecture support 2019-09-19 10:39:41 -07:00
Artur Jamro
acd6a5ea58 Fix crash when cache disabled 2019-09-18 16:51:44 -07:00
Artur Jamro
febb0cb693 Cache worker 2019-09-18 16:43:27 -07:00
Yury Delendik
9c747db429 Make data() unsafe 2019-09-18 09:15:14 -07:00
Yury Delendik
6a41417b52 Add examples; refactor HostRef 2019-09-18 09:15:14 -07:00
Jakub Konka
90f1cd5c96 Fix path_remove_directory on *nixes 2019-09-17 23:22:43 +02:00
Dan Gohman
30a4f73cce Mark public API functions as unsafe. (#90)
* Mark public API functions as unsafe.

This marks the public hostcalls functions as unsafe.

This is generalizing from Rust's `from_raw_fd` function, which is
unsafe. The observation is that nothing prevents code using this
function from passing a bogus or stale dangling file descriptor and
corrupting an arbitrary open stream.

Technically, some of these functions don't use file descriptors, such as
random, clocks, and a few others. However I expect that in the future,
random and clocks will switch to using file descriptors anyway, and it
keeps the macro definitions simpler if we only have to handle one form.

* Mark WasiCtx functions that operate on file descriptors unsafe too.

* `fd_filestat_set_times_impl` doesn't need to be unsafe.

* Remove unnecessary unsafes
2019-09-16 15:55:35 -07:00
Jakub Konka
fec5b7ab0a Refactor mgmt of misc testsuite (#101)
Changes:
* use [tempfile] crate for auto mgmt of temp dirs
* use concrete types in place of generics in `utils` module

[tempfile]: https://github.com/Stebalien/tempfile
2019-09-16 15:35:14 -07:00
Jakub Konka
dfeae067cc Sync with wasmtime and update public interface
Internal modules `memory` and `host` can indeed be internal hidden
behind public-private visibility as `wasmtime-wasi` has already
been updated not to use the said modules (see
CraneStation/wasmtime#298).
2019-09-16 15:30:20 -07:00
Dan Gohman
febecc418c Make functions that operate on raw I/O handles unsafe.
Functions which trust that their arguments are valid raw file descriptors
or raw handles should be marked unsafe, because these arguments are
passed unchecked to I/O routines.
2019-09-14 21:46:38 +02:00
Jakub Konka
c98b3d10ec Fix fd_readdir on BSD-style nixes (#81)
* Fix fd_readdir on BSD-style nixes

The fix was tested on Darwin-XNU and FreeBSD. The change introduces
thread-safe cache of (RawFd, *mut libc::DIR) pairs so that
libc::fdopendir syscall is called only once when invoking fd_readdir
for the first time, and then the pointer to the directory stream,
*mut libc::DIR, is reused until the matching raw file descriptor
is closed.

This fix allows then correct use (and matching to the implementation
on Linux kernels) of libc::seekdir and libc::rewinddir to seek through
and rewind the existing directory stream, *mut libc::DIR, which
otherwise seems to be reset/invalidated every time libc::fdopendir
is called (unlike on Linux, where this behaviour is not observed).

* Store dir stream as part of the FdEntry's Descriptor

* Move bsd specifics into separate module

* Add todo comments and fix formatting

* Refactor int conversions

* Emphasise in debug logs that we're looking at fd_readdir entry

* Change visibility of FdEntry and related to public-private

* Rewrite creating DirStream for the first time
2019-09-14 21:01:39 +02:00
Jakub Konka
500e32a3b2 Use fcntl with F_RDADVISE on MacOS 2019-09-14 08:12:49 +02:00
Marcin Mielniczuk
8d7e80f440 Refactor error handling in fd_advise 2019-09-13 14:38:17 +02:00
Marcin Mielniczuk
86e3d3e307 Fix a typo in fd_advise 2019-09-13 14:38:17 +02:00
Jakub Konka
f22a468f91 Add fd_advise smoke test 2019-09-13 12:19:34 +02:00