Don't recurse into allocations, use a global table instead#49833
Don't recurse into allocations, use a global table instead#49833bors merged 6 commits intorust-lang:masterfrom
Conversation
|
Your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem. Click to expand the log.I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
66dc729 to
efbb574
Compare
There was a problem hiding this comment.
This exact code exists twice, once for on_disk_cache and once for rustc_metadata::encoder. Not sure how to dedup.
|
LGTM |
src/librustc_metadata/schema.rs
Outdated
There was a problem hiding this comment.
I'm seeing ICEs inside the deserialize impl for this field in 4 stage 2 run-pass tests with aux builds. I can't reproduce on stage 1 and Travis also takes it. Maybe there's some stale data where crates are loaded that were compiled without this field?
Also: should this be LazySeq?
There was a problem hiding this comment.
If you have ignore_git set (which is the default now), incompatible metadata won't be detected. I think I had this issue with test auxiliary crates. And yes, please make it a LazySeq<u32>.
There was a problem hiding this comment.
I changed it into a LazySeq, now I'm seeing the failures on stage 1, too. ignore_git doesn't change anything
There was a problem hiding this comment.
The failure seems to be in the deserialization in the field after interpret_alloc_index.
|
Your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem. Click to expand the log.I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
8c4d438 to
c10c9d3
Compare
|
☔ The latest upstream changes (presumably #49558) made this pull request unmergeable. Please resolve the merge conflicts. |
michaelwoerister
left a comment
There was a problem hiding this comment.
Thanks, @oli-obk! Looks great.
I'm probably overlooking something: Where are the allocations for statics encoded?
src/librustc/mir/interpret/mod.rs
Outdated
There was a problem hiding this comment.
Does this need to be moved up in order not to always hit the get_alloc branch?
There was a problem hiding this comment.
I'd assume that the get_alloc branch is the most common. Also both get_alloc and get_static are just HashMap lookups.
There was a problem hiding this comment.
Do we need both interpret_alloc_ids and interpret_allocs? Or could just use interpret_allocs.contains_key() instead of interpret_alloc_ids.contains()? You might also be able to use the entry API here, so that there is just one hashtable lookup.
src/librustc/mir/interpret/mod.rs
Outdated
There was a problem hiding this comment.
ha yea, this is actual copy paste
oli-obk
left a comment
There was a problem hiding this comment.
The AllocId for a static does not point to the actual static's Allocation anymore. Instead it works like function pointers, it's just an ID that you can use to get at the DefId of the static. To get at the Allocation of a static, you need to run the const_eval query.
src/librustc/mir/interpret/mod.rs
Outdated
There was a problem hiding this comment.
ha yea, this is actual copy paste
src/librustc/mir/interpret/mod.rs
Outdated
There was a problem hiding this comment.
I'd assume that the get_alloc branch is the most common. Also both get_alloc and get_static are just HashMap lookups.
OK, so the |
|
Exactly. It's a little extreme, but forward compatible to allow statics to refer to the inside of other statics in the future. Also much harder to get wrong, because you can't accidentally get at the static A: (i32, u32) = (42, 43);
static B: &'static u32 = &A.1; |
|
OK, that makes sense to me then. It also explains why the ordering in It would be great if you could try to get rid of the |
c10c9d3 to
9fee6ec
Compare
|
Your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem. Click to expand the log.I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
9fee6ec to
2d00f2d
Compare
|
☔ The latest upstream changes (presumably #49396) made this pull request unmergeable. Please resolve the merge conflicts. |
2d00f2d to
7f7d4c3
Compare
|
Rebased and addressed all review comments |
|
I got two "lgtm", so let's get this moving (beta needs this) @bors r=michaelwoerister |
|
📌 Commit 7f7d4c3 has been approved by |
…woerister Don't recurse into allocations, use a global table instead r? @michaelwoerister fixes #49663
|
☀️ Test successful - status-appveyor, status-travis |
|
Marking as beta-accepted, with some reservations due to the size of the PR. But since there's already a bors run for a slew of beta backports that includes this currently in progress (due to a process failure), and @michaelwoerister says leaving this out will break incremental compilation.... |
|
Backported in #50027 |
r? @michaelwoerister
fixes #49663