about summary refs log tree commit diff
path: root/compiler/rustc_metadata/src/rmeta/table.rs
AgeCommit message (Collapse)AuthorLines
2024-12-04Remove some noisy tracingOli Scherer-3/+0
2024-11-21Implement the unsafe-fields RFC.Luca Versari-0/+7
Co-Authored-By: Jacob Pratt <jacob@jhpratt.dev>
2024-11-04ty::KContainer -> ty::AssocItemContainer::KMichael Goulet-2/+2
2024-08-26Stop using a special inner body for the coroutine by-move body for async ↵Michael Goulet-0/+1
closures
2024-07-29Reformat `use` declarations.Nicholas Nethercote-2/+2
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-06-04Add safe/unsafe to static inside extern blocksSantiago Pastorino-4/+8
2024-05-23Remove `#[macro_use] extern crate tracing` from `rustc_metadata`.Nicholas Nethercote-0/+1
2024-03-12s/mt/mutability/Oli Scherer-4/+4
2024-03-12Add `nested` bool to `DefKind::Static`.Oli Scherer-2/+4
Will be used in the next commit
2024-03-12Change `DefKind::Static` to a struct variantOli Scherer-2/+2
2024-02-15Replace `NonZero::<_>::new` with `NonZero::new`.Markus Reiter-3/+3
2024-02-15Use generic `NonZero` internally.Markus Reiter-3/+3
2023-12-25Only regular coroutines have movabilityMichael Goulet-1/+2
2023-12-25Auto merge of #119226 - Mark-Simulacrum:format-efficiency, r=TaKO8Kibors-23/+36
Improve coding efficiency for RawDefId This copies the scheme already used for LazyArray, cutting a couple hundred kilobytes from libcore's metadata.
2023-12-23Specialize DefPathHash table to skip crate IDsMark Rousskov-23/+0
Instead, we store just the local crate hash as a bare u64. On decoding, we recombine it with the crate's stable crate ID stored separately in metadata. The end result is that we save ~8 bytes/DefIndex in metadata size. One key detail here is that we no longer distinguish in encoded metadata between present and non-present DefPathHashes. It used to be highly likely we could distinguish as we used DefPathHash::default(), an all-zero representation. However in theory even that is fallible as nothing strictly prevents the StableCrateId from being zero.
2023-12-22Split coroutine desugaring kind from sourceMichael Goulet-10/+10
2023-12-22Improve coding efficiency for RawDefIdMark Rousskov-23/+36
This copies the scheme already used for LazyArray, cutting a couple hundred kilobytes from libcore's metadata.
2023-12-21Encode CoroutineKind directlyMichael Goulet-0/+15
2023-12-10remove redundant importssurechen-6/+1
detects redundant imports that can be eliminated. for #117772 : In order to facilitate review and modification, split the checking code and removing redundant imports code into two PR.
2023-11-26merge `DefKind::Coroutine` into `DefKind::Closure`bohan-1/+0
2023-11-22Rollup merge of #118147 - Nilstrieb:no-redundant-casts, r=WaffleLapkinMichael Goulet-1/+1
Fix some unnecessary casts `x clippy compiler -Aclippy::all -Wclippy::unnecessary_cast --fix` with some manual review to ensure every fix is correct.
2023-11-21Fix some unnecessary castsNilstrieb-1/+1
`x clippy compiler -Aclippy::all -Wclippy::unnecessary_cast --fix` with some manual review to ensure every fix is correct.
2023-11-21Fix `clippy::needless_borrow` in the compilerNilstrieb-2/+2
`x clippy compiler -Aclippy::all -Wclippy::needless_borrow --fix`. Then I had to remove a few unnecessary parens and muts that were exposed now.
2023-10-20s/Generator/Coroutine/Oli Scherer-1/+1
2023-10-17Automatically enable cross-crate inlining for small functionsBen Kimock-0/+24
2023-09-26Don't store lazyness in DefKindMichael Goulet-2/+1
2023-09-21Record asyncness span in HIRMichael Goulet-3/+3
2023-09-10Reimplement FileEncoder with a small-write optimizationBen Kimock-2/+4
2023-08-30Auto merge of #113542 - saethlin:adaptive-tables, r=b-naberbors-40/+104
Adapt table sizes to the contents This is an implementation of https://github.com/rust-lang/compiler-team/issues/666 The objective of this PR is to permit the rmeta format to accommodate larger crates that need offsets larger than a `u32` can store without compromising performance for crates that do not need such range. The second commit is a number of tiny optimization opportunities I noticed while looking at perf recordings of the first commit. The rmeta tables need to have fixed-size elements to permit lazy random access. But the size only needs to be fixed _per table_, not per element type. This PR adds another `usize` to the table header which indicates the table element size. As each element of a table is set, we keep track of the widest encoded table value, then don't bother encoding all the unused trailing bytes on each value. When decoding table elements, we copy them to a full-width array if they are not already full-width. `LazyArray` needs some special treatment. Most other values that are encoded in tables are indexes or offsets, and those tend to be small so we get to drop a lot of zero bytes off the end. But `LazyArray` encodes _two_ small values in a fixed-width table element: A position of the table and the length of the table. The treatment described above could trim zero bytes off the table length, but any nonzero length shields the position bytes from the optimization. To improve this, we interleave the bytes of position and length. This change is responsible for about half of the crate metadata win on many crates. Fixes https://github.com/rust-lang/rust/issues/112934 (probably) Fixes https://github.com/rust-lang/rust/issues/103607
2023-08-29Document in the code how this scheme worksBen Kimock-14/+22
2023-08-07Store the laziness of type aliases in the DefKindLeón Orell Valerian Liehr-1/+2
2023-07-14Micro-optimizeBen Kimock-4/+7
2023-07-13Adapt table sizes to the contentsBen Kimock-38/+91
2023-07-12Re-format let-else per rustfmt updateMark Rousskov-3/+3
2023-07-08Replace RPITIT current impl with new strategy that lowers as a GATSantiago Pastorino-1/+0
2023-05-30Lower the tracing level of some very verbose messagesOli Scherer-1/+1
2023-04-24Split `{Idx, IndexVec, IndexSlice}` into their own modulesMaybe Waffle-1/+1
2023-04-17Make `IndexVec::ensure_contains_elem` return a reference to the elementMaybe Waffle-2/+2
2023-03-18Implement FixedSizeEncoding for UnusedGenericParams.Camille GILLOT-1/+26
2023-02-14Add `of_trait` to DefKind::Impl.Camille GILLOT-1/+2
2023-02-05rustc_metadata: Encode/decode `DefPathHash`es without an `Option`Vadim Petrochenkov-7/+10
2023-02-05rustc_metadata: Support encoding/decoding `LazyArray` without an `Option`Vadim Petrochenkov-14/+48
2023-02-05rustc_metadata: Refactor lazy table reading/writingVadim Petrochenkov-33/+80
Change wording from "nullable" to "default". Introduce a trait `IsDefault` for detecting values that are encoded as zeros or not encoded at all. Add panics to impossible cases. Some other minor cleanups.
2023-01-23rustc_metadata: Support non-`Option` nullable values in metadata tablesVadim Petrochenkov-42/+30
This is a convenience feature for cases in which "no value in the table" and "default value in the table" are equivalent. Tables using `Table<DefIndex, ()>` are migrated in this PR, some other cases can be migrated later. This helps `DocFlags` in https://github.com/rust-lang/rust/pull/107136 in particular.
2023-01-21rustc_metadata: Encode `doc(hidden)` flag to metadataVadim Petrochenkov-0/+14
To retrieve these flags rustdoc currently has to mass decode full attributes for items in the whole crate tree, so it's better to pre-compute it in advance. This is especially for short-term performance of https://github.com/rust-lang/rust/pull/107054 because resolver cannot use memoization of query results yet.
2022-12-10compiler: remove unnecessary imports and qualified pathsKaDiWa-1/+0
2022-11-21Unreserve braced enum variants in value namespaceVadim Petrochenkov-2/+0
2022-09-09RPITIT placeholder itemsMichael Goulet-0/+1
2022-09-01Auto merge of #98960 - cjgillot:entry-kind, r=estebankbors-1/+16
Remove EntryKind from metadata. This PR continues the refactor of metadata emission to be more systematic, iterating on definitions and filtering based on each definition's `DefKind`. This allows to remove the large `EntryKind` enum, replaced by linear tables in metadata.
2022-09-01Always import all tracing macros for the entire crate instead of piecemeal ↵Oli Scherer-1/+0
by module