Commit Graph

1460 Commits

Author SHA1 Message Date
Dan Gohman
23bafd1218 Split the runtime and execution code into separate crates. 2017-10-03 14:57:52 -07:00
Dan Gohman
6ded83332f Change the reloc sink to use vectors instead of hash maps. 2017-10-03 14:02:41 -07:00
Dan Gohman
412fedcc6d Fix reseting of the heap when compiling a module containing multiple functions. 2017-10-03 13:30:12 -07:00
Dan Gohman
31a962fa1b Support multiple globals. 2017-10-03 13:25:37 -07:00
Dan Gohman
865a3d9f31 Rename wasmstandalone::StandaloneRuntime to wasmstandalone::Runtime. 2017-10-03 13:01:31 -07:00
Dan Gohman
db88701eaa Use Self. 2017-10-03 12:54:35 -07:00
Dan Gohman
97b877bb9c Use Option::unwrap_or_else. 2017-10-03 12:53:28 -07:00
Dan Gohman
d4438f4006 Drop an unneeded dependency. 2017-10-03 12:48:33 -07:00
Dan Gohman
6c4bbc643c Set the faerie target based on the cretonne target. 2017-10-03 12:39:52 -07:00
Dan Gohman
a68b2619bd Sniff the wasm magic bytes, rather than relying on the filename extension. 2017-10-03 12:23:59 -07:00
Dan Gohman
e5ed1517ce Fix the command name in the usage message. 2017-10-03 12:21:09 -07:00
Dan Gohman
324a395a95 Make the "wat2wasm" error message not panic. 2017-10-03 12:20:37 -07:00
Dan Gohman
cad7e50106 Update to wasmparser 0.11.2. 2017-10-03 12:18:18 -07:00
Dan Gohman
5b0a083124 Avoid unnecessary BufReaders. 2017-10-03 06:56:23 -07:00
Dan Gohman
e64eb79aaf Fix dependency paths. wasmstandalone no longer depends on out-of-tree patches. 2017-09-23 15:38:38 -07:00
Dan Gohman
666d565fd4 Clean up unused imports. 2017-09-23 15:38:38 -07:00
Dan Gohman
0c78a2f298 Import the wasm2obj experiment and minimally update it. 2017-09-23 15:38:38 -07:00
Dan Gohman
06f0b00c2d Add an assert on an implemented feature rather than letting it silently fail. 2017-09-22 16:26:43 -07:00
Dan Gohman
64d596005c Reduce the extent of unsafe code. 2017-09-22 16:21:25 -07:00
Dan Gohman
ecd746718b Remove comments about manually saving callee-saved registers.
Even though Cretonne doesn't implement callee-saved registers yet,
it will, so we shouldn't need manual save/restore code when calling it.
2017-09-22 16:17:08 -07:00
Dan Gohman
4c5f584d01 Use debug_assert_eq! where applicable. 2017-09-22 16:13:04 -07:00
Dan Gohman
b583d75c7a Fix redundant borrows. 2017-09-22 16:11:11 -07:00
Dan Gohman
382415ed0c Fix a useless format!. 2017-09-22 16:09:10 -07:00
Dan Gohman
b89277d9ce Rename "wast" to "wat". 2017-09-22 15:57:32 -07:00
Dan Gohman
cdffc1b50a Roughly update for the recent Cretonne API changes.
Everything builds and simple modules run, though there's still lots more
to do.
2017-09-22 15:56:18 -07:00
Dan Gohman
b3a952ed67 Change the license to MIT/Apache-2.0. 2017-09-15 09:58:09 -07:00
Dan Gohman
73f5adb19d Clippy cleanups. 2017-09-06 09:56:14 -07:00
Dan Gohman
cb7e66d12a Fix missing documentation comment. 2017-09-06 09:19:34 -07:00
Dan Gohman
6c80e81c6c Remove trivial numeric casts. 2017-09-06 09:18:18 -07:00
Dan Gohman
54a3f1fcd4 Fix redundant qualification. 2017-09-06 08:59:10 -07:00
Dan Gohman
6c30cf8f00 Enable deny(missing_docs) in the wasmstandalone library. 2017-09-06 08:54:30 -07:00
Dan Gohman
3868467917 Format with rustfmt 0.9.0. 2017-09-06 08:37:12 -07:00
Dan Gohman
d0fe50a2a8 Check in the wasmstandalone code.
This is based on the code in https://github.com/denismerigoux/cretonne/commits/wasm2cretonne
before wasmstandalone was removed, with minor updates for the new library structure.
It is not yet updated for the latest cretonne API changes.
2017-09-05 17:06:51 -07:00
Dan Gohman
8f6957296e Merge commit '051bc08d23df0930be5e959645c50dd0cdf411d4' 2017-08-29 07:12:47 -07:00
Dan Gohman
344fbed77a Initial commit 2017-08-29 07:01:55 -07:00
Denis Merigoux
051bc08d23 Added description and license to Cargo.toml 2017-08-11 15:49:47 -07:00
Denis Merigoux
727f297ba9 Bugfix: wrong jump arguments for br_if to loops 2017-08-11 13:50:41 -07:00
Denis Merigoux
5fc61bd6f6 Added Fibonacci test case 2017-08-11 11:10:21 -07:00
Denis Merigoux
dfdab56a54 Integrated wasm test suite translation as cretonne test 2017-08-10 16:30:09 -07:00
Denis Merigoux
234e72a5b3 Dumped code from the wasm2cretonne repo 2017-08-10 16:05:04 -07:00
Jakob Stoklund Olesen
378e7cfe6b Switch branch relaxation to a FuncCursor. 2017-08-04 16:00:48 -07:00
Jakob Stoklund Olesen
6f024267c6 Add a FuncCursor type to the cursor library.
A FuncCursor works a like a layout cursor, but it holds a reference to
the entire function and lets you re-borrow the function reference.

