-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
some ConstValue refactoring #115764
some ConstValue refactoring #115764
Conversation
Some changes occurred in src/tools/clippy cc @rust-lang/clippy Some changes occurred to the CTFE / Miri engine cc @rust-lang/miri Some changes occurred to the CTFE / Miri engine cc @rust-lang/miri Some changes occurred in compiler/rustc_codegen_cranelift cc @bjorn3 This PR changes Stable MIR cc @oli-obk, @celinval, @spastorino Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt |
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
use AllocId instead of Allocation in ConstValue::ByRef This helps avoid redundant AllocIds when a `ByRef` constant gets put back into the interpreter. r? `@oli-obk`
This comment has been minimized.
This comment has been minimized.
Ah I guess we don't want to print these ByRef allocations -- at least currently one couldn't even tell where they are referenced in the code, I think. |
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
The Miri subtree was changed cc @rust-lang/miri |
Finished benchmarking commit (993d146): comparison URL. Overall result: no relevant changes - 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 benchmark run did not return any relevant results for this metric. 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.
CyclesThis benchmark run did not return any relevant results for this metric. Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 629.503s -> 630.23s (0.12%) |
Okay, so doing it just for @bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
use AllocId instead of Allocation in ConstValue::ByRef This helps avoid redundant AllocIds when a `ByRef` constant gets put back into the interpreter. r? `@oli-obk`
This comment has been minimized.
This comment has been minimized.
let len: usize = len.try_into().unwrap(); | ||
ConstValue::Slice { data, start, end: start + len } | ||
ConstValue::Slice { alloc_id, start, end: start + len } |
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.
Uh, I just realized that valtree-to-const-value will hit this code path for all wide pointers, e.g. &[u32]
. That doesn't seem right? Certainly we didn't write the start
/end
logic thinking about anything besides u8
/str
...
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 should probably generalize ConstValue::Slice
to be used for arbitrary types that have a slice as their unsized tail. That justifies how valtrees are using them in valtree-to-constval conversion.
But that's for a future PR.
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'm still hoping to be able to revive my ConstValue::Slice removal PR
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.
Honestly, with the simplification of op_to_const in this PR, the Slice variant isn't so bad any more. In particular these days it seems to be okay to have slices in ConstValue::ByRef
, they don't have to be in ConstValue::Slice
, and then it's pretty okay.
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.
Let's leave fixing the valtree problem to the next PR; this one is ready now.
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
3163962
to
cf9e6ab
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
0acd76c
to
6a1c887
Compare
@bors r+ |
@bors r+ |
ed41c1e
to
053173d
Compare
Ah, I was working on a lengthy comment to better explain what happens in I think I'm finally almost happy with the state of that function. :) it only took like 4 years or so.^^ @bors r=oli-obk |
053173d
to
04a4df5
Compare
@bors r=oli-obk |
☀️ Test successful - checks-actions |
Finished benchmarking commit (d97e04f): comparison URL. Overall result: ✅ improvements - no action needed@rustbot label: -perf-regression 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.
CyclesThis benchmark run did not return any relevant results for this metric. Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 632.387s -> 631.221s (-0.18%) |
make the eval() functions on our const types return the resulting value This is a part of rust-lang/rust#115748 that's hopefully perf-neutral, and that does not depend on rust-lang/rust#115764.
In particular, use AllocId instead of Allocation in ConstValue::ByRef. This helps avoid redundant AllocIds when a
ByRef
constant gets put back into the interpreter.r? @oli-obk
Fixes #105536