-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Add more information to StableMIR Instance #118524
Merged
Merged
Conversation
This file contains 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
- Retrieve `FnSig`. - Implement CrateDef for InstanceDef. - Add VTable index for Virtual instances.
r? @spastorino (rustbot has picked a reviewer for you, use r? to override) |
rustbot
added
S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
labels
Dec 2, 2023
This PR changes Stable MIR cc @oli-obk, @celinval, @spastorino, @ouz-a |
r? @ouz-a |
@bors r+ rollup |
bors
added
S-waiting-on-bors
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
and removed
S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
labels
Dec 2, 2023
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Dec 2, 2023
…iaskrgr Rollup of 4 pull requests Successful merges: - rust-lang#118514 (rustc_hir_typeck: Fix ICE when probing for non-ASCII function alternative) - rust-lang#118524 (Add more information to StableMIR Instance) - rust-lang#118528 (replace `once_cell::sync::OnceCell` with std `OnceLock`) - rust-lang#118539 (move packed-struct tests into packed/ folder) r? `@ghost` `@rustbot` modify labels: rollup
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Dec 2, 2023
Rollup merge of rust-lang#118524 - celinval:smir-instance-def, r=ouz-a Add more information to StableMIR Instance Allow stable MIR users to retrieve an instance function signature, the index for a VTable instance and more information about its underlying definition. These are needed to properly interpret function calls, either via VTable or direct calls. The `CrateDef` implementation will also allow users to emit diagnostic messages. I also fixed a few issues that we had identified before with how we were retrieving body of things that may not have a body available.
celinval
added a commit
to celinval/rust-dev
that referenced
this pull request
Dec 6, 2023
Change the implementation of `Instance::is_foreign_item` to directly query the compiler for the instance `def_id` instead of incorrectly relying on the conversion to `CrateItem`. Background: - In pull rust-lang#118524, I fixed the conversion from Instance to CrateItem to avoid the conversion if the instance didn't have a body available. This broke the `is_foreign_item`.
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this pull request
Dec 6, 2023
Fix is_foreign_item for StableMIR instance Change the implementation of `Instance::is_foreign_item` to directly query the compiler for the instance `def_id` instead of incorrectly relying on the conversion to `CrateItem`. I also added a method to check if the instance has body, since the function already existed and it just wasn't exposed via public APIs. This makes it much cheaper for the user to check if the instance has body. ## Background: - In pull rust-lang#118524, I fixed the conversion from Instance to CrateItem to avoid the conversion if the instance didn't have a body available. This broke the `is_foreign_item`. r? `@ouz-a`
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Dec 7, 2023
Rollup merge of rust-lang#118681 - celinval:fix-foreign-item, r=ouz-a Fix is_foreign_item for StableMIR instance Change the implementation of `Instance::is_foreign_item` to directly query the compiler for the instance `def_id` instead of incorrectly relying on the conversion to `CrateItem`. I also added a method to check if the instance has body, since the function already existed and it just wasn't exposed via public APIs. This makes it much cheaper for the user to check if the instance has body. ## Background: - In pull rust-lang#118524, I fixed the conversion from Instance to CrateItem to avoid the conversion if the instance didn't have a body available. This broke the `is_foreign_item`. r? `@ouz-a`
adpaco-aws
added a commit
to model-checking/kani
that referenced
this pull request
Dec 9, 2023
The main changes needed to make this migration besides a few method call tweaks were: 1. Adapt `FunctionCtx` to cache information about the StableMIR version of instance and its body. - I also cleaned up how we were handling basic blocks which were unnecessary. 2. Created a new ty_stable module that provide stable versions to retrieve type information from StableMIR. - I decided to keep these separate so it is cleaner for now. I foresee that the type module will still rely on internal APIs for the next little while, so separating them here made sense to me. 3. Since `Place` when retrieved from StableMIR body already comes monomorphized, I modified the existing `codegen_place` to preemptively monomorphize Place before converting it to a Stable version and invoking `codegen_place_stable`. ### Call-outs Leaving this as a draft for now since this still depends on the following PRs to be merged into the Rust compiler: - rust-lang/rust#118524 - rust-lang/rust#118516 --------- Co-authored-by: Adrian Palacios <73246657+adpaco-aws@users.noreply.github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
S-waiting-on-bors
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
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.
Allow stable MIR users to retrieve an instance function signature, the index for a VTable instance and more information about its underlying definition.
These are needed to properly interpret function calls, either via VTable or direct calls. The
CrateDef
implementation will also allow users to emit diagnostic messages.I also fixed a few issues that we had identified before with how we were retrieving body of things that may not have a body available.