Commit Graph

295 Commits

Author SHA1 Message Date
Dan Gohman
14dfc0d1b6 Bump version to 0.23.0. 2018-11-07 16:18:04 -08:00
Dan Gohman
38e8667f97 Adjust whitespace to match the upstream exception text.
This is a whitespace-only change.
2018-11-07 16:07:51 -08:00
Dan Gohman
b476f823d4 Update to target_lexicon 0.2.0. 2018-11-07 16:01:15 -08:00
Dan Gohman
5ea6c57b95 Update to the new wasmparser and port to the new readers API.
The new wasmparser API provides dedicated reader types for each section
type, which significantly simplifies the code.

This also changes WasmError::from_binary_reader_error into a From
trait so that we don't have to do .map_err(from_binary_reader_error)
throughout the code.
2018-11-06 15:54:17 -08:00
Dan Gohman
9e084dbadc Update to wabt 0.7.0. 2018-11-06 13:24:45 -08:00
Dan Gohman
3ff8867e57 Split the default edge of a br_table.
When splitting critical edges for a br_table to handle arguments being
passed, split the default edge along with the normal table edges.
2018-11-06 15:53:05 +01:00
Dan Gohman
d4f8eb7453 Introduce a TargetFrontendConfig type. (#570)
* Introduce a `TargetFrontendConfig` type.

`TargetFrontendConfig` is information specific to the target which is
provided to frontends to allow them to produce Cranelift IR for the
target. Currently this includes the pointer size and the default calling
convention.

The default calling convention is now inferred from the target, rather
than being a setting. cranelift-native is now just a provider of target
information, rather than also being a provider of settings, which gives
it a clearer role.

And instead of having cranelift-frontend routines require the whole
`TargetIsa`, just require the `TargetFrontendConfig`, and add a way to
get the `TargetFrontendConfig` from a `Module`.

Fixes #529.
Fixes #555.
2018-11-02 13:51:42 -07:00
Dan Gohman
2de5542139 Make FuncEnvironment::return_mode() default to NormalReturns.
`NormalReturns` is what we expect most users will normally want.
2018-10-29 15:37:08 +01:00
Dan Gohman
bf569b70dc Make cranelift-wasm's type_to_type easier to optimize. 2018-10-26 11:24:43 -07:00
Boris-Chengbiao Zhou
b288c6001a Fix all clippy warnings (#564)
* Fix all clippy warnings

* Revert usage of inclusive ranges

* Remove redundant function argument

* Revert use of unavailable pointer methods

* Introduce ContiguousCaseRange
2018-10-22 21:52:35 -07:00
Lachlan Sneff
586a8835e9 Add a readonly flag for loads (#562)
* Add readonly MemFlag

* Add readonly flag verifier check

* Make global loads readonly

* Fix gvn to consider readonly loads
2018-10-22 21:50:09 -07:00
Dan Gohman
8cd1b87917 Rename parse_elements_section.
In WebAssembly documentation, it's the "element" section.
2018-10-19 10:59:32 -07:00
oooooba
709eed21c1 Use types to represent wasm global/table/memory/signature indices (#560)
* Use a type to represent wasm table indices.

* Use a type to represent wasm global variable indices.

* Use a type to represent wasm memory indices.

* Use a type to represent wasm signature indices.

* Use PrimaryMap instead of Vec to protect against using wrong indices.
2018-10-19 10:49:41 -07:00
Dan Gohman
7f90414ae1 Update no_std support. 2018-10-05 17:18:40 -07:00
Dan Gohman
bf041e3ae2 Move return_at_end out of Settings and into the wasm FuncEnvironment. (#547)
* Move `return_at_end` out of Settings and into the wasm FuncEnvironment.

The `return_at_end` flag supports users that want to append a custom
epilogue to Cranelift-produced functions. It arranges for functions to
always return via a single return statement at the end, and users are
expected to remove this return to append their code.

This patch makes two changes:
 - First, introduce a `fallthrough_return` instruction and use that
   instead of adding a `return` at the end. That's simpler than having
   users remove the `return` themselves.

 - Second, move this setting out of the Settings and into the wasm
   FuncEnvironment. This flag isn't something the code generator uses,
   it's something that the wasm translator uses. The code generator
   needs to preserve the property, however we can give the
   `fallthrough_return` instruction properties to ensure this as needed,
   such as marking it non-cloneable.
2018-10-05 06:43:22 -07:00
Dan Gohman
ddf8fd23b5 Remove obsolete TODO comments. 2018-10-03 13:09:44 -07:00
Tyler McMullen
79cea5e18b Implement jump tables (#453)
* Add 'jump_table_entry' and 'indirect_jump' instructions.

* Update CodeSink to keep track of code size. Pretty up clif-util's disassembly output.

* Only disassemble the machine portion of output. Pretty print the read-only data after it.

* Update switch frontend code to use new br_table instruction w/ default.
2018-10-03 10:04:21 -07:00
Benjamin Bouvier
0b3d3ac880 Remove logging levels restrictions (#538)
* Fixes #537: Remove release mode logging levels restrictions;

* Add information about log's logging levels in the README;
2018-10-02 10:45:23 -07:00
Dan Gohman
e8fc612dc2 Update to wasmparser 0.19.0. 2018-09-28 16:56:04 -07:00
Sergey Pepyakin
2a7cc7e644 Bump wabt version to 0.6. 2018-09-23 16:35:33 -07:00
Dan Gohman
ab99720959 Bump version to 0.22.0 2018-09-21 21:39:41 -07:00
Dan Gohman
53a0c6c67f Update to the rustfmt in rust 1.29, which is now stable. 2018-09-13 12:59:25 -07:00
Dan Gohman
d0f703a6ff Fix the type of table bounds in DummyEnvironment.
Also, fix the wasm testsuite harness to run the verifier with a
TargetIsa so that it catches problems like this.
2018-09-12 14:40:20 -07:00
Dan Gohman
b4c7451ae5 Bump version to 0.21.1 2018-09-10 10:00:45 -07:00
Dan Gohman
e8878ba504 Bump version to 0.21.0 2018-09-04 22:04:22 -07:00
Dan Gohman
d4b8622393 Rename the VOID type to INVALID and clean up obsolete comments.
The VOID type isn't used for anything resembling what "void" means in C,
so rename it to INVALID to avoid confusion.
2018-09-04 21:46:22 -07:00
Dan Gohman
ca9da7702e Reorganize the global value kinds. (#490)
* Reorganize the global value kinds.

This:
 - renames "deref" global values to "load" and gives it a offset that works
   like the "load" instructions' does
 - adds an explicit "iadd_imm" global value kind, which replaces the
   builtin iadd in "vmctx" and "deref" global values.
 - also renames "globalsym" to "symbol"
2018-09-04 21:09:04 -07:00
Benjamin Bouvier
300a76469f wasm: Clear tables too in TranslationState::clear(); (#491) 2018-08-30 09:01:07 -07:00
Dan Gohman
c836a96e30 Bump cranelift-entity version to 0.20.1. 2018-08-28 20:19:09 -07:00
Dan Gohman
f834afb5f6 Bump cranelift-wasm version to 0.20.1. 2018-08-28 17:18:36 -07:00
Dan Gohman
fcd859a45e Make FuncIndex and DefinedFuncIndex implement the Debug trait. 2018-08-28 17:05:49 -07:00
Dan Gohman
7fa0a38793 Bump version to 0.20.0 2018-08-28 16:37:52 -07:00
Dan Gohman
0842825c38 Minor code simplification. 2018-08-28 16:30:51 -07:00
Dan Gohman
8e2d01a675 Add an index_type field to Table.
This parallels the `index_type` field in `Heap`.
2018-08-28 14:28:43 -07:00
Dan Gohman
eb439c9a68 Fix legalization of heap_addrs with 32-bit indices. (#480)
This makes several changes:
 - It adds an index_type to heap declarations, allowing heaps to specify the
   type for indexing. This also anticipates 64-bit heap support.

 - It adds a memory_type to deref global values, allowing deref globals to
   have types other than pointers. This is used to allow the bound variable
   in dynamic heaps to have type i32, to match the index type in heaps
   with i32 index type.

 - And, it fixes heap legalization to do the bounds check in the heap's
   index type.
2018-08-28 13:37:33 -07:00
Dan Gohman
ba8dd836ff Update to wabt 0.5.0. 2018-08-28 13:23:37 -07:00
Dan Gohman
2c9b7fd73a Add "no-std" category to crates supporting no-std.
And add "wasm" category to cranelift-wasm.
2018-08-22 12:51:54 -07:00
Dan Gohman
ad170c7412 Update to log 0.4.4. 2018-08-17 12:04:01 -07:00
Dan Gohman
3d89a8645b Fix rustfmt errors. 2018-08-16 15:26:53 -07:00
Denis Merigoux
bed8e33c9d Removed "Variable" parametricity for FunctionBuilder as discussed in PR https://github.com/CraneStation/cranelift/pull/437 2018-08-14 15:15:09 -07:00
Dan Gohman
6a07c72867 Bump version to 0.19.0 2018-08-14 12:55:34 -07:00
Grégoire Geis
dbc547091f Verifier now accepts multiple errors (fixes #387). (#452)
* Verifier now accepts multiple errors (fixes #387).
2018-08-14 10:55:10 -07:00
Dan Gohman
cc4bf1c7fb Deny unstable_features in "std" builds. 2018-08-13 12:51:49 -07:00
Dan Gohman
8bd1b877ef Elaborate on some comments. 2018-08-13 12:51:49 -07:00
Benjamin Bouvier
a044f58cea Fixes #404: Use log.rs and a file-per-thread logger instead of the dbg! macro; 2018-08-13 12:51:14 -07:00
Maddy
32b332b733 Format files. 2018-08-09 19:52:21 -07:00
Maddy
ee9e5cba49 Convert the start function index from a DefinedFuncIndex to a FuncIndex. 2018-08-09 19:52:21 -07:00
Maddy
f5d46cabe7 Use types to distinguish between wasm function body indices and wasm function indices. 2018-08-09 19:52:21 -07:00
Benjamin Bouvier
f7e481d9ac Implement wasm saturating conversions; 2018-08-09 19:50:41 -07:00
Dan Gohman
cd02010a78 Bump version to 0.18.1 2018-08-02 20:10:23 -07:00