Change vtable memory representation to use tcx allocated allocations.#86475
Change vtable memory representation to use tcx allocated allocations.#86475bors merged 3 commits intorust-lang:masterfrom
Conversation
|
Some changes occured to the CTFE / Miri engine cc @rust-lang/miri Some changes occured to the CTFE / Miri engine cc @rust-lang/miri |
This comment has been minimized.
This comment has been minimized.
ecba2e5 to
15f1f71
Compare
This comment has been minimized.
This comment has been minimized.
|
I am very confused by the PR title. Surely Miri should still use its own allocations for stack and heap allocations. Also the change seems to have a lot to do with vtables, but that term does not appear in the PR title. It would help to describe more precisely what is going on. :) EDIT: Oh, looks like what you mean use "Change Miri to use txc-allocation allocation for vtables". That makes a lot more sense. You had me worried at first here. ;) |
|
If you don't know yet |
|
Thank you for your comments! I'll update the pr and address the review comments tomorrow evening in my timezone (after about 18 hours) |
No rush. Take all the time you need. There's no expectation that reviews are addressed in any timeframe other than what the author feels good with. |
|
Thanks! I was a little busy this week, i'll get to it this weekend. |
15f1f71 to
0df271d
Compare
10b692c to
c1eafa7
Compare
|
Updated and addressed the comments. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
263a8d3 to
a6a5cba
Compare
|
Only x86_64-apple timed out. All other jobs succeeded. Probably spurious. @bors retry |
|
⌛ Testing commit 97772bb with merge 12d658d005db54ae0594fa815a70d2ab79747b70... |
|
💔 Test failed - checks-actions |
Mmm, it seems another retry is needed? Or do i need to rebase forward? @bjorn3 |
|
@bors retry |
|
☀️ Test successful - checks-actions |
Tested on commit rust-lang/rust@e98897e. Direct link to PR: <rust-lang/rust#86475> 💔 miri on windows: test-pass → build-fail (cc @eddyb @oli-obk @RalfJung). 💔 miri on linux: test-pass → build-fail (cc @eddyb @oli-obk @RalfJung).
|
Third time's the charm. |
Change vtable memory representation to use tcx allocated allocations. This fixes rust-lang#86324. However i suspect there's more to change before it can land. r? `@bjorn3` cc `@rust-lang/miri`
|
|
||
| pub(super) vtables_cache: | ||
| Lock<FxHashMap<(Ty<'tcx>, Option<ty::PolyExistentialTraitRef<'tcx>>), AllocId>>, |
There was a problem hiding this comment.
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 !Freeze types in GlobalCtxt, outside of incremental/query state?)
There was a problem hiding this comment.
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.
Ah, that's because that key type is a bit too "spread out". Sadly you can't just use TraitRef<'tcx>, without passing some dummy trait for the DefId.
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.
Having a cache without any dependency tracking looks like a bug to me.
| 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.
This is just from_const_alloc, isn't it? Just with a hardcoded offset of 0 and no type.
There was a problem hiding this comment.
from_const_alloc also returns a PlaceRef while this returns a raw pointer value.
There was a problem hiding this comment.
Right, but the PlaceRef is made from that pointer value and the type/layout passed in.
This fixes #86324. However i suspect there's more to change before it can land.
r? @bjorn3
cc @rust-lang/miri