Commit Graph

434 Commits

Author SHA1 Message Date
Artur Jamro
165dc4944d Simple module compilation cache (#203)
* Simple module compilation cache

* Fix base64 encoding bug

* Use warn! everywhere in cache system

* Remove unused import

* Temporary workaround for long path on Windows

* Remove unused import for non-windows builds

* Add command line argument to enable cache system + apply minor review feedback
2019-07-25 16:16:10 -07:00
Dan Gohman
17e4528648 Downgrade wabt from 0.8 to 0.7. (#219)
Even though this somehow passed on Travis on [the
PR](https://github.com/CraneStation/wasmtime/pull/209), it fails on
Travis on master, and I can reproduce the failure.

The failure is on spec_testsuite/names.wast:

```
$ RUST_BACKTRACE=1 target/debug/wast spec_testsuite/names.wast
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: FromUtf8Error { bytes: [255], error: Utf8Error { valid_up_to: 0, error_len: Some(1) } }', src/libcore/result.rs:999:5
stack backtrace:
[...]
   9: core::result::Result<T,E>::unwrap
             at /rustc/a53f9df32fbb0b5f4382caaad8f1a46f36ea887c/src/libcore/result.rs:800
  10: wabt::script::jstring_to_rstring
             at [...]/.cargo/registry/src/github.com-1ecc6299db9ec823/wabt-0.8.0/src/script/mod.rs:261
  11: wabt::script::parse_action
             at [...]/.cargo/registry/src/github.com-1ecc6299db9ec823/wabt-0.8.0/src/script/mod.rs:274
  12: wabt::script::ScriptParser<F32,F64>::next
             at [...]/.cargo/registry/src/github.com-1ecc6299db9ec823/wabt-0.8.0/src/script/mod.rs:504
  13: wasmtime_wast::wast::WastContext::run_buffer
             at wasmtime-wast/src/wast.rs:202
  14: wasmtime_wast::wast::WastContext::run_file
             at wasmtime-wast/src/wast.rs:472
  15: wast::main
             at src/wast.rs:107
[...]
```
2019-07-24 14:49:04 -07:00
Artur Jamro
794841b366 Properly initialize file_per_thread_logger for rayon thread pool (#211)
* Properly initialize file_per_thread_logger for rayon thread pool
2019-07-23 14:53:48 -07:00
Stefan Junker
1aff03a5b4 dependencies: pin wasi-common to specific rev
This removes the reliance on having a correct version of wasi-common in
the cache by chance ;-)
2019-07-23 13:24:32 -07:00
dependabot-preview[bot]
f5746290cb Update wabt requirement from 0.7 to 0.8
Updates the requirements on [wabt](https://github.com/pepyakin/wabt-rs) to permit the latest version.
- [Release notes](https://github.com/pepyakin/wabt-rs/releases)
- [Commits](https://github.com/pepyakin/wabt-rs/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-07-23 11:04:26 -07:00
Jakub Konka
667f272edd Rewrite majority of impl reusing libstd (#34)
* Rewrite FdEntry reusing as much libstd as possible

* Use the new FdEntry, FdObject, Descriptor struct in *nix impl

* Adapt Windows impl

* Remove unnecessary check in fd_read

Check `host_nread == 0` caused premature FdEntry closure and removal
which ultimately was resulting in an attempt at "double closing" of
the same file descriptor at the end of the Wasm program:
...
fd_close(fd=4)
    -> errno=WASI_ESUCCESS
fd_close(fd=4)
    -> errno=WASI_EBADF

* Use libstd vectored IO

* Use std:🧵:yield_now to implement sched_yield

* Add logging to integration tests

* Add preliminary support for host-specific errors

* Operate on std::fs::File in path_get on *nix

* Add cross-platform RawString type encapsulating OsStrExt

* Fix Windows build

* Update Travis and README to Rust v1.36

* Remove unused winx::handle::close helper

* Refactor Descriptor into raw handles/fds

* Strip readlinkat in prep for path_get host-independent

* Strip openat in prep for path_get host-independent

* Move ManuallyDrop up one level from Descriptor to FdObject

* Make (c)iovec host fns unsafe

* Swap unwraps/expects for Results in fdentry_impl on nix

* Rewrite fd_pread/write and implement for Win

* Use File::sync_all to impl fd_sync

* Use File::sync_data to impl fd_datasync

* Rewind file cursor after fd_p{read, write} on Windows

* Add fd_p{read, write} tests

* Handle errors instead of panicking in path_get

* Use File::set_len to impl fd_allocate

* Add test for fd_allocate

* Replace all panics with Results

* Document the point of RawString
2019-07-15 15:34:28 -07:00
Jakub Konka
93e1657bae Update cranelift 2019-07-05 16:51:54 +02:00
Dan Gohman
1a10f4a002 Update to Cranelift 1.33 and require Rust 1.35.
Cranelift requires Rust 1.35; update accordingly.
2019-07-03 11:16:55 -07:00
Yury Delendik
fb9d6061e4 Update cranelift, faerie, target-lexicon and wasmparser deps 2019-07-02 14:07:30 -07:00
Jakub Konka
7287767a3f Add enough Windows functionality to run WASI tutorial (#22)
* Add partial impl of determine_type_rights fn

* Add draft of fd_fdstat_get hostcall

* Add writev wrapper for writing IoVec in RawHandle

* Move IoVec and writev to separate helper crate

* Add Win error handling

Clean up closing and duplicating RawHandle

* Wrap Win file type result

* Add draft impl of fd_close and fd_read

* Refactor getting file access rights

* Remove winapi from the main Cargo.toml

* Add very rough draft of open_path (very incomplete)

* Clean up WinError with macro

* Ignore dir handle in openat if path absolute

* Decode oflags and advance open_path hostcall

* Clean up AccessRight and FlagsAndAttributes flags

* Implement path_get (without symlink expansion yet!)

* Add ShareMode and fix path_get for nested paths

* Add some error mappings between Win and WASI

* Clean up fdflags conversions

* Fix sharing violation when calling openat at '.'

* Apply Alex's fix of using ManuallyDrop instead forget

* Clean up

* Explicitly specify workspace to avoid comp errors at tests
2019-06-27 17:10:15 -07:00
Jakub Konka
22c69f46f9 Use build.rs to generate test cases automatically
Now, test binaries are bundled with the repo, and
just like in CraneStation/wasmtime, the test cases
are generated automatically using build.rs. So all
it takes is to drop a new test binary in the
testsuite dir to get the test case for it generated
(with some caveats to do with handling preopens).
2019-06-26 15:24:21 -07:00
Jakub Konka
656112d00b Patch wasmtime-wasi to use this wasi-common version 2019-06-26 15:24:21 -07:00
Jakub Konka
982dbab1f2 Add misc-tests as a submodule dep 2019-06-26 15:24:21 -07:00
Jakub Konka
6ca01ce546 Add wasmtime as default runtime for integration tests 2019-06-26 15:24:21 -07:00
Dan Gohman
c0ba4753eb Enable wasi-common by default (#177)
This removes the --wasi-common, as it's now on by default, and adds a
--wasi-c option to enable the wasi-c implementation.
2019-06-25 02:05:49 -07:00
Jakub Konka
513429f1b8 Port trace log from wasmtime-wasi-c crate 2019-06-24 22:47:41 +02:00
Jakub Konka
ce8912abf3 Use preopen_dir handlers exposed in wasi-common 2019-06-19 07:12:00 -07:00
Jakub Konka
e530a582af Fix preopening dirs on Windows 2019-06-03 13:23:07 -07:00
Dan Gohman
635be8a032 Make the wasmtime-wasi-c dependency conditional on Unix. 2019-06-03 13:23:07 -07:00
Dan Gohman
06b6ec42b9 Provide the C WASI implementation as an option.
This adds the C WASI implementation as a new crate, wasmtime-wasi-c,
and adds a command-line flag to the wasmtime command-line driver to
select which WASI implementation to use.
2019-06-03 13:23:07 -07:00
Dan Gohman
9a66400cd8 Use try_from instead of the cast crate.
`try_from` is newly stable in the standard library starting in Rust 1.34.
2019-05-31 21:09:43 +02:00
Jakub Konka
7605584691 Move *nix specific implementation to separate module 2019-05-24 11:02:03 -07:00
Dan Gohman
6b2eee21b9 Update the description of Cargo.toml. 2019-05-18 21:01:14 -07:00
Dan Gohman
eb2b51353e Rename the top-level crate from wasmtime-tools to wasmtime.
This is a binary application crate which contains the wasmtime
command-line application.
2019-05-18 20:25:08 -07:00
Jakub Konka
e552b19dfe Add placeholder for cbindgen proc_macro_attribute 2019-05-15 13:57:06 -07:00
Jakub Konka
19a4f00752 Set up CI, add format and test scripts.
Remove unused Cargo dependencies.
2019-05-08 07:39:54 +02:00
Jakub Konka
2587fa0145 Port WASI host types 2019-05-07 21:44:16 +02:00
Jakub Konka
cd39c1dfd8 Extract common interface from lucet-wasi 2019-05-04 18:20:21 +02:00
Jef
9bf6d73210 Integrate Lightbeam (#51)
* Integrate lightbeam
2019-04-05 12:42:54 -07:00
Dan Gohman
b2fefe7714 WASI prototype design, implementation, and documentation.
This adds documents describing the WASI Core API, and an implementation in
Wasmtime.
2019-03-27 10:58:43 -07:00
Yury Delendik
2353be95e6 update cranelift deps to 0.30.0 2019-03-27 02:24:51 -07:00
Yury Delendik
94ca967d0a Update faerie to 0.9.1 2019-03-27 02:24:51 -07:00
Dan Gohman
db0abe8431 Move the wasmtime crate directories form lib/* to wasmtime-*.
This follows a similar change to Cranelift made here:

https://github.com/CraneStation/cranelift/pull/660
2019-03-20 11:30:28 -07:00
Yury Delendik
7b9761f4a2 Update cranelift dependencies to 0.29.0 (#59) 2019-03-06 18:55:24 -08:00
Yury Delendik
ddbc00752e Generate debug info for LLDB/GDB (#50)
* Transform DWARF sections into native format for wasm2obj and wasmtime.

Generate DWARF sections based on WASM DWARF.
Ignore some of debug_info/debug_line for dead code.

* Fix test
2019-03-06 16:03:32 -08:00
Dan Gohman
2ac0ceda14 Update to faerie 0.7.1. 2019-02-21 20:28:15 -08:00
Yury Delendik
e66f01b923 Update cranelift libraries to 0.28.0 2019-01-29 16:45:41 -08:00
Dan Gohman
f6c2fe7d2d Update to Rust 2018 Edition. 2019-01-03 12:58:11 -08:00
Dan Gohman
7592c99f3b Refactor the compilation and instantiation pipeline.
wasmtime-execute is now wasmtime-jit. Move `JITCode` and the TargetIsa
into a new `Compiler` type. `InstancePlus` is no more, with trampoline
functionality now handled by `Compiler`.
2019-01-03 11:47:55 -08:00
Dan Gohman
4d4ecfd812 Bump version to 0.1.0 2018-12-17 13:45:12 -08:00
Dan Gohman
3f24098edc Implement the remaining valid spec tests.
And lots of other miscellaneous changes. Rename InstanceWorld to
InstancePlus and reorganize its contents. This still isn't a great name,
but at least now it has a clear purpose.
2018-12-12 11:49:02 -08:00
Dan Gohman
6dd39dee6a Update to Cranelift 0.26.0. 2018-12-11 13:21:03 -08:00
Dan Gohman
56850d481d Initial support for function, table, memory, and global imports. 2018-12-11 12:49:14 -08:00
Dan Gohman
6198b89110 Update to pretty_env_logger 0.3.0. 2018-12-06 23:02:57 -05:00
Dan Gohman
7faa15d7ac More infrastructure.
Improve handling of memory.grow/size, add a standalone wast runner,
test harness improvements.
2018-12-05 02:25:34 -05:00
Dan Gohman
83f8a31010 Convert the wast test harness into a crate.
This uses a build.rs file to collect all the wast tests and create
individual `#[test]` lines for them, so that `cargo test` can run them
in parallel.
2018-12-05 02:25:34 -05:00
Dan Gohman
099f85f821 Rename main.rs to wasmtime.rs. 2018-12-05 02:25:34 -05:00
Dan Gohman
f44fe25f9c Rewrite linear memory handling in terms of simple mmap/VirtualAlloc.
The memmap crate doesn't make it straightforward to have part of the
region be writeable and part readonly. Since this is a fairly boutique
use case, and we don't need all that much code, just use the low-level
APIs directly.

Also, introduce a concept of "tunables" for adjusting the parameters of
the runtime.
2018-12-05 02:25:34 -05:00
Frank Rehberger
ec940ee8af Migrating to wabt::wat2wasm (#29)
* Add test_environ_translate

* Migrating to wabt::wat2wasm
2018-11-30 10:44:44 -06:00
Dan Gohman
b3d831015c Add basic logging support to the wasmtime binary. 2018-11-29 15:38:12 -08:00