Commit Graph

153 Commits

Author SHA1 Message Date
Dan Gohman
685cde98a4 Mark loads from globals aligned and notrap.
Mark loads from globals generated by cton_wasm or by legalization as
`aligned` and `notrap`, since memory for these globals should be
allocated by the runtime environment for that purpose. This reduces
the number of potentially trapping instructions, which can reduce
the amount of metadata required by embedding environments.
2018-03-26 21:21:54 -07:00
Pat Hickey
03ee007624 Use clippy (#276)
* cton-util: fix some clippy unnecessary pass-by-value warnings

* clippy: ignore too many arguments / cyclomatic complexity in module

since these functions are taking args coming from the command line, i
dont think this is actually a valid lint, morally the arguments are all
from one structure

* cton-util: take care of remaining clippy warnings

* cton-reader: fix all non-suspicious clippy warnings

* cton-reader: disable clippy at site of suspicious lint

* cton-frontend: disable clippy at the site of an invalid lint

* cton-frontend: fix clippy warnings, or ignore benign ones

* clippy: ignore the camelcase word WebAssembly in docs

* cton-wasm: fix clippy complaints or ignore benign ones

* cton-wasm tests: fix clippy complaints

* cretonne: starting point turns off all clippy warnings

* cretonne: clippy fixes, or lower allow() to source of problem

* cretonne: more clippy fixes

* cretonne: fix or disable needless_lifetimes lint

this linter is buggy when the declared lifetime is used for another type
constraint.

* cretonne: fix clippy complaint about Pass::NoPass

* rustfmt

* fix prev minor api changes clippy suggested

* add clippy to test-all

* cton-filetests: clippy fixes

* simplify clippy reporting in test-all

* cretonne: document clippy allows better

* cretonne: fix some more clippy lints

* cretonne: fix clippy lints (mostly doc comments)

* cretonne: allow all needless_lifetimes clippy warnings

remove overrides at the false positives

* rustfmt
2018-03-22 13:10:41 -07:00
Dan Gohman
2b3df1a506 Add use declarations for std features.
Merge the `use` parts of the `no_std` branch. This reduces the diffs
between master and the `no_std` branch, making it easier to maintain.

Most of these changes are derived from patches by @lachlansneff in
https://github.com/Cretonne/cretonne/tree/no_std.
2018-03-20 14:07:05 -07:00
Dan Gohman
f6b8cf86a5 Factor out br_if translation into helper functions. 2018-03-20 13:28:32 -07:00
Dan Gohman
c333a52e3e Factor out fcmp and icmp translation into helper functions. 2018-03-20 13:27:45 -07:00
Dan Gohman
2d1f9f874c Bump version to 0.4.1 2018-03-18 14:56:30 -07:00
Dan Gohman
d99b43e4b7 Add a hook to the wasm FuncEnvironment for emitting loop headers.
This will allow wasm implementations that wish to insert code into
every loop, for example to insert an interrupt check or a safepoint.
do so without relying on asynchronous signals.
2018-03-18 14:54:05 -07:00
Dan Gohman
832d9d9a0d Minor code simplification. 2018-03-18 14:54:05 -07:00
Dan Gohman
921cea2845 Bump version to 0.4.0 2018-03-16 16:12:56 -07:00
Dan Gohman
5e21ac1a30 Use whitespace more consistently in Cargo.toml files. 2018-03-16 16:01:15 -07:00
Dan Gohman
965b93bd2a Move the filetest harness into its own crate.
This allows us to run the tests via a library call rather than just
as a command execution. And, it's a step toward a broader goal, which
is to keep the code in the top-level src directory minimal, with
important functionality exposed as crates.
2018-03-15 15:35:48 -07:00
Afnan Enayet
9128290fb4 Rename ILBuilder to FunctionBuilderContext (#268)
* Rename `ILBuilder` to `FunctionBuilderContext` and update corresponding
code

* Refactor usages of ILBuilder to become FunctionBuilderContext,
update variable names to reflect this change

* Reformat to ensure that lines stay under 100 char limit

* Apply corrections from `rustfmt` to pass tests

* Rename variables to be more consistent with refactor of ILBuilder
2018-03-14 10:48:06 -07:00
Dan Gohman
44ca27beec Update to wasmparser 0.15.1. 2018-03-13 09:34:20 -07:00
Dan Gohman
e776d987fd Add Cargo.toml badges for published packages.
This adds a basic travis badge, as well as a badge indicating
"experimental" status, since the APIs are still evolving.
2018-03-13 09:34:11 -07:00
Dan Gohman
30f8daa9d6 Replace assert! with debug_assert! in production code paths.
This allows the assertions to be disabled in release builds, so that
the code is faster and smaller, at the expense of not performing the
checks. Assertions can be re-enabled in release builds with the
debug-assertions flag in Cargo.toml, as the top-level Cargo.toml
file does.
2018-03-12 12:38:30 -07:00
Dan Gohman
ad363d7e6b Replace cretonne-wasm's Local with cretonne-frontend's Variable.
Previously, cretonne-wasm used its own Local struct for identifying
local variables. However, now that cretonne-frontend provides a
Variable struct, just use that instead.
2018-03-12 12:38:30 -07:00
Dan Gohman
e441337e4b Bump version to 0.3.4 2018-03-09 16:32:13 -08:00
Dan Gohman
56c7d85727 More minor code simplifications. 2018-03-09 15:08:54 -08:00
Dan Gohman
55d0efcb14 Pass the wasmparser::Operator by value, simplifying the code. 2018-03-09 15:08:54 -08:00
Dan Gohman
b5f428b6f2 Bump version to 0.3.3 2018-03-08 02:50:09 -08:00
Dan Gohman
ee0bce4106 Bump version to 0.3.2 2018-03-05 16:17:00 -08:00
Dan Gohman
d119524c90 Bump version to 0.3.1 2018-03-05 07:11:23 -08:00
Dan Gohman
bf480c341b Use https rather than http for several URLs. 2018-03-05 06:55:27 -08:00
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