Uh oh!
There was an error while loading. Please reload this page.
always back ty::Const by an Allocation - #58486
Conversation
ty::Const ty an Allocationty::Const by an Allocation
This comment has been minimized.
This comment has been minimized.
Uh oh!
There was an error while loading. Please reload this page.
| #[cfg(target_arch = "x86_64")] | ||
| static_assert!(LAZY_CONST_SIZE: ::std::mem::size_of::<LazyConst<'static>>() == 56); | ||
| static_assert!(LAZY_CONST_SIZE: ::std::mem::size_of::<LazyConst<'static>>() == 80); |
There was a problem hiding this comment.
And this isn't a problem? Let's do a perf run.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
oli-obk
commented
Feb 15, 2019
@bors try |
bors
commented
Feb 15, 2019
always back `ty::Const` by an `Allocation` This reduces the number of conversion between `Allocation` and `Value` by caching both. r? @RalfJung
Uh oh!
There was an error while loading. Please reload this page.
bors
commented
Feb 15, 2019
☀️ Test successful - checks-travis |
oli-obk
commented
Feb 15, 2019
@rust-timer build dc96b91 |
rust-timer
commented
Feb 15, 2019
Success: Queued dc96b91 with parent f058741, comparison URL. |
rust-timer
commented
Feb 15, 2019
Finished benchmarking try commit dc96b91 |
RalfJung
commented
Feb 15, 2019
max-rss regressed noticeably, mostly for tuple-stress. |
| if self.alloc_map.contains_key(&alloc) { | ||
| // Not yet interned, so proceed recursively | ||
| self.intern_static(alloc, mutability)?; | ||
| let _alloc = self.intern_static(alloc, mutability)?; |
There was a problem hiding this comment.
Why bind this to an unused variable?
| let field = ecx.mplace_field(down, field.index() as u64)?; | ||
| let val = match field.layout.abi { | ||
| layout::Abi::Scalar(..) => { | ||
| let scalar = ecx.try_read_immediate_from_mplace(field)?.unwrap().to_scalar()?; |
There was a problem hiding this comment.
Couldn't you use try_read_immediate(field.into())? Then we could avoid exposing that internal function try_read_immediate_from_mplace.
Uh oh!
There was an error while loading. Please reload this page.
| }; | ||
| let ptr = Pointer::from(constant.alloc_id); | ||
| let alloc = constant.alloc; | ||
| Ok(ty::Const { val, ty: mplace.layout.ty, alloc: Some((alloc, ptr))}) |
There was a problem hiding this comment.
The code above here is basically mplace_to_const, right? And we have the same in const_field, don't we? Couldn't that become a helper function?
| let err = error_to_const_error(&ecx, error); | ||
| // FIXME(oli-obk): I believe this is unreachable and we can just ICE here. Since a constant | ||
| // is checked for validity before being in a place that could pass it to `const_field`, | ||
| // we can't possibly have errors. All fields have already been checked. |
There was a problem hiding this comment.
Could/should this FIXME be ported to the other PR?
There was a problem hiding this comment.
I'm trying this out locally in a different branch, so there's no reason to add it to the source tree
Const to op simplification r? @RalfJung alternative to rust-lang#58486
Const to op simplification r? @RalfJung alternative to rust-lang#58486
Const to op simplification r? @RalfJung alternative to rust-lang#58486
Const to op simplification r? @RalfJung alternative to rust-lang#58486
bors
commented
Feb 24, 2019
☔ The latest upstream changes (presumably #58691) made this pull request unmergeable. Please resolve the merge conflicts. |
RalfJung
commented
Feb 24, 2019
I believe this got superseded by #58511 and can be closed? |
This reduces the number of conversion between
AllocationandValueby caching both.r? @RalfJung