-
Notifications
You must be signed in to change notification settings - Fork 13k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rustc_metadata: Support non-Option
nullable values in metadata tables
#107166
Conversation
r? @oli-obk (rustbot has picked a reviewer for you, use r? to override) |
This shouldn't affect performance if inlining is decent, but let's check. |
This comment has been minimized.
This comment has been minimized.
⌛ Trying commit cb57ec1aea24c81c20fd61e2aac5e2840d34bf77 with merge 377b124a5ae81e42de3f95818dea84ff400107f1... |
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (377b124a5ae81e42de3f95818dea84ff400107f1): comparison URL. Overall result: ✅ improvements - no action neededBenchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf. @bors rollup=never Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
|
@bors rollup=maybe |
is_intrinsic: Table<DefIndex, bool>, | ||
is_macro_rules: Table<DefIndex, bool>, | ||
is_type_alias_impl_trait: Table<DefIndex, bool>, | ||
may_have_doc_links: Table<DefIndex, bool>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can explicit_item_bounds
and inferred_outlives_of
be migrated to this setup?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like it's a bit more involved because you need to make the table.get(...).decode(...).process_decoded(...)
chain fast for LazyArray
s without using None
to skip all the extra work.
I'll try, but probably closer to the next weekend.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
r=me on this PR if you want to do that in a separate PR
} | ||
|
||
impl<I: Idx, const N: usize, T: FixedSizeEncoding<ByteArray = [u8; N]>> TableBuilder<I, T> { | ||
pub(crate) fn set_nullable(&mut self, i: I, value: T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should have a convenience wrapper around set_nullable
for TableBuilder<I, bool>
to just set it to true
. Invoking set_nullable(val, false)
is never done and likely a bug.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Together with #107166 (comment) I'll try to move the true/false conditions to inside the set
methods.
So it will look approximately like this
fn set(value) {
if value.is_default() {
return;
}
// possibly resize the buffer and set the non-default value
}
and false
/None
/etc arguments will be accepted but result in doing nothing.
The "reset to None
" semantic is never currently used for metadata tables, but if it will be needed it will require a separate method like fn clear
in this case.
@bors r=oli-obk |
📌 Commit cb57ec1aea24c81c20fd61e2aac5e2840d34bf77 has been approved by It is now in the queue for this repository. |
This comment was marked as resolved.
This comment was marked as resolved.
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 rust-lang#107136 in particular.
cb57ec1
to
91fdbd7
Compare
@bors r=oli-obk |
rustc_metadata: Support non-`Option` nullable values in metadata tables 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 rust-lang#107136 in particular.
Rollup of 9 pull requests Successful merges: - rust-lang#105552 (Add help message about function pointers) - rust-lang#106583 (Suggest coercion of `Result` using `?`) - rust-lang#106767 (Allow setting CFG_DISABLE_UNSTABLE_FEATURES to 0) - rust-lang#106823 (Allow fmt::Arguments::as_str() to return more Some(_).) - rust-lang#107166 (rustc_metadata: Support non-`Option` nullable values in metadata tables) - rust-lang#107213 (Add suggestion to remove if in let..else block) - rust-lang#107223 (`sub_ptr()` is equivalent to `usize::try_from().unwrap_unchecked()`, not `usize::from().unwrap_unchecked()`) - rust-lang#107227 (`new_outside_solver` -> `evaluate_root_goal`) - rust-lang#107232 (rustdoc: simplify settings popover DOM, CSS, JS) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
rustc_metadata: Encode/decode some `LazyArrays` without an `Option` and a couple of related changes, see individual commits. Addresses comments in rust-lang#107166 (comment) and rust-lang#107166 (comment), cc `@cjgillot` `@oli-obk.`
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 #107136 in particular.