Rewrite the dominator tree unit tests with a FuncCursor instead of a
layout cursor to demonstrate the difference. It avoids the constrained
lifetimes of the layout cursor in the tests.
2017-08-04 15:31:08 -07:00
Jakob Stoklund Olesen
8b2f5c418b Use EncCursor for reload.rs.
Same deal as for spilling. Place an EncCursor in the context and use
that to reference into the IR function when necessary.
2017-08-04 15:02:46 -07:00
Jakob Stoklund Olesen
3eb80fde15 Use EncCursor in regalloc/spilling.rs
Use an EncCursor instead of a layout cursor to keep track of the
current position in the function. Since the EncCursor holds a reference
to the whole IR function insteadof just the layout, we can rework how IR
borrowing works.

The Context data structure that's live during the spilling pass now owns
an EncCursor which in turn holds references to the function and ISA.
This means that we no longer need to pass around references to parts of
the ir::Function. We can no longer borrow any part of the IR function
across a context method call, but that turns out to be not necessary.
2017-08-04 14:13:56 -07:00
Jakob Stoklund Olesen
0ab1976231 Cursor library.
Add a new cursor module and define an EncCursor data type in it. An
EncCursor is a cursor that inserts instructions with a valid encoding
for the ISA. This is useful for passes generating code after
legalization.

Implement a builder interface via the new InstInserterBase trait such
that the EncCursor builders support with_result().

Use EncCursor in coalescing.rs instead of the layout cursor as a proof
of concept.
2017-08-04 14:05:14 -07:00
Jakob Stoklund Olesen
ff39458f96 Reorganize the instruction builder traits.
Leave the primary InstBuilderBase trait alone, but add an alternative
InstInserterBase trait that can be implemented instead by builders that
always allocate new instructions with dfg.make_inst().

Any implementation of InstInserterBase can be used as an instruction
builder by wrapping it in an InsertBuilder. The InsertBuilder type adds
additional functionality via the with_results() method which makes it
possible to override the result values on the instruction that is built.

The motivation for this shuffle is that the with_result() functionality
can now be reused by different kinds of instruction builders, as long as
they insert new instructions. So ReplaceBuilder doesn't get
with_results().
2017-08-04 11:56:03 -07:00
Jakob Stoklund Olesen
019e5dd894 Add CursorBase builder methods.
The CursorBase::at_* are convenience methods for building a cursor that
points to a specific instruction.
2017-08-04 09:08:24 -07:00
Jakob Stoklund Olesen
78db5b3715 Move most Cursor methods into a CursorBase trait.
The Cursor navigation methods all just depend on the cursor's position
and layout reference. Make a CursorBase trait that provides access to
this information with methods and implement the navigation methods on
top of that.

This makes it possible to have multiple types implement the cursor
interface.
2017-08-04 09:08:24 -07:00
Jakob Stoklund Olesen
81ff9bac72 Avoid evaluating dbg!() arguments in a closure.
The dbg!() macro should behave like a function call in how it evaluates
its arguments, and captures by Rust closures are not fully compatible
with path-specific borrowing. Specifically:

    let borrow = &mut obj.foo;
    dbg!("{}", obj.bar);

would fail because the closure inside dbg!() would borrow all of obj
instead of just obj.foo.

Fix this by using the format_args!() macro to evaluate the dbg!()
arguments and produce an fmt::Arguments object which can be safely
passed to the thread-local closure for printing.

The arguments are still evaluated inside an if { .. } which
constant-folds away in release builds.
2017-08-04 08:54:00 -07:00
Denis Merigoux
e0fd5252d5 Added partial recompute of dominator tree in case of Ebb splitting (#135)
* Partial recompute for dominator tree in case of ebb splitting
Implemented via striding in RPO numbers
2017-08-03 18:26:41 -07:00