-
Notifications
You must be signed in to change notification settings - Fork 13.3k
WIP Introduce ConstValue::ScalarPair #115915
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
Conversation
r? @jackh726 (rustbot has picked a reviewer for you, use r? to override) |
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
WIP Replace ConstValue::Slice by ConstValue::ScalarPair Both the interpreter and codegen have dedicated paths for scalar pairs. Having one in ConstValue makes is able to represent all "immediate" values. In order to mitigate the increase in the size of the ConstValue struct, a first commit interns it.
b07c1b4
to
e91604e
Compare
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
WIP Replace ConstValue::Slice by ConstValue::ScalarPair Both the interpreter and codegen have dedicated paths for scalar pairs. Having one in ConstValue makes is able to represent all "immediate" values. In order to mitigate the increase in the size of the ConstValue struct, a first commit interns it.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
💔 Test failed - checks-actions |
e91604e
to
a8c8dea
Compare
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
WIP Replace ConstValue::Slice by ConstValue::ScalarPair Both the interpreter and codegen have dedicated paths for scalar pairs. Having one in ConstValue makes is able to represent all "immediate" values. In order to mitigate the increase in the size of the ConstValue struct, a first commit interns it.
This comment has been minimized.
This comment has been minimized.
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (f827ada): comparison URL. Overall result: ❌✅ regressions and improvements - 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. Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @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.
Binary sizeResultsThis 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.
Bootstrap: 636.351s -> 636.345s (-0.00%) |
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
WIP Introduce ConstValue::ScalarPair Both the interpreter and codegen have dedicated paths for scalar pairs. Having one in ConstValue makes is able to represent all "immediate" values. In order to mitigate the increase in the size of the ConstValue struct, a first commit interns it.
The job Click to see the possible cause of the failure (guessed by this bot)
|
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (1b3ed3e): comparison URL. Overall result: ❌✅ regressions and improvements - 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. Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @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.
Binary sizeResultsThis 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.
Bootstrap: 634.064s -> 635.805s (0.27%) |
We had I have laid down my vision for how |
/// Represents a constant value in Rust. `Scalar` and `Slice` are optimizations for | ||
/// array length computations, enum discriminants and the pattern matching logic. | ||
#[derive(Copy, Clone, Debug, Eq, PartialEq, TyEncodable, TyDecodable, Hash)] | ||
#[derive(HashStable, Lift)] | ||
pub enum ConstValue<'tcx> { | ||
pub enum ConstValueKind<'tcx> { | ||
/// Used for types with `layout::abi::Scalar` ABI. | ||
/// | ||
/// Not using the enum `Value` to encode that this must not be `Uninit`. |
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 do wonder which enum this refers to... I think it's just a very outdated comment.^^
@@ -50,7 +57,7 @@ pub enum ConstValue<'tcx> { | |||
|
|||
/// A value not representable by the other variants; needs to be stored in-memory. | |||
/// | |||
/// Must *not* be used for scalars or ZST, but having `&str` or other slices in this variant is fine. | |||
/// Must *not* be used for scalars, scalar pairs or ZST. |
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.
Your const_to_op
violates this rule for scalar pairs. Either the comment or const_to_op
need to be updated.
@@ -65,35 +72,48 @@ pub enum ConstValue<'tcx> { | |||
} | |||
|
|||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))] | |||
static_assert_size!(ConstValue<'_>, 32); | |||
static_assert_size!(ConstValue<'_>, 8); |
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.
That doesn't seem like a useful assertion, it's an interned pointer now...
/// Used for types with `layout::abi::ScalarPair` ABI. | ||
/// | ||
/// Not using the enum `Value` to encode that this must not be `Uninit`. | ||
ScalarPair(Scalar, Scalar), |
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.
We definitely don't want to have ScalarPair
and Slice
. Why would that make sense?
Closing this as it is WIP and heavily bitrotted |
Both the interpreter and codegen have dedicated paths for scalar pairs. Having one in ConstValue makes is able to represent all "immediate" values.
In order to mitigate the increase in the size of the ConstValue struct, a first commit interns it.