Commit Graph

955 Commits

Author SHA1 Message Date
Pat Hickey
39f1c9716c restructure StringArrayWriter trait into StringArray struct 2020-09-02 14:11:32 -07:00
Pat Hickey
b63e974014 code review fixes 2020-09-02 13:39:32 -07:00
Pat Hickey
ddd50f7443 fix error report 2020-09-02 13:13:13 -07:00
Pat Hickey
7eb607b076 bugfix! 2020-09-02 10:55:27 -07:00
Pat Hickey
51d88f7899 wasi-common: move implementation of args, env methods into StringArrayWriter 2020-09-01 13:50:31 -07:00
Pat Hickey
6213a05c85 wiggle: add array indexing methods to GuestPtr<[T]> 2020-09-01 13:50:31 -07:00
Pat Hickey
87222d6db0 wasi-common: move GuestPtr deref out of path::get 2020-09-01 13:50:30 -07:00
Pat Hickey
20ccc11564 Merge pull request #2140 from bytecodealliance/pch/wasi_error_handling
wasi-common: refactor error types
2020-09-01 13:01:26 -07:00
Pat Hickey
c9ec60dcce Merge pull request #2169 from bytecodealliance/pch/fix_wasmtime_wiggle
wiggle-wasmtime: witx paths should be relative to CARGO_MANIFEST_DIR,…
2020-08-31 10:05:04 -07:00
MaxGraey
a8f7041296 new implementations for nearest lib calls
use approach with copysign for handling negative zero


format


refactor for better branch prediction


move copysign back to internal branch


format


fix


use abs instead branches


better comments


