Commit Graph

284 Commits

Author SHA1 Message Date
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
Dan Gohman
c4a056a7a0 Bump version to 0.18.0 2018-08-02 18:34:22 -07:00
Dan Gohman
1b30265c5c Define a "table" concept.
"Table" is to WebAssembly tables as "Heap" is to WebAssembly linear
memories.
2018-08-02 15:21:34 -07:00
Dan Gohman
cd75176f10 Update to the rustfmt in rust 1.28, which is now stable.
Also, rustfmt's --write-mode=check is now named --check.
2018-08-02 09:55:40 -07:00
Dan Gohman
c61f8a5baf Rename langref.rst to ir.rst.
This aligns with our use of the term "IR" rather than "IL" or
other terms involving "language".
2018-08-02 09:18:59 -07:00
bjorn3
01729be8d7 Add comment support (#379)
* Add comment support

* Don't print empty comments

* Add nop instruction

* Add test and note

* Add FuncWriter trait

* Remove comment support

* Add write_preamble to FuncWriter

* Fix test

* Some changes
2018-08-01 11:21:05 -07:00
Dan Gohman
1b42105faa Remove reserved_reg functionality. (#424)
* Remove reserved_reg functionality.

This wasn't implemented, and if we need it in the future, it seems like
it would be better to extend the concept of global values to cover this.

* Use GlobalValue::reserved_value() for sentinal values.
2018-07-31 07:57:37 -07:00
Dan Gohman
d6d1e7253d Bump version to 0.17.0 2018-07-23 16:57:51 -07:00
Dan Gohman
6cb03a873d Bump version to 0.17.0-alpha 2018-07-23 16:15:53 -07:00
Benjamin Bouvier
5f3cd868cd [wasm] Rename native_pointer() to pointer_type() to make it more apparent it's a type; 2018-07-20 13:11:36 -07:00
Dan Gohman
45ef3149f1 Update hashmap_core to 0.1.9. 2018-07-19 11:08:53 -07:00
Benjamin Bouvier
7b290cd900 Move the code section parsing into its own function; 2018-07-19 06:39:56 -07:00