-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
change how MIR represents places #52708
Comments
For |
@nnethercote ok, good to know. I intended this as a first step -- the second step would be to index the borrows by their initial variable, so that we avoid the N^2 iteration and replace it with effectively a hashing scheme |
Ohhh, using an interned slice there is really clever! I don't see any issues with it. |
Note: |
I'm marking this as NLL-deferred -- not because I don't want to see it done, but because I don't think it quite rises to the level of a milestone issue. @csmoe is still hard at work here though as far as I know! |
Based on this I recommend that the NLL-deferred label be removed. |
@nnethercote there's also #53643 (comment) for dealing with this |
NLL pre-meeting triage. This is an important topic (i.e. P-high) that some folks from both NLL and MIR 2.0 groups are looking at; but its not NLL specific at all, so I'm removing the NLL related tags. |
Put Local, Static and Promoted as one Base variant of Place Related to rust-lang#52708 The `Place` 2.0 representation use a `Base` variant for `Local`, `Static` and `Promoted` so we start making this change in the current `Place` to make the following steps simpler. r? @oli-obk
Put Local, Static and Promoted as one Base variant of Place Related to rust-lang#52708 The `Place` 2.0 representation use a `Base` variant for `Local`, `Static` and `Promoted` so we start making this change in the current `Place` to make the following steps simpler. r? @oli-obk
Put Local, Static and Promoted as one Base variant of Place Related to rust-lang#52708 The `Place` 2.0 representation use a `Base` variant for `Local`, `Static` and `Promoted` so we start making this change in the current `Place` to make the following steps simpler. r? @oli-obk
One disadvantage of this change: the size of |
@nnethercote the change is not going to be done in the way stated in this issue. The idea is to do something like ... struct Place {
base: PlaceBase,
projection: PlaceProjection,
}
enum PlaceProjection {
Base,
Projection(Box<PlaceProjection>),
Deref,
Index(..),
...
} |
@nnethercote the change is not going to be done in the way stated in this issue. The idea is to do something like ... struct Place {
base: PlaceBase,
projection: PlaceProjection,
}
enum PlaceProjection {
Base,
Projection(Box<PlaceProjection>),
Deref,
Index(..),
...
} |
That sounds even worse, in terms of size :( IIUC |
BTW, you can measure the size of types within rustc quite easily. See the "extra-special trick" here for instructions. |
Yes, sorry. I've pasted an intermediate step. The final layout is ... struct Place<'tcx> {
base: PlaceBase,
projection: &'tcx [PlaceProjection],
}
enum PlaceProjection {
Projection(Box<PlaceProjection>),
Deref,
Index(..),
...
} |
The described final layout still implies that But I prefer to wait to see the final result and do some measurements on it before we worry about trying to address this in some manner. |
@pnkfelix yes, final layout will be 24-bytes. Sorry because I was adding some confusion around. See @eddyb comment here #58631 (comment) |
I'm happy to see work continue here, but I do not think the P-high priority makes sense. (Neither I nor the team needs to revisit the progress on this topic every week during the triage meeting.) Revising to P-medium. |
@oli-obk @nikomatsakis should we close this issue?, there are a bunch of things to do about MIR 2.0 but tracked elsewhere. If I'm not wrong everything proposed in this issue is already implemented. |
I think that's right. Closing! |
For efficiency reasons, but also others, it would be nice to change how MIR represents the
Place
data structure. Right now we have a tree-like structure:rust/src/librustc/mir/mod.rs
Lines 1694 to 1709 in fefe816
But this is not the most convenient and it can be an efficiency hazard. Instead, I propose a structure like this (inspired by something @eddyb said, and I imagine that they will have suggestions too):
where
ProjectionElem
is basically the same type as today:rust/src/librustc/mir/mod.rs
Lines 1734 to 1770 in fefe816
In other words, instead of representing
a.b.c
as.c
.b
.a
we would represent it as
(a, [b, c])
(here,[b, c]
would be an interned slice).The advantages of this setup:
Place
is nowCopy
, which is always nicea.b.c
is disjoint fromd.e.f
unroll_place
callsAnd it is a building block, I think, for other improvements to NLL performance.
cc @eddyb
The text was updated successfully, but these errors were encountered: