Commit Graph

130 Commits

Author SHA1 Message Date
Dan Gohman
c59e9180de Tidy up whitespace. 2018-03-05 06:55:27 -08:00
Bruce Mitchener
d2d02565fb I64Extend16S should operate on 16 bits, not 8.
This showed up in clippy warnings as the code for this case was
the same as for `I64Extend8S`.
2018-03-05 06:53:13 -08:00
Bruce Mitchener
125270e2b0 Fix some typos. 2018-03-04 21:33:04 -08:00
Dan Gohman
b9f51d7850 Enable more compliler lints. 2018-02-28 13:18:07 -08:00
Dan Gohman
1cf9a8d669 Implement the wasm sign-extension-ops proposal.
https://github.com/WebAssembly/sign-extension-ops/
2018-02-28 12:02:14 -08:00
Dan Gohman
6fcbb20e10 Bump version to 0.3.0 2018-02-28 10:31:00 -08:00
Dan Gohman
60c6154b94 Add some crate keywords. 2018-02-28 03:38:48 -08:00
Dan Gohman
dabfc55c6e Bump version to 0.2.0 2018-02-27 15:58:25 -08:00
Dan Gohman
0e22c74085 Track wasm reachability explicitly.
Maintain an explicit "reachable" flag when decoding wasm. Push placeholder
frames on the control-flow stack instead of just maintaining a count of
the stack depth in unreachable code, so that we can whether If blocks
have Elses, and whether block exits are branched to, in all contexts.

Fixes #217.
2018-02-26 15:24:33 -08:00
Dan Gohman
81c126619b Ignore unknown custom wasm sections. 2018-02-26 15:24:25 -08:00
Dan Gohman
2a26b70854 Update URLs. 2018-02-23 16:16:44 -08:00
Jakob Stoklund Olesen
ec746c3359 Add a publish-all.sh script.
Set identical version numbers on all cretonne-* crates and print "cargo
publish" commands.

Update all crates to version 0.1.0.
2018-02-23 12:51:14 -08:00
Benjamin Bouvier
f02c8fd1ff Fixes #244: Prints the generated code size and wasm bytecode size in wasm command; 2018-02-23 08:46:09 -08:00
Dan Gohman
c7655c4928 Add minimal README.md files to published crates.
This will put descriptions on the packages' crates.io pages.
2018-02-21 20:50:03 -08:00
Dan Gohman
42e1616b82 Update to wasmparser 0.14.1. 2018-02-13 20:14:54 -08:00
Jakob Stoklund Olesen
af89006b09 Fix some markdown issues.
Work around some cases where the old markdown parser differs from the
new Pulldown parser for the documentation.
2018-01-08 16:19:16 -08:00
Jakob Stoklund Olesen
60c456c1ec Add a compilation pass timing facility.
Individual compilation passes call the corresponding timing::*()
function and hold on to their timing token while they run. This causes
nested per-pass timing information to be recorded in thread-local
storage.

The --time-passes command line option prints a pass timing report to
stdout.
2017-12-06 17:04:23 -08:00
Jakob Stoklund Olesen
c09ad06f96 Stop generating reserved_reg heaps in DummyEnvironment.
The reserved register heaps are not implemented in the Cretonne
legalizer, so IR generated by the dummy environment would trip
assertions when compiled.

