Commit Graph

1795 Commits

Author SHA1 Message Date
Pat Hickey
220509f3ed latest system-interface 2021-01-27 12:17:42 -08:00
Alex Crichton
503129ad91 Add a method to share Config across machines (#2608)
With `Module::{serialize,deserialize}` it should be possible to share
wasmtime modules across machines or CPUs. Serialization, however, embeds
a hash of all configuration values, including cranelift compilation
settings. By default wasmtime's selection of the native ISA would enable
ISA flags according to CPU features available on the host, but the same
CPU features may not be available across two machines.

This commit adds a `Config::cranelift_clear_cpu_flags` method which
allows clearing the target-specific ISA flags that are automatically
inferred by default for the native CPU. Options can then be
incrementally built back up as-desired with teh `cranelift_other_flag`
method.
2021-01-26 15:59:12 -06:00
Pat Hickey
8cd21eed23 elaborate 2021-01-26 12:27:07 -08:00
Pat Hickey
1eb8a8a7fe integrate GetSetFdFlags!
change reopen_with_fdflags(&self, fdflags) -> Result<Box<dyn WasiFile>>
to set_fdflags(&mut self, fdflags) -> Result<()>.

this makes way more sense than my prior hare-brained schemes.
2021-01-26 12:23:52 -08:00
Pat Hickey
c98d6f6201 fix warning 2021-01-26 12:18:39 -08:00
Nick Fitzgerald
e594c43d50 Merge pull request #2606 from fitzgen/memory-stuff
wasmtime: clarify `Memory::{read,write}` behavior with out-of-bounds ranges
2021-01-26 11:57:42 -08:00
Pat Hickey
f4a6b95965 notes 2021-01-26 11:45:26 -08:00
Nick Fitzgerald
ee5c6f6265 Merge pull request #2599 from fitzgen/bench-api-files-env-vars
bench-api: Allow access to files in the current directory
2021-01-26 10:35:03 -08:00
Nick Fitzgerald
4f3bc1d5d4 wasmtime: clarify Memory::{read,write} behavior with out-of-bounds ranges
This documents that we will never do partial reads/writes, and expands our
existing tests to assert this.
2021-01-26 10:27:21 -08:00
Nick Fitzgerald
0cdc80fbf8 wasmtime: move Memory to its own module
Purely code motion and fixing up imports.
2021-01-26 10:04:48 -08:00
Nick Fitzgerald
3b7f3e0c23 Remove semicolon to quiet a rustc warning 2021-01-26 09:43:53 -08:00
Nick Fitzgerald
8d84482153 bench-api: Allow access to files in the current directory
And pass through the `WASM_BENCH_USE_SMALL_WORKLOAD` env var.

Part of https://github.com/bytecodealliance/sightglass/issues/70
2021-01-26 09:43:53 -08:00
Nick Fitzgerald
c7c6e76f9b fuzzing: Add tests for dummy import generation (#2604) 2021-01-26 09:11:24 -06:00
theduke
f4faa04dca Safe Memory read/write API (#2528)
This commit introduces two new methods on `Memory` that enable
reading and writing memory contents without requiring `unsafe`.

The methods return a new `MemoryError` if the memory access
fails.
2021-01-26 09:09:20 -06:00
Pat Hickey
17f43d4cc3 path_link test: we no longer support symlink following
just assert that setting the symlink following lookupflag gives an
ERRNO_INVAL.
2021-01-25 17:15:32 -08:00
Pat Hickey
fded424e68 Dir::hard_link: dont support symlink following
if we're asked to follow symlinks, give ERRNO_INVAL instead.
2021-01-25 17:08:02 -08:00
Pat Hickey
a993090e30 fix warning 2021-01-25 17:07:39 -08:00
Pat Hickey
42ccb11f15 cap-std is going to use winerror::ERROR_STOPPED_ON_SYMLINK
to communicate eloop on windows
2021-01-25 17:02:11 -08:00
Pat Hickey
8f4fecacdc interesting paths: loosen up errno requirements 2021-01-25 15:28:01 -08:00
Pat Hickey
b0b263f68e find a symlink error 2021-01-25 15:20:46 -08:00
Pat Hickey
996d49c81f nofollow test: permit ACCES as well as LOOP when opening with nofollow 2021-01-25 15:20:35 -08:00
Pat Hickey
144ca2f535 add a test of symlink happy path to isolate the windows failure 2021-01-25 15:14:26 -08:00
Pat Hickey
a8426125d2 kick the can 2021-01-25 14:56:58 -08:00
Pat Hickey
72b207de2e path_link: some improvements required by windows
* need to close the handle to the subdirectory before its legal to
  delete it
* windows doesnt give us a way to distinguish between an ERRNO_PERM and
  an ERRNO_ACCES, so lets accept either one
2021-01-25 14:35:02 -08:00
Pat Hickey
2c6bde5ee4 elaborate! 2021-01-25 12:54:13 -08:00
Pat Hickey
7fd3d58b23 enumerate windows test failures, move the file 2021-01-25 12:20:10 -08:00
Pat Hickey
17a82c5b88 table: fix up errnos. trap on internal failures. 2021-01-25 12:16:07 -08:00
Pat Hickey
957c434b67 ErrorExt: trap convenience method 2021-01-25 12:16:01 -08:00
Pat Hickey
634e911a4b tests: directory seeking is actually prohibited! but the test was wrong
* path_open of a directory without OFLAGS_DIRECTORY worked on linux,
  but fortunately not on windows!
* the errno is BADF instead of NOTCAPABLE for fd_seek on a directory
* no way for a directory to have the FD_SEEK right.
2021-01-25 12:13:02 -08:00
Frank Denis
a0fad6065a Add support for the experimental wasi-crypto APIs (#2597)
* Add support for the experimental wasi-crypto APIs

The sole purpose of the implementation is to allow bindings and
application developers to test the proposed APIs.

Rust and AssemblyScript bindings are also available as examples.

Like `wasi-nn`, it is currently disabled by default, and requires
the `wasi-crypto` feature flag to be compiled in.

* Rename the wasi-crypto/spec submodule

* Add a path dependency into the submodule for wasi-crypto

* Tell the publish script to vendor wasi-crypto
2021-01-25 09:32:58 -06:00
Pat Hickey
2b70ea8b91 windows scheduler passes tests
unfortunately this does essentially nothing to convince me of its
correctness
2021-01-22 18:26:45 -08:00
Chris Fallin
95822a54f2 Merge pull request #2565 from cfallin/debug-value-labels
Detailed debug-info (DWARF) support in new backends (initially x64).
2021-01-22 17:22:13 -08:00
Chris Fallin
f54d0d05c7 Address review comments. 2021-01-22 16:02:29 -08:00
Pat Hickey
19254bfd72 error mapping for windows! 2021-01-22 15:44:32 -08:00
Pat Hickey
423973a8ea push the error types conversion all the way through 2021-01-22 15:29:09 -08:00
Pat Hickey
1d8070b734 wasi-c2: completely redo how errors work 2021-01-22 15:03:16 -08:00
Pat Hickey
a06c4fbe1a make a pipe filetype, reorder filetype enum 2021-01-22 11:37:39 -08:00
Alex Crichton
55b0e8b9e5 Fix C API function name of setting max instances (#2598)
Forgot the trailing `_set` at the end...
2021-01-22 09:55:28 -06:00
Pat Hickey
86d369c72a inline poll from yanix 2021-01-21 18:17:49 -08:00
Pat Hickey
9e0d295f8c use unsafe to mark reopen_with_fdflags as having special safety features 2021-01-21 18:08:15 -08:00
Pat Hickey
69b7352332 various stdio fixes 2021-01-21 17:57:12 -08:00
Pat Hickey
f1a5dce716 change set_fdflags to reopen_with_fdflags 2021-01-21 17:56:03 -08:00
Pat Hickey
a46c2ad0aa split poll tests up, only one requires "real" stdio 2021-01-21 16:54:40 -08:00
Pat Hickey
12056885eb fix preopen dir to work on windows 2021-01-21 16:08:49 -08:00
Chris Fallin
c84d6be6f4 Detailed debug-info (DWARF) support in new backends (initially x64).
This PR propagates "value labels" all the way from CLIF to DWARF
metadata on the emitted machine code. The key idea is as follows:

- Translate value-label metadata on the input into "value_label"
  pseudo-instructions when lowering into VCode. These
  pseudo-instructions take a register as input, denote a value label,
  and semantically are like a "move into value label" -- i.e., they
  update the current value (as seen by debugging tools) of the given
  local. These pseudo-instructions emit no machine code.

- Perform a dataflow analysis *at the machine-code level*, tracking
  value-labels that propagate into registers and into [SP+constant]
  stack storage. This is a forward dataflow fixpoint analysis where each
  storage location can contain a *set* of value labels, and each value
  label can reside in a *set* of storage locations. (Meet function is
  pairwise intersection by storage location.)

  This analysis traces value labels symbolically through loads and
  stores and reg-to-reg moves, so it will naturally handle spills and
  reloads without knowing anything special about them.

- When this analysis converges, we have, at each machine-code offset, a
  mapping from value labels to some number of storage locations; for
  each offset for each label, we choose the best location (prefer
  registers). Note that we can choose any location, as the symbolic
  dataflow analysis is sound and guarantees that the value at the
  value_label instruction propagates to all of the named locations.

- Then we can convert this mapping into a format that the DWARF
  generation code (wasmtime's debug crate) can use.

This PR also adds the new-backend variant to the gdb tests on CI.
2021-01-21 15:59:49 -08:00
Pat Hickey
16b42a5707 fix 2021-01-21 14:14:05 -08:00
Pat Hickey
85c3b73b4e stdio compiles on windows! 2021-01-21 13:51:18 -08:00
Alex Crichton
4a351ab7fe Update a number of dependencies (#2594)
This commit goes through the dependencies that wasmtime has and updates
versions where possible. This notably brings in a wasmparser/wast update
which has some simd spec changes with new instructions. Otherwise most
of these are just routine updates.
2021-01-21 15:49:13 -06:00
Alex Crichton
57c686d49d Refactor instantiation to be more async-friendly (#2596)
Instantiation right now uses a recursive `instantiate` function since it
was relatively easy to write that way, but this is unfortunately not
factored in a way friendly to the async implementation in #2434. This
commit refactors the function to instead use an iterative loop and
refactors code in such a way that it should be easy to rebase #2434 on
top of this change. The main goal is to make the body of `Instance::new`
as small as possible since it needs to be duplicated with
`Instance::new_async`.
2021-01-21 15:04:17 -06:00
Pat Hickey
fcd00f5de1 move more deps to cap-std-sync, define own SystemTimeSpec 2021-01-21 12:35:55 -08:00