[1/n] Move the MIR map into the type context.#37400
Merged
bors merged 2 commits intorust-lang:masterfrom Oct 30, 2016
Merged
Conversation
Contributor
|
r? @pnkfelix (rust_highfive has picked a reviewer for you, use r? to override) |
nikomatsakis
approved these changes
Oct 25, 2016
| adt_defs: TypedArena<ty::AdtDefData<'tcx, 'tcx>>, | ||
| trait_def: TypedArena<ty::TraitDef<'tcx>>, | ||
| adt_def: TypedArena<ty::AdtDefData<'tcx, 'tcx>>, | ||
| mir: TypedArena<RefCell<Mir<'tcx>>>, |
Contributor
There was a problem hiding this comment.
it was probably inevitable...if sad...
| let mir = self.alloc_mir(mir); | ||
|
|
||
| // Perma-borrow MIR from extern crates to prevent mutation. | ||
| mem::forget(mir.borrow()); |
Contributor
|
@bors r+ |
Collaborator
|
📌 Commit 0848ae2 has been approved by |
Collaborator
|
☔ The latest upstream changes (presumably #36695) made this pull request unmergeable. Please resolve the merge conflicts. |
Member
Author
|
@bors r=nikomatsakis |
Collaborator
|
📌 Commit 52d08e2 has been approved by |
Member
Author
|
@bors r=nikomatsakis |
Collaborator
|
📌 Commit e34792b has been approved by |
Collaborator
bors
added a commit
that referenced
this pull request
Oct 30, 2016
[1/n] Move the MIR map into the type context. *This is part of a series ([prev]() | [next](#37401)) of patches designed to rework rustc into an out-of-order on-demand pipeline model for both better feature support (e.g. [MIR-based](https://github.com/solson/miri) early constant evaluation) and incremental execution of compiler passes (e.g. type-checking), with beneficial consequences to IDE support as well. If any motivation is unclear, please ask for additional PR description clarifications or code comments.* <hr> The first commit reorganizes the `rustc::mir` module to contain the MIR types directly without an extraneous `repr` module which serves no practical purpose but is rather an eyesore. The second commit performs the actual move of the MIR map into the type context, for the purposes of future integration with requesting analysis/lowering by-products through `TyCtxt`. Local `Mir` bodies need to be mutated by passes (hence `RefCell`), and at least one pass (`qualify_consts`) needs simultaneous access to multiple `Mir` bodies (hence arena-allocation). `Mir` bodies loaded from other crates appear as if immutably borrowed (by `.borrow()`-ing one `Ref` and subsequently "leaking" it) to avoid, at least dynamically, *any* possibility of their local mutation. One caveat is that lint passes can now snoop at the MIR (helpful) or even mutate it (dangerous). However, lints are unstable anyway and we can find a way to deal with this in due time. Future work will result in a tighter API, potentially hiding mutation *completely* outside of MIR passes.
Collaborator
bors
added a commit
that referenced
this pull request
Oct 30, 2016
[2/n] rustc_metadata: move is_extern_item to trans. *This is part of a series ([prev](#37400) | [next](#37402)) of patches designed to rework rustc into an out-of-order on-demand pipeline model for both better feature support (e.g. [MIR-based](https://github.com/solson/miri) early constant evaluation) and incremental execution of compiler passes (e.g. type-checking), with beneficial consequences to IDE support as well. If any motivation is unclear, please ask for additional PR description clarifications or code comments.* <hr> Minor cleanup missed by #36551: `is_extern_item` is one of, if not the only `CrateStore` method who takes a `TyCtxt` but doesn't produce something cached in it, and such methods are going away.
This was referenced Oct 30, 2016
Closed
Merged
plietar
added a commit
to plietar/miri
that referenced
this pull request
Nov 4, 2016
The most significant change comes from rust-lang/rust#37400, which removes the need to maintain our node cache of MIR nodes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is part of a series (prev | next) of patches designed to rework rustc into an out-of-order on-demand pipeline model for both better feature support (e.g. MIR-based early constant evaluation) and incremental execution of compiler passes (e.g. type-checking), with beneficial consequences to IDE support as well.
If any motivation is unclear, please ask for additional PR description clarifications or code comments.
The first commit reorganizes the
rustc::mirmodule to contain the MIR types directly without an extraneousreprmodule which serves no practical purpose but is rather an eyesore.The second commit performs the actual move of the MIR map into the type context, for the purposes of future integration with requesting analysis/lowering by-products through
TyCtxt.Local
Mirbodies need to be mutated by passes (henceRefCell), and at least one pass (qualify_consts) needs simultaneous access to multipleMirbodies (hence arena-allocation).Mirbodies loaded from other crates appear as if immutably borrowed (by.borrow()-ing oneRefand subsequently "leaking" it) to avoid, at least dynamically, any possibility of their local mutation.One caveat is that lint passes can now snoop at the MIR (helpful) or even mutate it (dangerous).
However, lints are unstable anyway and we can find a way to deal with this in due time.
Future work will result in a tighter API, potentially hiding mutation completely outside of MIR passes.