Commit Graph

6471 Commits

Author SHA1 Message Date
Emiliano Lesende
59ee430431 fix(tagged-union): rebase and squash
fix(tagged-union): changed test programs to use new tagged union
generated code

fix(tagged-union): changed test programs to use new tagged union generated code

fix(tagged-union): removed local dependency and changed to point to 0.9.1 version of wasi

fix(tagged-union): added newline to gitignore, changed wasi version to 0.10.0

fix(tagged-union): removed gitignore as Cargo.lock is intentional
2020-06-03 19:07:02 -03:00
Hiroki Noda
8701645493 Fix comment for running example fib-debug (#1814) 2020-06-03 16:17:48 -05:00
Chris Fallin
5078e4eba2 Merge pull request #1774 from cfallin/aarch64-multivalue
Multi-value return support on aarch64/Wasmtime.
2020-06-03 14:14:38 -07:00
Chris Fallin
fe97659813 Address review comments. 2020-06-03 13:31:34 -07:00
Chris Fallin
615362068f Multi-value return support. 2020-06-03 13:31:34 -07:00
Chris Fallin
34eb170232 Merge pull request #1811 from cfallin/fix-warning
Fix build warnings (errors on CI) due to mmap flag rename and deprecation.
2020-06-03 13:26:36 -07:00
Yury Delendik
1f86bcfb27 freeze gimli 2020-06-03 12:47:01 -07:00
Pat Hickey
6910c1e03d use tracing 0.1.15 release 2020-06-03 10:54:52 -07:00
Pat Hickey
220733b974 wiggle-generate: add an empty constructor to ErrorTransform
some library users (me, in lucet-wasi) may not care about ErrorTransform YET
2020-06-03 10:54:34 -07:00
Pat Hickey
dcb774a35e temporarily use tracing from git 2020-06-03 10:54:34 -07:00
Pat Hickey
1b95b24686 show env_logger working in wiggle tracing example 2020-06-03 10:54:17 -07:00
Pat Hickey
33a94ca7d5 just one cargo feature for tracing/log 2020-06-03 10:54:17 -07:00
Pat Hickey
820b283cf8 can't put tracing behind a feature without an extra crate :( 2020-06-03 10:54:17 -07:00
Pat Hickey
02c0c68ed2 replace all uses of log with tracing 2020-06-03 10:53:55 -07:00
Pat Hickey
f89fc0ac57 wiggle: can swap in tracing for args 2020-06-03 10:53:32 -07:00
Pat Hickey
994104d615 wiggle: add config options for logging 2020-06-03 10:53:32 -07:00
Chris Fallin
b8e31d7c8e Fix build warnings (errors on CI) due to mmap flag rename and deprecation. 2020-06-03 09:48:22 -07:00
Dan Gohman
a76639c6fb Wasmtime 0.17.0 and Cranelift 0.64.0. (#1805) 2020-06-02 18:51:59 -07:00
Yury Delendik
15c68f2cc1 Disconnects Store state fields from Compiler (#1761)
*  Moves CodeMemory, VMInterrupts and SignatureRegistry from Compiler
*  CompiledModule holds CodeMemory and GdbJitImageRegistration
*  Store keeps track of its JIT code
*  Makes "jit_int.rs" stuff Send+Sync
*  Adds the threads example.
2020-06-02 13:44:39 -05:00
Dan Gohman
b41330393d Add more notes to RELEASES.md. (#1799) 2020-06-02 10:53:07 -07:00
Nick Fitzgerald
2a75f6de21 Merge pull request #1781 from fitzgen/externref
Initial, partial support for `externref`
2020-06-02 09:47:49 -07:00
Pat Hickey
547ce3d68b Merge pull request #1790 from bytecodealliance/pch/wiggle_error_transforms
wiggle: allow user-configurable error transformations
2020-06-02 09:38:38 -07:00
Chris Fallin
9fec933056 Merge pull request #1801 from jgouly/cmp-rebase
arm64: add support for I8X16 ICmp
2020-06-02 09:35:41 -07:00
Joey Gouly
90a421193f arm64: add support for I8X16 ICmp
Copyright (c) 2020, Arm Limited.
2020-06-02 16:58:09 +01:00
Benjamin Bouvier
67c7a3ed19 mach backend: reduce the size of the Inst enum down to 32 bytes; 2020-06-02 16:29:05 +02:00
Benjamin Bouvier
e227608510 mach backend: use vectors instead of sets to remember set of uses/defs for calls;
This avoids the set uniqueness (hashing) test, reduces memory
churn when re-mapping virtual register onto real registers, and is
generally more memory-efficient.
2020-06-02 16:29:05 +02:00
Benjamin Bouvier
cfa0527794 mach backend: have mem_finalize return a SmallVec;
This avoids a spurious reallocation of the SmallVec containing the
load_constants result to a Vec, which appeared in dhat profiles.
2020-06-02 16:29:05 +02:00
teapotd
1acbad089a [bugpoint] Resolve aliases after reduction 2020-06-01 17:13:05 -07:00
teapotd
b3763223ab [bugpoint] Convert more types to constants 2020-06-01 17:13:05 -07:00
teapotd
e0d7f1a91b [bugpoint] Try to move instructions to the entry block 2020-06-01 17:13:05 -07:00
Nick Fitzgerald
58b08b9d3a Move HostRef<T> into the C API crate
It isn't used by anything except for the C API and all of our embedder-exposed
APIs are already internally `Rc`-based, so it doesn't make sense to use with
them.
2020-06-01 15:09:51 -07:00
Nick Fitzgerald
8adae5d1ad Create a simple Debug implementation for Store 2020-06-01 15:09:51 -07:00
Nick Fitzgerald
2bb6a82794 Remove the ExternRef::null constructor
Shorter and clearer to just use `None`.
2020-06-01 15:09:51 -07:00
Nick Fitzgerald
d5bdce99c7 Remove executable bit from Rust source files 2020-06-01 15:09:51 -07:00
Nick Fitzgerald
652f47495a wasmtime: Make Func::store a public method 2020-06-01 15:09:51 -07:00
Nick Fitzgerald
b78eafcfd3 externref: Do not impl common traits, have free functions instead
If you aren't expecting `VMExternRef`'s pointer-equality semantics, then these
trait implementations can be foot guns. Instead of implementing the trait, make
free functions in the `VMExternRef` namespace. This way, callers have to be a
little more explicit.
2020-06-01 15:09:51 -07:00
Nick Fitzgerald
98da9ee8a9 Use std::alloc::handle_alloc_failure instead of home-rolled version 2020-06-01 15:09:51 -07:00
Nick Fitzgerald
25548d7fbe externref: Share more Layout-computing code 2020-06-01 15:09:51 -07:00
Nick Fitzgerald
a8ee0554a9 wasmtime: Initial, partial support for externref
This is enough to get an `externref -> externref` identity function
passing.

However, `externref`s that are dropped by compiled Wasm code are (safely)
leaked. Follow up work will leverage cranelift's stack maps to resolve this
issue.
2020-06-01 15:09:51 -07:00
Nick Fitzgerald
137e182750 Update wasmparser to 0.57.0 2020-06-01 14:53:10 -07:00
Nick Fitzgerald
acf8ad0df7 cranelift_wasm: expose the original Wasm function signature
In the `ModuleEnvironment::declare_signature` callback, also pass the original
Wasm function signature, so that consumers may associate this information with
each compiled function. This is often necessary because while each Wasm
signature gets compiled down into a single native signature, multiple Wasm
signatures might compile down into the same native signature, and in these cases
the original Wasm signature is required for dynamic type checking of calls.
2020-06-01 14:53:10 -07:00
Nick Fitzgerald
38a92d89de Initialize env_logger for our *.wast tests 2020-06-01 14:53:10 -07:00
Nick Fitzgerald
1898d52966 runtime: Introduce VMExternRef and VMExternData
`VMExternRef` is a reference-counted box for any kind of data that is
external and opaque to running Wasm. Sometimes it might hold a Wasmtime
thing, other times it might hold something from a Wasmtime embedder and is
opaque even to us. It is morally equivalent to `Rc<dyn Any>` in Rust, but
additionally always fits in a pointer-sized word. `VMExternRef` is
non-nullable, but `Option<VMExternRef>` is a null pointer.

The one part of `VMExternRef` that can't ever be opaque to us is the
reference count. Even when we don't know what's inside an `VMExternRef`, we
need to be able to manipulate its reference count as we add and remove
references to it. And we need to do this from compiled Wasm code, so it must
be `repr(C)`!

`VMExternRef` itself is just a pointer to an `VMExternData`, which holds the
opaque, boxed value, its reference count, and its vtable pointer.

The `VMExternData` struct is *preceded* by the dynamically-sized value boxed
up and referenced by one or more `VMExternRef`s:

```ignore
     ,-------------------------------------------------------.
     |                                                       |
     V                                                       |
    +----------------------------+-----------+-----------+   |
    | dynamically-sized value... | ref_count | value_ptr |---'
    +----------------------------+-----------+-----------+
                                 | VMExternData          |
                                 +-----------------------+
                                  ^
+-------------+                   |
| VMExternRef |-------------------+
+-------------+                   |
                                  |
+-------------+                   |
| VMExternRef |-------------------+
+-------------+                   |
                                  |
  ...                            ===
                                  |
+-------------+                   |
| VMExternRef |-------------------'
+-------------+
```

The `value_ptr` member always points backwards to the start of the
dynamically-sized value (which is also the start of the heap allocation for
this value-and-`VMExternData` pair). Because it is a `dyn` pointer, it is
fat, and also points to the value's `Any` vtable.

The boxed value and the `VMExternRef` footer are held a single heap
allocation. The layout described above is used to make satisfying the
value's alignment easy: we just need to ensure that the heap allocation used
to hold everything satisfies its alignment. It also ensures that we don't
need a ton of excess padding between the `VMExternData` and the value for
values with large alignment.
2020-06-01 14:53:10 -07:00
Nick Fitzgerald
01a92aef95 cranelift_wasm: Use the TableIndex type instead of raw u32
About half of the `FuncEnvironment::translate_table_*` methods were using the
`TableIndex` newtype, while the other half were using raw `u32`s. This commit
makes everything use `TableIndex`.
2020-06-01 14:53:10 -07:00
Nick Fitzgerald
7c68a10ed6 Merge pull request #1670 from teapotd/win64-pass-by-ref
Implement passing arguments by ref for win64 ABI
2020-06-01 11:13:30 -07:00
Pat Hickey
de7ff38fea add a second case for multiple error mappings 2020-05-30 14:06:48 -07:00
Pat Hickey
9085fc9f75 error conversion code: update test to actually execute it 2020-05-30 13:50:02 -07:00
Pat Hickey
1d2a1c4744 Merge remote-tracking branch 'origin/master' into pch/wiggle_error_transforms 2020-05-30 13:20:30 -07:00
Pat Hickey
c32c2e8272 Merge pull request #1793 from katie-martin-fastly/ktm/beep-beep-keywords-to-the-jeep
💖 wiggle: escape rust keywords, allow witx literals
2020-05-30 13:10:59 -07:00
Pat Hickey
614723ab7e Update crates/wiggle/generate/src/names.rs 2020-05-30 13:10:47 -07:00