Commit Graph

2638 Commits

Author SHA1 Message Date
Benjamin Bouvier
afa4a749c5 Fix #666: Change the way we consider a block has been visited in relaxation;
This was previously using the following condition to decide that a block
hadn't been visited yet: either dest_offset is non-0 or the block isn't
the entry block. Unfortunately, this didn't work when the first block
would be non-empty but wouldn't generate code at all.

Since the original code would do at least one pass over the entire code,
the first pass that determines initial EBB offsets is done separately,
without considering branch relaxation. This ensures that all EBBs have
been visited and have correct initial offsets, and doesn't require a
special check to know whether an EBB has been visited or not.
2019-02-12 14:39:45 +01:00
Rett Berg
68479e6115 Clarify br_table
From comments in
https://github.com/CraneStation/cranelift/issues/101#issuecomment-461284555
2019-02-07 09:18:07 -08:00
Dan Gohman
9f9c306091 Fix indentation warnings reported by flake8. 2019-02-06 21:37:05 -08:00
Dan Gohman
d2082abb73 Look for Cargo.toml files only in crate directories. 2019-02-06 21:37:05 -08:00
Rett Berg
084722a118 fix typos in cranelift-frontend/src/lib.rs 2019-02-06 20:31:01 -08:00
lazypassion
747ad3c4c5 moved crates in lib/ to src/, renamed crates, modified some files' text (#660)
moved crates in lib/ to src/, renamed crates, modified some files' text (#660)
2019-01-28 15:56:54 -08:00
Lukas Bergdoll
54959cf5bb Fix link to cargo workspace documentation 2019-01-28 14:38:44 -08:00
Dan Gohman
45cd3f6193 Bump version to 0.28.0 2019-01-22 23:50:12 -08:00
Dan Gohman
6326140227 Fix legalization of bxor_imm. 2019-01-22 23:45:23 -08:00
Dan Gohman
c8febc1a37 Bump version to 0.27.0.
Major API-incompatible changes include:
 - Introduce TrapCode::UnreachableCodeReached, used for unreachable in wasm.
 - cranelift-wasm's `declare_signature` now takes its signature by value
 - cranelift-wasm's `declare_table_elements` `elems` parameter now takes a boxed slice
 - Remove cranelift-wasm's `ModuleEnvironment`'s `get_signature`,
   `get_num_func_imports`, `get_func_type`, and `get_global`.
2019-01-22 20:06:34 -08:00
Dan Gohman
1bbd2ebb77 Update to region 2.0.0. 2019-01-22 20:03:28 -08:00
Dan Gohman
1fdf1c92d9 Update to the rustfmt in rust 1.32, which is now stable. 2019-01-22 13:27:03 -08:00
Nathan Froyd
363eea6960 avoid directories for cargo build dependencies
We are facing peculiar Windows-only regressions in build times in
https://bugzilla.mozilla.org/show_bug.cgi?id=1506511 and while the build
times might just be Windows being slow, putting directories in
`rerun-if-changed` might also be causing problems.  The build only
depends on the files, anyway, so let's just say that.
2019-01-22 13:20:55 -08:00
Dan Gohman
06a072ead0 Mention wasmtime as a planned use. 2019-01-16 14:13:54 -08:00
bjorn3
eb032fd0f4 Simplify 2019-01-16 07:07:31 -08:00
bjorn3
80031cb2b4 Add TargetIsa 2019-01-16 07:07:31 -08:00
bjorn3
eedc7cabf1 Allow peeking at the compiled function 2019-01-16 07:07:31 -08:00
Dan Gohman
aeb9161e2c Update no_std support for Rust 2018 Edition.
With Rust 2018 Edition, the `mod std` trick to alias `core` names to
`std` no longer works, so switch to just having the code use `core`
explicitly.

So instead, switch to just using `core::*` for things that in core.
This is more consistent with other Rust no_std code. And it allows
us to enable `no_std` mode unconditionally in the crates that support
it, which makes testing a little easier.

There actually three cases:

 - For things in std and also in core, like `cmp`: Just use them via
   `core::*`.

 - For things in std and also in alloc, like `Vec`: Import alloc as std, as
   use them from std. This allows them to work on both stable (which
   doesn't provide alloc, but we don't support no_std mode anyway) and
   nightly.

 - For HashMap and similar which are not in core or alloc, import them in
   the top-level lib.rs files from either std or the third-party hashmap_core
   crate, and then have the code use super::hashmap_core.

Also, no_std support continues to be "best effort" at this time and not
something most people need to be testing.
2019-01-14 21:48:15 -08:00
Dan Gohman
50a045363c Add an explicit trap code for wasm unreachable. 2019-01-14 21:40:27 -08:00
bjorn3
2f0e0dd995 Really fix emit_small_memcpy this time! 2019-01-14 21:39:50 -08:00
bjorn3
3809e7252d Remove outdated comment
cranelift-frontend now inserts libcalls for mem{cpy,set,move}
2019-01-14 21:39:00 -08:00
Dan Gohman
a5bd3924e3 Add crate version identifiers. 2019-01-07 14:52:11 -08:00
Dan Gohman
9eba81a8d9 Update clippy settings and fix a few clippy warnings. 2019-01-07 14:48:02 -08:00
Dan Gohman
a7aee246e9 Pass declare_signature's argument by value.
`parse_type_section` doesn't need the value after passing it, and this
allows callees to avoid cloning if they need their own copy.
2019-01-07 13:42:00 -08:00
Dan Gohman
13138b65f7 Call the new ModuleEnvironment reserve functions. 2019-01-07 13:42:00 -08:00
Dan Gohman
6ec0b3c6bf Add a comment. 2019-01-07 13:42:00 -08:00
Dan Gohman
7120633363 Change the elems parameter of declare_table_elements to a boxed slice.
Implementations that want a full `Vec` can use `into_vec` to convert it
back.
2019-01-07 13:42:00 -08:00
Dan Gohman
054e6fcf07 Add functions to ModuleEnvironment to support reserving buffers up front.
These default to doing nothing, but implementations can override them to
preallocate buffers.