switch arms for better branch prediction
2020-08-31 09:39:20 -07:00
Pat Hickey
335886134c fix test 2020-08-28 17:11:11 -07:00
Pat Hickey
edefbf7c73 fix tests 2020-08-28 15:58:16 -07:00
Pat Hickey
22b427baa0 use WASI_ROOT env var to specify witx paths to wiggle macros 2020-08-28 15:42:51 -07:00
Pat Hickey
91dac9c7e8 wiggle: witx paths use shell expansion
instead of always being relative to CARGO_MANIFEST_DIR, each use site is
responsible for either putting that variable or another one (set by a
build.rs) at the start of witx paths.
2020-08-28 15:42:48 -07:00
Max de Danschutter
f1a5e55b98 Increase into-func to accept 16 arguments (#2170) 2020-08-28 10:39:48 -05:00
Pat Hickey
5c6ed0c736 wip - didnt have time to finish this before quittin time 2020-08-27 18:19:53 -07:00
Pat Hickey
4dabe3fad6 wasmtime-wasi: fix invocation of wasmtime_integration!
should use path relative to this crates's root
2020-08-27 16:12:20 -07:00
Pat Hickey
82d2a48896 wiggle-wasmtime: witx paths should be relative to CARGO_MANIFEST_DIR, not WASI_ROOT
the WASI_ROOT was leftover from when this code was part of `wig`.
2020-08-27 16:03:05 -07:00
Pat Hickey
393581b2ae Merge branch 'main' into pch/wasi_error_handling 2020-08-26 17:26:03 -07:00
Gabor Greif
2632848491 Relocation of DW_OP_{bra, skip} instructions (#2143)
The fundamental problem is that the target distance of jump-like operations may change in the DWARF expression translation process. Intervening DW_OP_deref will expand to about 10 bytes, for example.

So the jumps must be relocated. We approach this task by inserting artificial LandingPad markers (new CompiledExpressionParts constructors) into the parsed vector at actual Jump targets.

LandingPads are identified by JumpTargetMarker tokens which are generated on the fly.

Additionally we now parse the Jump instructions. These also get their corresponding JumpTargetMarker token.

We bail in two situations:

    frame_base is too complicated (i.e. itself contains Jump)
    some jump distance in the original expression is fishy.
2020-08-26 17:19:03 -05:00
Pat Hickey
7e750845cd Remove unnecessary check - fixed in std since Rust 1.38
issue now closed: https://github.com/rust-lang/rust/issues/63326
fix landed in a rollup: https://github.com/rust-lang/rust/pull/63380 merged aug 8, 2019
rust 1.38 beta cut on aug 15, 2019: https://blog.rust-lang.org/2019/08/15/Rust-1.37.0.html
minimum supported rust version for this repo is currently 1.41.
2020-08-25 17:27:47 -07:00
Pat Hickey
02aba548e1 Merge remote-tracking branch 'origin/main' into pch/wasi_error_handling 2020-08-25 15:22:51 -07:00
Pat Hickey
f54685d0bc Merge pull request #2139 from bytecodealliance/pch/wasi_common_tracing
wasi-common: switch all logs from `log` to `tracing`
2020-08-25 15:09:53 -07:00
Pat Hickey
5e0ca3c13b tracing: some windows fixes 2020-08-25 11:32:24 -07:00
Pat Hickey
930912f783 tracing fixes in unix poll; add some missing debug impls 2020-08-25 11:29:34 -07:00
Pat Hickey
963fe37eea Update crates/wasi-common/src/sys/windows/path.rs
Co-authored-by: iximeow <git@iximeow.net>
2020-08-25 11:17:08 -07:00
Pat Hickey
fceea4e7d2 Update crates/wasi-common/src/sys/unix/mod.rs
Co-authored-by: iximeow <git@iximeow.net>
2020-08-25 11:16:48 -07:00
Gabor Greif
ec87aee147 Revert #2137, the extra (seemingly leftover) DW_OP_deref is in fact essential (#2156)
* Revert "don't leave Deref bytecode for Code chunk (#2137)"

This reverts commit 30b9e69136.

* add explanation that DW_OP_deref is needed
2020-08-21 13:12:30 -05:00
Gabor Greif
6513e90914 use the obvious DW_OP_const4u for 0xffff_ffff (#2154)
No point in resorting to LEB128 encoding for such constants,
using the native `u32` is faster and more compact.

Adds `write_u32` method to facilitate this.
2020-08-21 08:16:09 -05:00
Johnnie Birch
0b67b22eda Update renamed document lint for broken links
Renames intra_doc_link_resolution_failure to broken_intra_doc_links
2020-08-20 14:24:06 -07:00
Alex Crichton
693c6ea771 wasmtime: Extract cranelift/lightbeam compilers to separate crates (#2117)
This commit extracts the two implementations of `Compiler` into two
separate crates, `wasmtime-cranelfit` and `wasmtime-lightbeam`. The
`wasmtime-jit` crate then depends on these two and instantiates them
appropriately. The goal here is to start reducing the weight of the
`wasmtime-environ` crate, which currently serves as a common set of
types between all `wasmtime-*` crates. Long-term I'd like to remove the
dependency on Cranelift from `wasmtime-environ`, but that's going to
take a lot more work.

In the meantime I figure it's a good way to get started by separating
out the lightbeam/cranelift function compilers from the
`wasmtime-environ` crate. We can continue to iterate on moving things
out in the future, too.
2020-08-20 11:34:31 +02:00
Pat Hickey
530ea50c82 wasi-common: dep on getrandom requires std 2020-08-19 15:10:04 -07:00
Pat Hickey
e8c01ddef1 put getrandom::Error into Error 2020-08-19 14:29:14 -07:00
bjorn3
b5e24c8c67 Update object to 0.21.1 (#2144) 2020-08-19 15:14:26 -05:00
Pat Hickey
c1aec81b84 add enough errno variants to cover all windows codes too 2020-08-19 12:03:38 -07:00
Pat Hickey
4535741d01 refactor when we translate io::Error to an Error
* a certain subset of io::Errors are expected - these we have
  a (platform-specific, because windows) method to translate into
  one of the wasi errno variants in the Error enum.
* some io::Errors are unexpected - wasi-common doesnt expect them from
  the underlying OS. rather than preserve any fidelity in reporting
  those to the user (only the unix impl attempts this), lets collect
  those as an `Error::UnexpectedIo(#[source] std::io::Error)`.
  Rather than trace at the conversion site, we rely on the wiggle error
  conversion hooks to trace the `Error`'s `Debug` impl, and then
  we convert all of these unexpected into `Errno::Io` for returning
  to the guest.

This is a different behavior from before, and I don't have any firm
guarantees that nobody was depending on the old behavior, but it
appears to me that none of those unexpected errnos were reasonable
to expect from any of the filesystem syscalls wasi-common is making.
2020-08-19 11:32:59 -07:00
Gabor Greif
4cafb90186 use opcode directly, now that we support this (#2145)
fixing also two typos with `DW_OP_fbreg`
2020-08-19 12:30:01 -05:00
Pat Hickey
9286bb8f08 hmm this code is challenging 2020-08-18 16:22:15 -07:00
Pat Hickey
e08173da9e fix windows: Error is not Copy like Errno is 2020-08-18 16:11:59 -07:00
Pat Hickey
94f904449b fix yanix 2020-08-18 16:02:53 -07:00
Pat Hickey
c4fbec6387 additional windows fix 2020-08-18 15:02:54 -07:00
Pat Hickey
73aef4c6ca guess i forgot a lot of these that dont build on linux 2020-08-18 15:01:04 -07:00
Pat Hickey
3bc1f84c9d windows: success fixes 2020-08-18 11:31:08 -07:00
Pat Hickey
80b884780b wasmtime-wasi: fix path to errno type 2020-08-18 10:57:43 -07:00
Pat Hickey
4be3b06b61 switch from log::debug to tracing::debug
this duplicates work done in #2139 on code that moves from
where the switch took place in that PR.
2020-08-18 10:55:42 -07:00
Pat Hickey
e8160c9a6b redefine crate to use Error everywhere except in wasi 2020-08-18 10:50:17 -07:00
Pat Hickey
b8409dd9aa wasi-common: define an Error type for the crate 2020-08-18 10:50:17 -07:00
Pat Hickey
19369142cb wasi-common: trace and convert error
this is a bug - the TODO was never resolved, even when the code to
implement it was added right below :)

tracing is already in the transitive deps via wiggle, so no extra
trouble there. tracing::debug is more appropriate than eprintln
2020-08-18 10:50:17 -07:00
Pat Hickey
0e1c534e07 wasi-common: fix some warnings 2020-08-18 10:46:14 -07:00
Pat Hickey
8d39d9b1b5 wasmtime-wasi: switch dep from log to tracing 2020-08-18 10:46:14 -07:00