summary refs log tree commit diff
path: root/src/librustc_data_structures
AgeCommit message (Collapse)AuthorLines
2016-11-03Auto merge of #36306 - nagisa:mir-local-cleanup, r=eddybbors-0/+15
A way to remove otherwise unused locals from MIR There is a certain amount of desire for a pass which cleans up the provably unused variables (no assignments or reads). There has been an implementation of such pass by @scottcarr, and another (two!) implementations by me in my own dataflow efforts. PR like https://github.com/rust-lang/rust/pull/35916 proves that this pass is useful even on its own, which is why I cherry-picked it out from my dataflow effort. @nikomatsakis previously expressed concerns over this pass not seeming to be very cheap to run and therefore unsuitable for regular cleanup duties. Turns out, regular cleanup of local declarations is not at all necessary, at least now, because majority of passes simply do not (or should not) care about them. That’s why it is viable to only run this pass once (perhaps a few more times in the future?) per function, right before translation. r? @eddyb or @nikomatsakis
2016-11-03A way to remove otherwise unused locals from MIRSimonas Kazlauskas-0/+15
Replaces the hack where a similar thing is done within trans.
2016-11-02Optimize ObligationForest's NodeState handling.Nicholas Nethercote-34/+37
This commit partially inlines two functions, `find_cycles_from_node` and `mark_as_waiting_from`, at two call sites in order to avoid function unnecessary function calls on hot paths. It also fully inlines and removes `is_popped`. These changes speeds up rustc-benchmarks/inflate-0.1.0 by about 2% when doing debug builds with a stage1 compiler.
2016-10-30Replace all uses of SHA-256 with BLAKE2b.Michael Woerister-16/+100
2016-10-26Auto merge of #37270 - Mark-Simulacrum:smallvec-optimized-arenas, r=eddybbors-0/+163
Add ArrayVec and AccumulateVec to reduce heap allocations during interning of slices Updates `mk_tup`, `mk_type_list`, and `mk_substs` to allow interning directly from iterators. The previous PR, #37220, changed some of the calls to pass a borrowed slice from `Vec` instead of directly passing the iterator, and these changes further optimize that to avoid the allocation entirely. This change yields 50% less malloc calls in [some cases](https://pastebin.mozilla.org/8921686). It also yields decent, though not amazing, performance improvements: ``` futures-rs-test 4.091s vs 4.021s --> 1.017x faster (variance: 1.004x, 1.004x) helloworld 0.219s vs 0.220s --> 0.993x faster (variance: 1.010x, 1.018x) html5ever-2016- 3.805s vs 3.736s --> 1.018x faster (variance: 1.003x, 1.009x) hyper.0.5.0 4.609s vs 4.571s --> 1.008x faster (variance: 1.015x, 1.017x) inflate-0.1.0 3.864s vs 3.883s --> 0.995x faster (variance: 1.232x, 1.005x) issue-32062-equ 0.309s vs 0.299s --> 1.033x faster (variance: 1.014x, 1.003x) issue-32278-big 1.614s vs 1.594s --> 1.013x faster (variance: 1.007x, 1.004x) jld-day15-parse 1.390s vs 1.326s --> 1.049x faster (variance: 1.006x, 1.009x) piston-image-0. 10.930s vs 10.675s --> 1.024x faster (variance: 1.006x, 1.010x) reddit-stress 2.302s vs 2.261s --> 1.019x faster (variance: 1.010x, 1.026x) regex.0.1.30 2.250s vs 2.240s --> 1.005x faster (variance: 1.087x, 1.011x) rust-encoding-0 1.895s vs 1.887s --> 1.005x faster (variance: 1.005x, 1.018x) syntex-0.42.2 29.045s vs 28.663s --> 1.013x faster (variance: 1.004x, 1.006x) syntex-0.42.2-i 13.925s vs 13.868s --> 1.004x faster (variance: 1.022x, 1.007x) ``` We implement a small-size optimized vector, intended to be used primarily for collection of presumed to be short iterators. This vector cannot be "upsized/reallocated" into a heap-allocated vector, since that would require (slow) branching logic, but during the initial collection from an iterator heap-allocation is possible. We make the new `AccumulateVec` and `ArrayVec` generic over implementors of the `Array` trait, of which there is currently one, `[T; 8]`. In the future, this is likely to expand to other values of N. Huge thanks to @nnethercote for collecting the performance and other statistics mentioned above.
2016-10-25Add AccumulateVec, a potentially stack-allocated vector.Mark-Simulacrum-0/+163
AccumulateVec is generic over the Array trait, which is currently only implemented for [T; 8].
2016-10-22Auto merge of #37294 - nikomatsakis:issue-37154, r=nikomatsakisbors-15/+46
remove keys w/ skolemized regions from proj cache when popping skolemized regions This addresses #37154 (a regression). The projection cache was incorrectly caching the results for skolemized regions -- when we pop skolemized regions, we are supposed to drop cache keys for them (just as we remove those skolemized regions from the region inference graph). This is because those skolemized region numbers will be reused later with different meaning (and we have determined that the old ones don't leak out in any meaningful way). I did a *somewhat* aggressive fix here of only removing keys that mention the skolemized regions. One could imagine just removing all keys added since we started the skolemization (as indeed I did in my initial commit). This more aggressive fix required fixing a latent bug in `TypeFlags`, as an aside. I believe the more aggressive fix is correct; clearly there can be entries that are unrelated to the skoelemized region, and it's a shame to remove them. My one concern was that it *is* possible I believe to have some region variables that are created and related to skolemized regions, and maybe some of them could end up in the cache. However, that seems harmless enough to me-- those relations will be removed, and couldn't have impacted how trait resolution proceeded anyway (iow, the cache entry is not wrong, though it is kind of useless). r? @pnkfelix cc @arielb1
2016-10-22Rollup merge of #37286 - srinivasreddy:graph, r=nrcGuillaume Gomez-2/+2
run rustfmt on graph folder
2016-10-21only remove keys that mention skolemized regionsNiko Matsakis-3/+7
2016-10-21when pop skol, also remove from proj cacheNiko Matsakis-15/+42
2016-10-19Rollup merge of #37288 - srinivasreddy:snapshot_map, r=eddybGuillaume Gomez-8/+9
run rustfmt on snapshot_map
2016-10-19Rollup merge of #37287 - srinivasreddy:unify, r=eddybGuillaume Gomez-8/+6
run rustfmt on unify folder
2016-10-20run rustfmt on snapshot_mapSrinivas Reddy Thatiparthy-8/+9
2016-10-20run rustfmt on unify folderSrinivas Reddy Thatiparthy-8/+6
2016-10-20run rustfmt on graph folderSrinivas Reddy Thatiparthy-2/+2
2016-10-20run rustfmt on control_flow_graph folderSrinivas Reddy Thatiparthy-89/+48
2016-10-19Rollup merge of #37233 - michaelwoerister:blake2-for-ich, r=nikomatsakisEduard-Mihai Burtescu-0/+287
ICH: Use 128-bit Blake2b hash instead of 64-bit SipHash for incr. comp. fingerprints This PR makes incr. comp. hashes 128 bits wide in order to push collision probability below a threshold that we need to worry about. It also replaces SipHash, which has been mentioned multiple times as not being built for fingerprinting, with the [BLAKE2b hash function](https://blake2.net/), an improved version of the BLAKE sha-3 finalist. I was worried that using a cryptographic hash function would make ICH computation noticeably slower, but after doing some performance tests, I'm not any more. Most of the time BLAKE2b is actually faster than using two SipHashes (in order to get 128 bits): ``` SipHash libcore: 0.199 seconds libstd: 0.090 seconds BLAKE2b libcore: 0.162 seconds libstd: 0.078 seconds ``` If someone can prove that something like MetroHash128 provides a comparably low collision probability as BLAKE2, I'm happy to switch. But for now we are at least not taking a performance hit. I also suggest that we throw out the sha-256 implementation in the compiler and replace it with BLAKE2, since our sha-256 implementation is two to three times slower than the BLAKE2 implementation in this PR (cc @alexcrichton @eddyb @brson) r? @nikomatsakis (although there's not much incr. comp. specific in here, so feel free to re-assign)
2016-10-17Set stalled=false when encountering an errorJonas Schievink-0/+1
2016-10-17ICH: Use 128-bit Blake2b hash instead of 64-bit SipHash for incr. comp. ↵Michael Woerister-0/+287
fingerprints.
2016-10-17Don't process cycles when stalledJonas Schievink-0/+10
This improves the `inflate-0.1.0` benchmark by about 10% for me.
2016-10-10Move IdxSetBuf and BitSlice to rustc_data_structuresWesley Wiser-0/+300
Resolves a FIXME
2016-09-25Add support for the Haiku operating system on x86 and x86_64 machinesNiels Sascha Reedijk-0/+21
* Hand rebased from Niels original work on 1.9.0
2016-09-11Documentation of what does for each typeathulappadan-0/+1
2016-09-01ICH: Adapt to changes in the MetaItem AST representation.Michael Woerister-0/+6
2016-08-29incr.comp.: Move lock files out of directory being lockedMichael Woerister-20/+35
2016-08-29Implement copy-on-write scheme for managing the incremental compilation cache.Michael Woerister-0/+2
2016-08-29Add some features to flock.Michael Woerister-21/+105
2016-08-29Move `flock.rs` from librustdoc to librustc_data_structures.Michael Woerister-0/+241
2016-08-09generalize BitMatrix to be NxM and not just NxNNiko Matsakis-17/+69
2016-08-09isolate predecessor computationNiko Matsakis-18/+50
The new `Predecessors` type computes a set of interesting targets and their HIR predecessors, and discards everything in between.
2016-07-02Auto merge of #34605 - arielb1:bug-in-the-jungle, r=eddybbors-8/+67
fail obligations that depend on erroring obligations Fix a bug where an obligation that depend on an erroring obligation would be regarded as successful, leading to global cache pollution and random lossage. Fixes #33723. Fixes #34503. r? @eddyb since @nikomatsakis is on vacation beta-nominating because of the massive lossage potential (e.g. with `Copy` this could lead to random memory leaks), plus this is a regression.
2016-07-02fail obligations that depend on erroring obligationsAriel Ben-Yehuda-8/+67
Fix a bug where an obligation that depend on an erroring obligation would be regarded as successful, leading to global cache pollution and random lossage. Fixes #33723. Fixes #34503.
2016-06-28refactor rustc_metadata to use CamelCase names and IndexVecAriel Ben-Yehuda-0/+6
2016-06-23add control flow graph and algorithms. add dominator to mirScott A Carr-1/+830
2016-06-14Auto merge of #34221 - srinivasreddy:rm_redundant, r=alexcrichtonbors-15/+1
remove redundant test case in bitvector.rs `bitvec_iter_works_2` does exactly same as `bitvec_iter_works_1`, so i removed it.
2016-06-11Add additional test cases to test all arities of tuple; And remove type ↵Srinivas Reddy Thatiparthy-8/+18
suffix - i32 on integers
2016-06-11remove redundant test caseSrinivas Reddy Thatiparthy-15/+1
2016-06-09make the basic_blocks field privateAriel Ben-Yehuda-1/+20
2016-06-09introduce the type-safe IdxVec and use it instead of loose indexesAriel Ben-Yehuda-0/+210
2016-06-05Auto merge of #33999 - scottcarr:master, r=nikomatsakisbors-1/+1
generate fewer basic blocks for variant switches CC #33567 Adds a new field to TestKind::Switch that tracks the variants that are actually matched against. The other candidates target a common "otherwise" block.
2016-06-01switch to BitVector, simplify target_block logicScott A Carr-1/+1
clarify comments and panic message
2016-05-31add a snapshottable hashmapNiko Matsakis-0/+189
2016-05-18identify inputs of `MetaData(X)` nodesNiko Matsakis-4/+10
Generate a second hash file that contains the metadata for an X node.
2016-05-16Auto merge of #33491 - arielb1:obligation-jungle, r=nikomatsakisbors-411/+641
Replace the obligation forest with a graph In the presence of caching, arbitrary nodes in the obligation forest can be merged, which makes it a general graph. Handle it as such, using cycle-detection algorithms in the processing. I should do performance measurements sometime. This was pretty much written as a proof-of-concept. Please help me write this in a less-ugly way. I should also add comments explaining what is going on. r? @nikomatsakis
2016-05-13address review commentsAriel Ben-Yehuda-56/+81
2016-05-13add cycle-reporting logicAriel Ben-Yehuda-81/+111
Fixes #33344
2016-05-13rewrite obligation forest. cycles still handled incorrectly.Ariel Ben-Yehuda-370/+545
2016-05-11Plumb inference obligations through selectionMasood Malekghassemi-0/+8
2016-04-28Make the codegen unit partitioner also emit item declarations.Michael Woerister-11/+22
2016-04-03Use a BitVector instead of Vec<bool> for recording cleanup blocksJames Miller-1/+26
Also adds a FromIterator impl for BitVector to allow construction of a BitVector from an iterator yeilding bools.