about summary refs log tree commit diff
path: root/compiler/rustc_data_structures/src/fingerprint.rs
AgeCommit message (Collapse)AuthorLines
2022-02-22Provide copy-free access to raw Decoder bytesMark Rousskov-3/+1
2022-02-02Rollup merge of #92528 - tmiasko:combine-commutative, r=michaelwoeristerMatthias Krüger-1/+4
Make `Fingerprint::combine_commutative` associative The previous implementation swapped lower and upper 64-bits of a result of modular addition, so the function was non-associative. r? `@Aaron1011`
2022-01-22Make `Decodable` and `Decoder` infallible.Nicholas Nethercote-5/+5
`Decoder` has two impls: - opaque: this impl is already partly infallible, i.e. in some places it currently panics on failure (e.g. if the input is too short, or on a bad `Result` discriminant), and in some places it returns an error (e.g. on a bad `Option` discriminant). The number of places where either happens is surprisingly small, just because the binary representation has very little redundancy and a lot of input reading can occur even on malformed data. - json: this impl is fully fallible, but it's only used (a) for the `.rlink` file production, and there's a `FIXME` comment suggesting it should change to a binary format, and (b) in a few tests in non-fundamental ways. Indeed #85993 is open to remove it entirely. And the top-level places in the compiler that call into decoding just abort on error anyway. So the fallibility is providing little value, and getting rid of it leads to some non-trivial performance improvements. Much of this commit is pretty boring and mechanical. Some notes about a few interesting parts: - The commit removes `Decoder::{Error,error}`. - `InternIteratorElement::intern_with`: the impl for `T` now has the same optimization for small counts that the impl for `Result<T, E>` has, because it's now much hotter. - Decodable impls for SmallVec, LinkedList, VecDeque now all use `collect`, which is nice; the one for `Vec` uses unsafe code, because that gave better perf on some benchmarks.
2022-01-03Make `Fingerprint::combine_commutative` associativeTomasz Miąsko-1/+4
The previous implementation swapped lower and upper 64-bits of a result of modular addition, so the function was non-associative.
2021-12-09Remove redundant [..]sest31-2/+2
2021-03-25Allow for reading raw bytes from rustc_serialize::Decoder without unsafe code.Michael Woerister-8/+28
2021-03-19Remove FingerprintEncoder/Decoder.Camille GILLOT-56/+10
2021-03-19Move raw bytes handling to Encoder/Decoder.Camille GILLOT-2/+2
2021-02-04Add documentation to Unhasher impl for Fingerprint.Michael Woerister-1/+12
2021-02-02Let a portion of DefPathHash uniquely identify the DefPath's crate.Michael Woerister-2/+13
This allows to directly map from a DefPathHash to the crate it originates from, without constructing side tables to do that mapping. It also allows to reliably and cheaply check for DefPathHash collisions.
2021-01-11Serialize incr comp structures to file via fixed-size bufferTyson Nottingham-10/+12
Reduce a large memory spike that happens during serialization by writing the incr comp structures to file by way of a fixed-size buffer, rather than an unbounded vector. Effort was made to keep the instruction count close to that of the previous implementation. However, buffered writing to a file inherently has more overhead than writing to a vector, because each write may result in a handleable error. To reduce this overhead, arrangements are made so that each LEB128-encoded integer can be written to the buffer with only one capacity and error check. Higher-level optimizations in which entire composite structures can be written with one capacity and error check are possible, but would require much more work. The performance is mostly on par with the previous implementation, with small to moderate instruction count regressions. The memory reduction is significant, however, so it seems like a worth-while trade-off.
2021-01-01rustc_serialize: have read_raw_bytes take MaybeUninit<u8> sliceTyson Nottingham-2/+2
2020-11-18Make PackedFingerprint's Fingerprint privateTyson Nottingham-1/+18
2020-11-18Use PackedFingerprint in DepNode to reduce memory consumptionTyson Nottingham-0/+42
2020-10-13Replace absolute paths with relative onesest31-2/+2
Modern compilers allow reaching external crates like std or core via relative paths in modules outside of lib.rs and main.rs.
2020-09-01Avoid rehashing Fingerprint as a map keyJosh Stone-1/+29
This introduces a no-op `Unhasher` for map keys that are already hash- like, for example `Fingerprint` and its wrapper `DefPathHash`. For these we can directly produce the `u64` hash for maps. The first use of this is `def_path_hash_to_def_id: Option<UnhashMap<DefPathHash, DefId>>`.
2020-08-30mv compiler to compiler/mark-0/+130