Commit Graph

1840 Commits

Author SHA1 Message Date
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
492fa1283c Define an "interrupt" trap code.
This is a trap code for interrupting the running code, to allow
timeouts and safepoints to be implemented. It is resumable.
2018-03-18 14:54:05 -07:00
Dan Gohman
832d9d9a0d Minor code simplification. 2018-03-18 14:54:05 -07:00
Sergey Pepyakin
c161b0d103 Fix check-rustfmt.sh for macOS (#273)
There are two cases:

1. It seems that grep on macOS exits as soon as it finds the first match. This makes cargo unhappy and it prints message like "failed printing to stdout: Broken pipe (os error 32)". The solution is to fully consume the output from cargo. I choose to use tee for this task.

2. When in a strict mode, bash complains that $1 is not defined (when it's actually not defined in case of omitting --install). The solution is to apply bash substitution magic: when $1 is undefined or set to null substitute it with empty string.
2018-03-18 13:53:02 -07:00
Afnan Enayet
9a49bc2ec9 Rename I32 -> X86_32 and I64 -> X86_64 (#271)
* Rename `I32` -> `X86_32` and `I64` -> `X86_64`

* Format file to pass flake8 tests

* Fix comment so lines are under 80 char limit

* Remove trailing whitespace from comment

* Renamed `enc_i64` to `enc_x86_64` as per suggestion from PR
2018-03-18 13:50:51 -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
a4c51d66a8 Remove uses of println! in tests.
In this case, it's a little nicer to just use more assertions,
which will print their line number indicating how far the test
got, when they fail.

And this allows the tests to be run in no_std configurations.
2018-03-15 22:45:09 -07:00
Dan Gohman
06fe3b654f Avoid match expressions with reference patterns.
https://github.com/rust-lang-nursery/rust-clippy/wiki#match_ref_pats
2018-03-15 22:44:54 -07:00
Dan Gohman
99f7cb5b8d Use debug_assert_ne rather than debug_assert with a !=.
https://github.com/rust-lang-nursery/rust-clippy/wiki#should_assert_eq
2018-03-15 22:44:33 -07:00
Dan Gohman
e6db8e278c Rename one more "local" to "explicit_slot". 2018-03-15 22:32:47 -07:00
Dan Gohman
5e5fcefdfd Add Travis builds with Rust nightly.
See [here](https://docs.travis-ci.com/user/languages/rust/) for details.
2018-03-15 21:37:31 -07:00
Dan Gohman
e2f3079d8b Tidy up redundant commands in test-all.sh. 2018-03-15 21:37:08 -07:00
Dan Gohman
4dbafb45c7 Update to num_cpus 1.8, and other updates. 2018-03-15 21:09:59 -07:00
Dan Gohman
e889b88d04 Split filecheck out into its own repo. 2018-03-15 15:35:48 -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
Dan Gohman
00af7a28f3 Run the filetests as part of "cargo test".
Refactor the filetests harness so that it can be run as part of
`cargo test`. And begin reorganizing the test harness code in preparation
for moving it out of the src directory.
 - Test subcommand files are now named `test_*.rs`.
 - cton-util subcommand files now just export their `run` and nothing else.
 - src/filetest/mod.rs now also just exports `run` and nothing else.
 - Tests are now run in release mode (with debug assertions enabled).
2018-03-15 13:38:21 -07:00
Dan Gohman
b2acd457d5 Use OrderedDict rather than explicit sorting.
This reduces churn in the generated files, making it easier to inspect
changes.
2018-03-15 10:35:06 -07:00
Dan Gohman
c842b9aaa1 Code cleanup: import OrderedDict rather than collections.OrderedDict 2018-03-15 10:13:26 -07:00
Dan Gohman
bb82bac3af Tweak the Gitter URLs. 2018-03-14 12:40:20 -07:00
Dan Gohman
48fc161b8b Add a badge for a Gitter chat room.
I don't know how much interest there will be in Gitter, but if
there is some, I'm interested in trying it out.
2018-03-14 11:26:02 -07:00
Dan Gohman
272d03d8fc Add a utility for generating Rust 'match' expressions.
This makes it a little simpler to generate 'match' statements, and
it performs deduplication of identical arms. And it means I don't
have to think about as many strings like '{} {{ {}.. }} => {}'
when I'm trying to think about how instructions work :-).
2018-03-14 10:51:09 -07:00
Dan Gohman
d9712f5d7d Elaborate on some comments in generated source files.
Recipe names are fairly obscure, so the more context we can give
when using them the better.
2018-03-14 10:51:09 -07:00
Dan Gohman
cc8d6400f4 Rename builder.rs to inst_builder.rs.
This reflects its purpose, to define the `InstBuilder` trait.
2018-03-14 10:51:09 -07:00
Dan Gohman
3afe85ff17 Auto-generate InstructionData.
The meta description has all the information to generate the `InstructionData`
enum, so generate it rather than having a manually-maintained copy.
2018-03-14 10:51:09 -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
aaf0def241 Add lint overrides for unused extern crate hashmap_core.
This allows these files to build with both the `no_std` and `std`
features enabled at the same time.
2018-03-12 14:09:34 -07:00
Dan Gohman
1a671cf82f Remove uses of println! in tests.
In this case, it's a little nicer to just use more assertions,
which will print their line number indicating how far the test
got, when they fail.

And this allows the tests to be run in no_std configurations.
2018-03-12 14:06:15 -07:00
Dan Gohman
f9b9b4b8a4 Merge remote-tracking branch 'origin/master' into no_std 2018-03-12 13:06:47 -07:00
Dan Gohman
2b9229d715 Fix > 80-column lines for flake8. 2018-03-12 13:02:55 -07:00
Dan Gohman
4a3077d638 Merge remote-tracking branch 'origin/master' into no_std 2018-03-12 12:55:57 -07:00
Dan Gohman
11eddafef8 Avoid using floating-point values in expand_fcvt_to_sint.
Compute the bound values for expand_fcvt_to_sint using bitwise integer
arithmetic rather than floating-point arithmetic, to avoid relying on
host floating point arithmetic.
2018-03-12 12:50:58 -07:00
Dan Gohman
f04e02c0a1 Clarify comments about Conventional SSA form.
Captialize "Conventional" so that it's clear that "Conventional SSA"
is a specific concept being referenced.
2018-03-12 12:38:30 -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
e81a27fb5d Implement Debug for ArgAction and Affinity. 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
b8a106adf0 Remove the "has_sse2" flag.
Cretonne currently requires SSE2 support pervasively, so it's not meaningful
to have a setting for it.
2018-03-12 12:38:01 -07:00
Dan Gohman
e441337e4b Bump version to 0.3.4 2018-03-09 16:32:13 -08:00
Dan Gohman
1c72ccfe0a Define a Variable struct so that frontends don't have to.
Frontends can still use their own types with `ILBuilder` and
`FunctionBuilder`. This just provides a basic `Variable` struct
for frontends that want it.
2018-03-09 15:08:54 -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
8df9fe6c87 Fix obsolete paths in comments. 2018-03-09 15:08:54 -08:00
Dan Gohman
b9d7a43439 Elaborate on Cretonne's rustc backend goals. (#257)
* Elaborate on Cretonne's rustc backend goals.

* Remove these extra newlines. They don't show up in the rendered form anyway.

* Fix typo.

* The document is meant to speak with the voice of the project.
2018-03-08 06:07:18 -08:00
Dan Gohman
b5f428b6f2 Bump version to 0.3.3 2018-03-08 02:50:09 -08:00
Dan Gohman
40ec50d0b6 Don't relax a branch to have different input constraints.
When relaxing a branch, restrict the set of candidate encodings to those which
have the same input constraints as the original encoding choice. This prevents
situations where relaxation prefers a non-REX-prefixed encoding over a REX
prefixed one because the end of the instruction can be one byte closer to the
destination, in a situation where the encoding needs to be REX-prefixed
because of one of the operand registers.

This also makes the Context class perform encoding verification after
relaxation, to catch similar problems in the future.

Fixes #256.
2018-03-08 02:34:41 -08:00
Dan Gohman
6cf9bf36b8 Fix a typo in a comment. 2018-03-08 02:26:15 -08:00
Dan Gohman
ee0bce4106 Bump version to 0.3.2 2018-03-05 16:17:00 -08:00