Jakob Stoklund Olesen
2e0b931590
Provide an fmt::Debug impl for entity references.
...
Instead of deriving a Debug impl: Ebb(45), use the Display version for
Debug too: ebb45.
This is more readable, and no information is lost.
2017-11-21 10:01:55 -08:00
Jakob Stoklund Olesen
2d7b54373f
Implement Clone and Default for bforest::{Set,Map}.
...
The default container is empty. We need a manual implementation of
Default because deriving it seems to imply that K and V generic
parameter types must also implement Default.
Cloning can be used to clone an empty container or for cloning the whole
forest. We can derive this trait because we already require Copy for K
and V.
2017-11-20 15:06:00 -08:00
Jakob Stoklund Olesen
8eaf7d3904
Add iterators for bforest::{Set,Map}.
...
The iter() methods return an iterator that traverses all set elements /
map key-value pairs. The iterator doesn't require a mutable container
and forest reference, unlike the cursor types.
2017-11-20 14:20:19 -08:00
Jakob Stoklund Olesen
a2ff2a6836
Add goto_first() methods to SetCursor and MapCursor.
2017-11-20 14:16:39 -08:00
Jakob Stoklund Olesen
3389eaef29
Add a clear() method to bforest::{Set,Map}.
...
This is a lot more efficient that removing entries one by one.
2017-11-20 14:16:19 -08:00
Jakob Stoklund Olesen
d3778e56bb
Remove the "BPlus" prefix from bforest::* types.
...
We'll just use the bforest:: namespace for these types, avoiding the
confusing mix of prefixed and non-prefixed names.
No functional change intended.
2017-11-20 14:15:56 -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
29db33e7f8
Replace reserve with reserve_exact when applicable.
2017-11-17 11:14:45 -08:00
Dan Gohman
46ac24d172
Add a comment about call_indirect bounds/signature checking.
2017-11-17 11:14:45 -08:00
Jakob Stoklund Olesen
aa6f5c0db3
Forests of B+ trees.
...
Add new ordered set and map data structures based on B+-trees. These are
not general-purpose data structures like the BTreeSet and BTreeMap types
in the standard library. They are specialized for:
- Keys and values are small `Copy` types, optimized for 32-bit entities.
- Each set or map has a very small footprint, using only 32 bits of
memory when empty.
- Keys are compared using a borrowed comparator object which can provide
context for comparing tiny types that don't contain enough information
to implement `Ord`.
- A whole forest of B-trees can be cleared in constant time without
having to traverse the whole data structure.
2017-11-17 07:21:19 -08:00
Jakob Stoklund Olesen
94921c0b74
Remove the dead B-Tree interface.
...
We're starting over from scratch.
2017-11-17 07:21:19 -08:00
Dan Gohman
bfa5a72b77
Use reserve_exact instead of reserve when the max size is known.
2017-11-16 15:16:23 -08:00
Dan Gohman
4d9aedbaca
Add a 'clear()' function to Context.
...
This includes adding `clear()` functions to its (transitive) members.
2017-11-15 11:15:30 -08:00
Dan Gohman
4c829f7c7f
Fix sphinx hyperlink syntax.
2017-11-14 14:09:35 -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
648c1b33ba
Fix sphinx hyperlink syntax.
2017-11-13 14:05:47 -08:00
Dan Gohman
78f2edefc2
Add todos for add/sub with signed overflow, saturating fcvt_to_[su]int.
2017-11-11 17:45:09 -08:00
Dan Gohman
54e4ab71d9
Enable pager in cton-util.
2017-11-10 09:09:00 -08:00
Dan Gohman
8dd46054a5
In the verifier, clarify expected versus observed values.
2017-11-09 22:02:07 -08:00
Dan Gohman
ced7a88ecc
Use consistent formatting for module-level comments.
2017-11-08 14:49:27 -08:00
Dan Gohman
e213c2654f
Fix branch_destination/analyze_branch for BranchInt/BranchFloat.
2017-11-08 10:58:03 -08:00
Dan Gohman
889b06fd16
Replace as casts with type-conversion functions.
2017-11-08 10:48:44 -08:00
Dan Gohman
7c579a80c2
Avoid an unneeded .into_iter().
2017-11-08 10:43:12 -08:00
Dan Gohman
d939bc5137
Use is_empty() instead of comparing len() with 0.
2017-11-08 10:43:12 -08:00
Dan Gohman
5d3ae0596c
Avoid matching with reference patterns.
2017-11-08 10:43:12 -08:00
Dan Gohman
809e2f0c91
Avoid unneeded return keywords.
2017-11-08 10:43:12 -08:00
Dan Gohman
0d825b4643
Remove a redundant .into().
2017-11-08 10:43:11 -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
388ebde41d
Use .any(...) rather than .position(...).is_some().
2017-11-08 10:40:42 -08:00
Dan Gohman
8b053aa923
Remove a trivial cast.
2017-11-08 10:40:39 -08:00
Dan Gohman
24e185c8c5
Remove unnecessary parens.
2017-11-08 10:40:37 -08:00
Dan Gohman
d7796cbf25
Suppress an unused-import warning on AsciiExt.
...
See
https://users.rust-lang.org/t/psa-dealing-with-warning-unused-import-std-ascii-asciiext-in-today-s-nightly/13726
for details.
2017-11-08 10:40:29 -08:00
Dan Gohman
2b6502ac6e
Fix handling of CFG triangles in compute_postorder.
...
For example, in `loops_one`, ebb3 is the bottom of a triangle, so
postorder should order it after the rest of the triangle.
2017-11-07 16:57:22 -08:00
Dan Gohman
849f090562
Fix nondeterminism in br_table translation.
2017-11-07 15:33:35 -08:00
Dan Gohman
15aff899ee
Block no longer needs to implement Hash.
2017-11-07 15:19:55 -08:00
Dan Gohman
6d91a32d39
Add comments about "user" parameters.
2017-11-07 15:13:46 -08:00
Dan Gohman
cbb99bf233
Rename "user_arg_count" to "user_param_count" for consistency.
2017-11-07 15:13:46 -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
f76640778c
Fix printing with -p when -c is also given.
2017-11-06 16:28:15 -08:00
Dan Gohman
5dda19035d
Implement Hash for ExternalName.
...
This allows users to have HashMaps etc. with ExternalNames as keys.
2017-11-06 11:34:09 -08:00
Dan Gohman
1d8df2ed1e
Remove the requirement that Variable implement Default.
2017-11-06 11:10:14 -08:00
Dan Gohman
4091688cc0
Avoid unnecessary name qualification.
2017-11-06 11:10:03 -08:00
Dan Gohman
d9743290ea
Elide elidable lifetime parameters.
2017-11-06 11:09:56 -08:00
Dan Gohman
9ee6e740b0
Merge pull request #3 from m4b/patch-1
...
obj: minor fix to emit_module compile
2017-11-05 14:03:58 -08:00
m4b
89d3038c1c
obj: minor fix to emit_module compile
2017-11-05 00:03:56 -07:00
Dan Gohman
114da83ad6
Avoid using to_string() on ExternalName to create strings for symbol names.
...
ExternalName's `to_string()` prepends a '%' for Cretonne's text syntax,
but for creating symbol names we just want the raw bytes.
2017-11-04 15:29:16 -07:00
Dan Gohman
be9e3e88e4
Emit wasm data initializers as faerie data segments.
...
This is a temporary measure while other parts of the system are being
developed, and will need to be replaced by a proper solution.
2017-11-04 15:28:19 -07:00
Dan Gohman
8501cb798e
Minor comment cleanups.
2017-11-03 16:43:29 -07:00