Also, reorder the functions in `ModuleEnvironment` to more closely
reflect the sequence from the WebAssembly module layout.
2019-01-07 13:42:00 -08:00
Dan Gohman
7f250e340c Simplify ModuleEnvironment.
Remove some unneeded functions, and remove the `GlobalInit` special case
for data and elem initializer offsets; implementations that want that
information can provide it for themselves.
2019-01-07 13:42:00 -08:00
Benjamin Bouvier
03c22ed67a Remove warnings in tests; 2019-01-03 12:14:39 -08:00
Benjamin Bouvier
c78a9a4a7c Bump log and file-per-thread-logger; 2019-01-03 12:14:39 -08:00
Benjamin Bouvier
813810008b Replace deprecated trim_left_matches by trim_start_matches; 2019-01-03 12:14:39 -08:00
Benjamin Bouvier
7e42966c68 Use snake case for magic numbers computation; 2019-01-03 12:13:25 -08:00
bjorn3
e9cb50313d Fix emit_small_mem{cpy,set} when size == 0 or access_size > 8 2019-01-02 12:18:49 -08:00
Dan Gohman
c8e47177fc Add an assert to append_ebb_params_for_function_params. 2019-01-02 12:05:32 -08:00
Dan Gohman
831d033471 Add a shrink_to_fit function to PrimaryMap. 2019-01-02 12:01:36 -08:00
Dan Gohman
cd4f96c066 Use Vec::with_capacity when we know the eventual size of the Vec. 2019-01-02 11:59:57 -08:00
Dan Gohman
29edc3fe50 Make ListPool's alloc fill new memory with reserved values.
This makes it harder to misuse, as 0 could be confused for a valid value.
2019-01-02 11:59:22 -08:00
Dan Gohman
8a11bd6af7 Remove BoxedSlice's next_key() function, which is unneeded.
`BoxedSlice` does not support appending elements, so it isn't useful to
look up the next key.
2019-01-02 11:58:44 -08:00
Dan Gohman
b096d0606b Move ifcmp, icmp_imm, and ffcmp into the CPU flags doc section. 2019-01-02 11:46:15 -08:00
bjorn3
ab72eeadf9 Bump faerie to 0.7.0 2019-01-02 11:12:48 +01:00
Muhammad Mominul Huque
effe6c04e4 Update to Rust 2018 edition (#632)
* initial cargo fix run

* Upgrade cranelift-entity crate

* Upgrade bforest crate

* Upgrade the codegen crate

* Upgrade the faerie crate

* Upgrade the filetests crate

* Upgrade the codegen-meta crate

* Upgrade the frontend crate

* Upgrade the cranelift-module crate

* Upgrade the cranelift-native crate

* Upgrade the cranelift-preopt crate

* Upgrade the cranelift-reader crate

* Upgrade the cranelift-serde crate

* Upgrade the cranelift-simplejit crate

* Upgrade the cranelift or cranelift-umbrella crate

* Upgrade the cranelift-wasm crate

* Upgrade cranelift-tools crate

* Use new import style on remaining files

* run format-all.sh

* run test-all.sh, update Readme and travis ci configuration
fixed an AssertionError also

* Remove deprecated functions
2018-12-26 09:49:05 -08:00
bjorn3
e3db942b0c Put default implementations of FuncWriter methods in a seperate method
This is useful when you want to write extra information
2018-12-26 09:21:32 -08:00
Bruce Mitchener
4f8753fa11 Fix typos. 2018-12-24 10:03:22 -08:00
Bruce Mitchener
4224a95f0d Update wasmparser to 0.23. 2018-12-24 09:49:06 -08:00
Dan Gohman
887451a2eb Fix formatting. 2018-12-24 09:32:50 -08:00
Dan Gohman
998a7d2b6d Mention Wasmtime as a complete implementation of the Environment traits. 2018-12-24 09:32:20 -08:00
bjorn3
95118e7244 Nicer panic when trying to insert instruction before calling switch_to_block 2018-12-24 09:31:51 -08:00
Nicholas Nethercote
46d9a3cd1a Use an FxHashMap in RegDiversions.
Because it's hot and the number of entries can reach the 1000s, so
linear insertion and search is bad.

This reduces runtime for `sqlite` and `UE4Game-HTML5-Shipping` by 3-4%,
and a couple of other benchmarks (`sqlite`, `godot`, `clang`) by smaller
amounts.

It also increases runtime for `mono` and `tanks` by about 1%; this seems
to be due to incidental changes in which functions are inlined more than
algorithmic changes.
2018-12-17 21:36:06 -08:00
Vincent Esche
c9666381f6 Fixed links in …/docs/compare-llvm.rst 2018-12-13 09:14:20 -05:00