Commit Graph

9307 Commits

Author SHA1 Message Date
Pat Hickey
efef0769fe make uffd test compile, but not pass 2021-10-22 08:39:00 -07:00
Michael Chesser
da51fae4c3 Rename executable to already_protected 2021-10-22 13:44:47 +01:00
Michael Chesser
61ecccf306 Avoid updating memory protection on allocations that have the right protection. 2021-10-22 13:44:47 +01:00
Pat Hickey
0370d5c1a2 code review suggestion 2021-10-21 16:46:31 -07:00
Pat Hickey
175e72bac4 test that the catch unwind works 2021-10-21 16:43:13 -07:00
Pat Hickey
3fd674c6bc async memory_grow_failed can have a default impl
idk why this didnt work in the old factoring! but im glad it does
2021-10-21 16:38:46 -07:00
Pat Hickey
758abe3963 add table limiting tests 2021-10-21 16:23:54 -07:00
Pat Hickey
538c19589b build out async versions of the existing limiter tests 2021-10-21 15:21:05 -07:00
Pat Hickey
a1301f8dae add table_grow_failed 2021-10-21 15:07:40 -07:00
Pat Hickey
c0a1af94cf fix trap behavior 2021-10-21 15:07:32 -07:00
Pat Hickey
351a51cce6 docs 2021-10-21 14:28:40 -07:00
Pat Hickey
252ba39c27 implement table _async methods, test passes now 2021-10-21 14:15:53 -07:00
Chris Fallin
54896ac86d Merge pull request #3469 from cfallin/machbuffer-quadratic-labels
Avoid quadratic behavior in pathological label-alias case in MachBuffer.
2021-10-21 13:37:40 -07:00
Pat Hickey
5aef8f47c8 catch panic in libcalls for memory and table grow 2021-10-21 12:15:00 -07:00
Pat Hickey
d3deaae99d collapse some common code 2021-10-21 12:10:03 -07:00
Pat Hickey
6c70b81ff5 review feedback 2021-10-21 12:10:03 -07:00
Pat Hickey
abbe28d833 propogate changes to use anyhow::Error instead of Box<dyn Error...> 2021-10-21 12:10:03 -07:00
Pat Hickey
a5007f318f runtime: use anyhow::Error instead of Box<dyn std::error::Error...> 2021-10-21 12:10:03 -07:00
Pat Hickey
2225722373 Memory::new_async, grow_async now work! 2021-10-21 12:10:03 -07:00
Pat Hickey
adf7521e30 introduce a failing test 2021-10-21 12:10:03 -07:00
Pat Hickey
67a6c27e22 pooling needs the store earlier 2021-10-21 12:10:03 -07:00
Pat Hickey
9d1b24632e fix 2021-10-21 12:10:03 -07:00
Pat Hickey
147c8f8ed7 rename 2021-10-21 12:10:03 -07:00
Pat Hickey
18a355e092 give sychronous ResourceLimiter an async alternative 2021-10-21 12:10:03 -07:00
Chris Fallin
472b1b2e8a Avoid quadratic behavior in pathological label-alias case in MachBuffer.
Fixes #3468.

If a program has many instances of the pattern "goto next; next:" in a
row (i.e., no-op branches to the fallthrough address), the branch
simplification in `MachBuffer` would remove them all, as expected.
However, in order to work correctly, the algorithm needs to track all
labels that alias the current buffer tail, so that they can be adjusted
later if another branch chomp occurs.

When many thousands of this branch-to-next pattern occur, many thousands
of labels will reference the current buffer tail, and this list of
thousands of labels will be shuffled between the branch metadata struct
and the "labels at tail" struct as branches are appended and then
chomped immediately.

It's possible that with smarter data structure design, we could somehow
share the list of labels -- e.g., a single array of all labels, in order
they are bound, with ranges of indices in this array used to represent
lists of labels (actually, that seems like a better design in general);
but let's leave that to future optimization work.

For now, we can avoid the quadratic behavior by just "giving up" if the
list is too long; it's always valid to not optimize a branch. It is very
unlikely that the "normal" case will have more than 100 "goto next"
branches in a row, so this should not have any perf impact; if it does,
we will leave 1 out of every 100 such branches un-optimized in a long
sequence of thousands.

