-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Change vtable memory representation to use tcx allocated allocations. #86475
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,6 +26,8 @@ pub trait ConstMethods<'tcx>: BackendTypes { | |
fn const_to_opt_uint(&self, v: Self::Value) -> Option<u64>; | ||
fn const_to_opt_u128(&self, v: Self::Value, sign_ext: bool) -> Option<u128>; | ||
|
||
fn const_data_from_alloc(&self, alloc: &Allocation) -> Self::Value; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is just There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right, but the |
||
|
||
fn scalar_to_backend(&self, cv: Scalar, layout: &abi::Scalar, llty: Self::Type) -> Self::Value; | ||
fn from_const_alloc( | ||
&self, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,7 @@ use crate::middle; | |
use crate::middle::cstore::{CrateStoreDyn, EncodedMetadata}; | ||
use crate::middle::resolve_lifetime::{self, LifetimeScopeForPath, ObjectLifetimeDefault}; | ||
use crate::middle::stability; | ||
use crate::mir::interpret::{self, Allocation, ConstValue, Scalar}; | ||
use crate::mir::interpret::{self, AllocId, Allocation, ConstValue, Scalar}; | ||
use crate::mir::{Body, Field, Local, Place, PlaceElem, ProjectionKind, Promoted}; | ||
use crate::thir::Thir; | ||
use crate::traits; | ||
|
@@ -1045,6 +1045,9 @@ pub struct GlobalCtxt<'tcx> { | |
output_filenames: Arc<OutputFilenames>, | ||
|
||
pub main_def: Option<MainDefinition>, | ||
|
||
pub(super) vtables_cache: | ||
Lock<FxHashMap<(Ty<'tcx>, Option<ty::PolyExistentialTraitRef<'tcx>>), AllocId>>, | ||
Comment on lines
+1048
to
+1050
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, any reason this is a mutable cache in the global context, instead of a query? It looks like the kind of thing we replaced with queries long ago. (Maybe we should find a way to ban There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I actually gave it a try as a query locally, but without succeed. The compilation complained about keys becoming bigger, something like that, i can't remember the exact error content. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, that's because that key type is a bit too "spread out". Sadly you can't just use You could "just" update the expected size, but someone would need to check off on that (and I don't know who) - the problem there is it can affect performance even if the new query is completely unused. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Having a cache without any dependency tracking looks like a bug to me. |
||
} | ||
|
||
impl<'tcx> TyCtxt<'tcx> { | ||
|
@@ -1202,6 +1205,7 @@ impl<'tcx> TyCtxt<'tcx> { | |
alloc_map: Lock::new(interpret::AllocMap::new()), | ||
output_filenames: Arc::new(output_filenames), | ||
main_def: resolutions.main_def, | ||
vtables_cache: Default::default(), | ||
} | ||
} | ||
|
||
|
Uh oh!
There was an error while loading. Please reload this page.