Use a heap with a vmctx base address instead, and also demonstrate how
vmctx arguments are added to all signatures to achieve this.
2017-12-05 16:31:10 -08:00
Pat Hickey
919de82e9c rename wasm testsuite to wasm_testsuite
this makes it a lot more obvious in the travis build output
2017-12-01 09:00:23 -08:00
Pat Hickey
cced2c8b0c Fix wat syntax so wasm tests pass (#199)
* wasm testsuite: ignore hidden files in test dir

and report a rejected file. it was picking up vim .swp files

* wasmtests: correct wat syntax in icall.wat
2017-11-27 12:46:53 -08:00
Pat Hickey
eb49d9f8bf tests: update ExternalName api 2017-11-23 14:08:47 -08:00
Pat Hickey
803b83c87a wasm: change to new externalname api 2017-11-23 14:08:47 -08:00
Dan Gohman
d51a4c1065 Replace FunctionBuilder's Drop impl with a finalize function. (#193)
* Replace FunctionBuilder's Drop impl with a finalize function.

This has the advantage of not triggering assertion failures in the event
of abandoning a partially-built function. It has the disadvantage of
requiring users to call finalize() explicitly.
2017-11-17 16:03:40 -08:00
Dan Gohman
355e3e3c15 Remove redundant validation for function locals.
Remove the MAX_LOCALS constraint, and the local type validation.
These are checked by whatever is performing proper validation.
2017-11-13 14:34:35 -08:00
Dan Gohman
ced7a88ecc Use consistent formatting for module-level comments. 2017-11-08 14:49:27 -08:00
Dan Gohman
889b06fd16 Replace as casts with type-conversion functions. 2017-11-08 10:48:44 -08:00
Dan Gohman
3ab4349c1b Use Self instead of repeating the type name. 2017-11-08 10:43:11 -08:00
Dan Gohman
b7f979a8be Combine identical match arms. 2017-11-08 10:40:43 -08:00
Dan Gohman
849f090562 Fix nondeterminism in br_table translation. 2017-11-07 15:33:35 -08:00
Dan Gohman
9b15fe7dfd Simplify Ebb parameter creation.
Ebb parameters are appended explicitly by whoever calls create_block,
so they don't need to also be inferred from branches. This makes the
frontend code more flexible for producers that want to create things
in a different order, and it eliminates more temporary allocations.

FunctionBuilder no longer maintains its own list of the function
parameter values; these can be obtained from the ebb parameter list
on the entry block.
2017-11-07 15:13:00 -08:00
Dan Gohman
cce2384ede Remove switch_to_block's jump_args argument.
switch_to_block doesn't need its jump_args argument, since jump
arguments are handled by the `jump` instruction and others, rather
than on the switch to a new ebb itself.
2017-11-06 16:38:13 -08:00
Dan Gohman
aa724846f6 Clear the wasm operand stack at the end of a function.
This preserves an invariant that the stack is empty between function
body translations.
2017-11-01 11:25:22 -07:00
Dan Gohman
c2665385b1 Rename FunctionName to ExternalName. 2017-10-30 13:26:56 -07:00
Dan Gohman
dbd75483e8 Rename arg_value to param_value for consistency.
Also rename FunctionBuilder's `pristine` to `params_values_initialized`
to avoid confusion with the unrelated `is_pristine` accessor function.
2017-10-25 10:14:10 -07:00
Dan Gohman
2d5faa01af Simplify code using the FunctionBuilder helper functions. 2017-10-24 15:28:28 -07:00
Dan Gohman
9fdf44afd4 Clean up a stale comment. 2017-10-20 11:37:25 -07:00
Dan Gohman
d3077acf1c TranslationState can assert that its stacks are empty between functions. 2017-10-20 11:37:25 -07:00
Jakob Stoklund Olesen
b3fb41087e Use the term "Function parameter" instead of "argument".
Rename the ArgumentType type to AbiParam since it describes the ABI
characteristics of a parameter or return value, not just the value type.

In Signature, rename members argument_types and return_types to "params"
and "returns". Again, they are not just types.

Fix a couple lingering references to "EBB arguments".
2017-10-19 17:39:23 -07:00
Jakob Stoklund Olesen
921bcc6c25 Use the term "EBB parameter" everywhere.
Add EBB parameter and EBB argument to the langref glossary to clarify
the distinction between formal EBB parameter values and arguments passed
to branches.

- Replace "ebb_arg" with "ebb_param" in function names that deal with
  EBB parameters.
- Rename the ValueDef variants to Result and Param.
- A bunch of other small langref fixes.

No functional changes intended.
2017-10-19 16:17:09 -07:00
Dan Gohman
ee0f061ee8 Rename "runtime" to "environment". 2017-10-18 16:55:32 -07:00
Dan Gohman
35989f4069 Tidy up unneeded references. 2017-10-17 11:48:57 -07:00
Dan Gohman
c808447468 Have declare_table_elements consume its elements argument.
The producer is already allocating a new Vec, so no need to require the
consumer to allocate one too.
2017-10-13 12:43:15 -07:00
Dan Gohman
bd94a3b202 Move the 'data lifetime parameter to the ModuleEnvironment trait.
This is needed to allow implementations to have 'data-lifetime
references if they choose to. The DummyEnvironment is an example of an
implementation that doesn't choose to.
2017-10-13 12:43:15 -07:00
Dan Gohman
d6ab7e3abf Minor comment cleanup. 2017-10-13 12:43:15 -07:00
Dan Gohman
ad2ffcd7fc Update to wasmparser 0.13.0. 2017-10-13 12:43:04 -07:00
Dan Gohman
ac85ba0d68 Update to wasmparser 0.12.1. 2017-10-11 11:33:02 -07:00
Dan Gohman
733870aee4 Make FuncEnvironment independent from ModuleEnvironment (formerly WasmRuntime).
This renames WasmRuntime to ModuleEnvironment, and makes several changes
to allow for more flexible compilation.

ModuleEnvironment no longer derives from FuncEnvironment, and no longer
has the `begin_translation` and `next_translation` functions, so that
independent `FuncEnvironment` instances can operate within the same
module.

Also, this obviates the rest of TranslationResult, as it moves processing
of function bodies into the environment. The DummyEnvironment implementation
gives an example of decoding the function bodies as they are parsed, however
other implementation strategies are now possible.
2017-10-10 15:50:24 -07:00
Dan Gohman
d4c0c5babc Rename WasmRuntime's get_name to get_func_name. 2017-10-10 10:21:06 -07:00
Dan Gohman
8e1ba080c0 Complete support for global init expressions. 2017-10-10 09:35:10 -07:00
Dan Gohman
653e8bb563 Declare exports via the WasmRuntime.
Also, redo how functions are named in the DummyRuntime. Use the FunctionName
field to just encode the wasm function index rather than trying to shoehorn
a printable name into it. And to make up for that, teach the wasm printer
to print export names as comments next to the function definitions.

This also makes the fields of DummyRuntime public, in preparation for
the DummyRuntime to have a more general-purpose debugging role, as well
as possibly to allow it to serve as a base for other implementations.
2017-10-10 08:46:10 -07:00