This takes total compilation time down on my machine from ~300ms to
~72ms for the `foo.wasm` case in #3441. For reference, the old backend
(now removed), built from arbitrarily-chosen-1-year-old commit
`c7fcc344`, takes 158ms, so we're ~twice as fast, which is what I would
expect.
2021-10-21 12:07:39 -07:00
Chris Fallin
e04357505e Merge pull request #3466 from cfallin/regalloc-0.0.32
Update to regalloc.rs 0.0.32.
2021-10-20 16:07:14 -07:00
Chris Fallin
e9921574d7 Update to regalloc.rs 0.0.32.
It appears that some allocation heuristics have changed slightly since
0.0.31, so some of the golden-output filetests are updated as well.
Ideally we would rely more on runtests rather than golden-compilation
tests; but for now this is sufficient. (I'm not sure exactly what in
regalloc.rs changed to alter these heuristics; it's actually been almost
a year since the 0.0.31 release with several refactorings and tweaks
merged since then.)

Fixes #3441.
2021-10-20 15:28:42 -07:00
Adam Bratschi-Kaye
afd10646c9 List exports of an instance in linking error (#3456)
When there is a linking error caused by an undefined instance, list all
the instances exports in the error message. This will clarify errors for
undefined two-level imports that get desugared to one-level instance
imports under the module-linking proposal.
2021-10-20 16:31:53 -05:00
Alex Crichton
fb585fde40 Update the wast crate dependency (#3464)
Pulls in a few minor fixes for stack overflows with module linking as
well as some updates to other various wasm proposals.
2021-10-20 11:25:52 -05:00
Alex Crichton
e2a724ce18 Update the object crate to 0.27.0 (#3465)
Mostly just keeping us up to date with changes there since we somewhat
heavily rely on it now.
2021-10-20 10:52:06 -05:00
Alex Crichton
fe4b15c8b0 Checkout submodules in cargo audit CI (#3463)
This should help address the failure that happened last night.

https://github.com/bytecodealliance/wasmtime/actions/runs/1361422923
2021-10-20 10:45:53 -05:00
Alex Crichton
e8d3b8e3ea Fix an off-by-two condition in heap legalization (#3462)
This commit fixes an issue in Cranelift where legalization of
`heap_addr` instructions (used by wasm to represent heap accesses) could
be off-by-two where loads that should be valid were actually treated as
invalid. The bug here happened in an optimization where tests against
odd constants were being altered to tests against even constants by
subtracting one from the limit instead of adding one to the limit. The
comment around this area has been updated in accordance with a little
more math-stuff as well to help future readers.
2021-10-19 13:19:20 -05:00
Alex Crichton
b553d84362 Change how security advisories work on CI (#3461)
Before this commit we actually have two builders checking for security
advisories on CI, one is `cargo audit` and one is `cargo deny`. The
`cargo deny` builder is slightly different in that it checks a few other
things about our dependency tree such as licenses, duplicates, etc. This
commit removes the advisory check from `cargo deny` on CI and then moves
the `cargo audit` check to a separate workflow.

The `cargo audit` check will now run nightly and will open an issue on
the Wasmtime repository when an advisory is found. This should help make
it such that our CI is never broken by the publication of an advisory
but we're still promptly notified whenever an advisory is made. I've
updated the release process notes to indicate that the open issues
should be double-checked to ensure that there are no open advisories
that we need to take care of.
2021-10-19 10:12:36 -05:00
Chris Fallin
13feef7bb8 Merge pull request #3459 from bytecodealliance/fitzgen-patch-1
Add ISLE item for next cranelift meeting
2021-10-18 10:57:40 -07:00
Nick Fitzgerald
707c9018ca Add ISLE item for next cranelift meeting 2021-10-18 10:47:03 -07:00
Alex Crichton
a52bc0f9ed Add 2021-10-18 Cranelift meeting notes (#3458)
* Add 2021-10-18 Cranelift meeting notes

* Update cranelift-10-18.md
2021-10-18 12:16:12 -05:00
Chris Fallin
3ba9e5865a Merge pull request #3455 from bytecodealliance/fitzgen-patch-1
Add an update on ISLE integration to the next cranelift meeting
2021-10-15 13:49:40 -07:00
Nick Fitzgerald
e80e34b76e Add an update on ISLE integration to the next cranelift meeting 2021-10-15 13:48:09 -07:00
Alex Crichton
1a5fa3ed3f Enable stable wasm features for spectest fuzzing (#3454)
These are now required for the general suite of spec tests we're running
by default.
2021-10-15 10:40:42 -05:00
Nathan Froyd
35cdd53989 fix typo in stability-platform-support.md 2021-10-14 12:19:29 -04:00
Chris Fallin
d5a02e86e4 Merge pull request #3453 from cfallin/wasmtime-mtg-20211028
Wasmtime meetings: move Wasm EH to Oct 28; note no agenda for Oct 14 meeting minutes.
2021-10-14 09:08:56 -07:00
Chris Fallin
892eefcf09 Wasmtime meetings: move Wasm EH to Oct 28; note no agenda for Oct 14 meeting minutes. 2021-10-14 09:07:40 -07:00
Alex Crichton
9c6884e28d Update the spec reference testsuite submodule (#3450)
* Update the spec reference testsuite submodule

This commit brings in recent updates to the spec test suite. Most of the
changes here were already fixed in `wasmparser` with some tweaks to
esoteric modules, but Wasmtime also gets a bug fix where where import
matching for the size of tables/memories is based on the current runtime
size of the table/memory rather than the original type of the
table/memory. This means that during type matching the actual value is
consulted for its size rather than using the minimum size listed in its
type.

* Fix now-missing directories in build script
2021-10-13 16:14:12 -05:00
Chris Fallin
14cde24377 Merge pull request #3447 from bjorn3/remove_unused_inst_flags
Remove various unused things from the meta crate
2021-10-13 11:31:31 -07:00
Shinobu Hayashi
59a9bd6285 Chore fix typo in docs/contributing-architecture.md (#3449) 2021-10-13 09:56:56 -05:00
Pat Hickey
6a970d096e Merge pull request #3446 from bjorn3/remove_old_insts
Remove many unused instructions
2021-10-13 07:46:44 -07:00
Nick Fitzgerald
d377b665c6 Initial ISLE integration with the x64 backend
On the build side, this commit introduces two things:

1. The automatic generation of various ISLE definitions for working with
CLIF. Specifically, it generates extern type definitions for clif opcodes and
the clif instruction data `enum`, as well as extractors for matching each clif
instructions. This happens inside the `cranelift-codegen-meta` crate.

2. The compilation of ISLE DSL sources to Rust code, that can be included in the
main `cranelift-codegen` compilation.

Next, this commit introduces the integration glue code required to get
ISLE-generated Rust code hooked up in clif-to-x64 lowering. When lowering a clif
instruction, we first try to use the ISLE code path. If it succeeds, then we are
done lowering this instruction. If it fails, then we proceed along the existing
hand-written code path for lowering.

Finally, this commit ports many lowering rules over from hand-written,
open-coded Rust to ISLE.

In the process of supporting ISLE, this commit also makes the x64 `Inst` capable
of expressing SSA by supporting 3-operand forms for all of the existing
instructions that only have a 2-operand form encoding:

    dst = src1 op src2

Rather than only the typical x86-64 2-operand form:

    dst = dst op src

This allows `MachInst` to be in SSA form, since `dst` and `src1` are
disentangled.

("3-operand" and "2-operand" are a little bit of a misnomer since not all
operations are binary operations, but we do the same thing for, e.g., unary
operations by disentangling the sole operand from the result.)

There are two motivations for this change:

1. To allow ISLE lowering code to have value-equivalence semantics. We want ISLE
   lowering to translate a CLIF expression that evaluates to some value into a
   `MachInst` expression that evaluates to the same value. We want both the
   lowering itself and the resulting `MachInst` to be pure and referentially
   transparent. This is both a nice paradigm for compiler writers that are
   authoring and maintaining lowering rules and is a prerequisite to any sort of
   formal verification of our lowering rules in the future.

2. Better align `MachInst` with `regalloc2`'s API, which requires that the input
   be in SSA form.
2021-10-12 17:11:58 -07:00
Chris Fallin
f227699536 Make ISLE part of the root Cargo workspace. 2021-11-11 16:00:12 -08:00
Nick Fitzgerald
4c61c96c3f Add Cargo.toml metadata 2021-11-11 15:56:55 -08:00
Nick Fitzgerald
e23564700d Add myself as a second author 2021-11-11 15:56:55 -08:00