summary refs log tree commit diff
path: root/src/librustc_data_structures
AgeCommit message (Collapse)AuthorLines
2017-01-29Remove dead recursive partial eq implest31-9/+1
Its nowhere used (if it had been used used, the rust stack would have overflown due to the recursion). Its presence was confusing for mrustc.
2017-01-15Auto merge of #38610 - djzin:master, r=sfacklerbors-2/+12
Implementation of plan in issue #27787 for btree_range Still some ergonomics to be worked on, the ::<str,_> is particularly unsightly
2017-01-14add required imports & featureDjzin-0/+2
2017-01-14update array_vec to use new rangeargumentdjzin-2/+10
2017-01-12Mark some BitVector methods with #[inline]Michael Woerister-0/+9
2017-01-10Use little-endian encoding for Blake2 hashing on all architecturesAriel Ben-Yehuda-6/+10
Like many hash functions, the blake2 hash is mathematically defined on a sequence of 64-bit words. As Rust's hash interface operates on sequences of octets, some encoding must be used to bridge that difference. The Blake2 RFC (RFC 7693) specifies that: Byte (octet) streams are interpreted as words in little-endian order, with the least-significant byte first. So use that encoding consistently. Fixes #38891.
2017-01-08Auto merge of #38679 - alexcrichton:always-deny-warnings, r=nrcbors-1/+1
Remove not(stage0) from deny(warnings) Historically this was done to accommodate bugs in lints, but there hasn't been a bug in a lint since this feature was added which the warnings affected. Let's completely purge warnings from all our stages by denying warnings in all stages. This will also assist in tracking down `stage0` code to be removed whenever we're updating the bootstrap compiler.
2017-01-03Add drain method to AccumulateVec/ArrayVecAndrew Cann-1/+126
You can now call .drain(..) on SmallVec, AccumulateVec and ArrayVec
2016-12-30Fix rebase fallout and compilation fixesest31-2/+6
2016-12-29Remove not(stage0) from deny(warnings)Alex Crichton-1/+1
Historically this was done to accommodate bugs in lints, but there hasn't been a bug in a lint since this feature was added which the warnings affected. Let's completely purge warnings from all our stages by denying warnings in all stages. This will also assist in tracking down `stage0` code to be removed whenever we're updating the bootstrap compiler.
2016-12-18Auto merge of #38051 - sanxiyn:unused-type-alias-3, r=eddybbors-2/+0
Warn unused type aliases, reimplemented Reimplementation of #37631. Fix #37455.
2016-12-18Auto merge of #37429 - camlorn:univariant_layout_optimization, r=eddybbors-0/+6
struct field reordering and optimization This is work in progress. The goal is to divorce the order of fields in source code from the order of fields in the LLVM IR, then optimize structs (and tuples/enum variants)by always ordering fields from least to most aligned. It does not work yet. I intend to check compiler memory usage as a benchmark, and a crater run will probably be required. I don't know enough of the compiler to complete this work unaided. If you see places that still need updating, please mention them. The only one I know of currently is debuginfo, which I'm putting off intentionally until a bit later. r? @eddyb
2016-12-16flock needs repr(C)Austin Hicks-0/+6
2016-12-15Use StableHasher everywhereAriel Ben-Yehuda-0/+179
The standard implementations of Hasher have architecture-dependent results when hashing integers. This causes problems when the hashes are stored within metadata - metadata written by one host architecture can't be read by another. To fix that, implement an architecture-independent StableHasher and use it in all places an architecture-independent hasher is needed. Fixes #38177.
2016-12-15Warn unused type aliasesSeo Sanghyeon-2/+0
2016-12-12Do not generate '@' character in symbol names.Vadzim Dambrouski-0/+2
MSP430 assembler does not like '@' character in symbol names, so we should only use alphanumerics when we generate a new name. Fixes #38116
2016-11-22Use SmallVec for TypeWalker's stack.Nicholas Nethercote-0/+12
The change also adds the missing `SmallVec::truncate` method.
2016-11-18Don't clone in UnificationTable::probe().Nicholas Nethercote-1/+1
This speeds up compilation of rustc-benchmarks/inflate-0.1.0 by 1%.
2016-11-13Make names of types used in LLVM IR stable.Michael Woerister-0/+65
Before this PR, type names could depend on the cratenum being used for a given crate and also on the source location of closures. Both are undesirable for incremental compilation where we cache LLVM IR and don't want it to depend on formatting or in which order crates are loaded.
2016-11-12Rollup merge of #37551 - Mark-Simulacrum:upgrade-accvec, r=eddybEduard-Mihai Burtescu-16/+495
Replace syntax's SmallVector with AccumulateVec This adds a new type to data_structures, `SmallVec`, which wraps `AccumulateVec` with support for re-allocating onto the heap (`SmallVec::reserve`). `SmallVec` is then used to replace the implementation of `SmallVector` in libsyntax. r? @eddyb Fixes #37371. Using `SmallVec` instead of libsyntax's `SmallVector` will provide the `N = 2/4` case easily (just needs a few more `Array` impls). cc @nnethercote, probably interested in this area
2016-11-12Rollup merge of #37535 - Havvy:graph, r=eddybEduard-Mihai Burtescu-19/+126
Graph Changes General cleanup and adding a few methods that I want to use in Clippy. Need somebody to bikeshed names.
2016-11-11Change implementation of syntax::util::SmallVector to use ↵Mark-Simulacrum-16/+495
data_structures::SmallVec.
2016-11-08Replace FnvHasher use with FxHasher.Nicholas Nethercote-8/+9
This speeds up compilation by 3--6% across most of rustc-benchmarks.
2016-11-08Add FxHasher, a faster alternative to FnvHasher.Nicholas Nethercote-0/+115
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-02Added Graph::is_cyclicic_node algorithmHavvy-15/+82
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-02Change Make comment into doc comment on Graph::iterate_until_fixed_pointHavvy-8/+5
2016-11-02Added general iterators for graph nodes and edgesHavvy-4/+44
Also used those general iterators in other methods.
2016-11-01Normalize generic bounds in graph iteratorsHavvy-3/+6
Use where clasues and only where clauses for bounds in the iterators for Graph. The rest of the code uses bounds on the generic declarations for Debug, and we may want to change those to for consistency. I did not do that here because I don't know whether or not that's a good idea. But for the iterators, they were inconsistent causing confusion, at least for me.
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