Skip to content

interpret: move the native call preparation logic into Miri #143324

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

Merged
merged 1 commit into from
Jul 3, 2025

Conversation

RalfJung
Copy link
Member

@RalfJung RalfJung commented Jul 2, 2025

@nia-e has to do a bunch of changes to this logic for her native call ptrace work, and it's getting annoying that the logic is split between Miri and rustc. So this moves the logic to Miri, keeping just the generic traversal part in rustc. It is unfortunate that this means we have to expose get_alloc_raw/get_alloc_raw_mut... I hope the function name is scary enough to reduce the risk of misuse.

r? @oli-obk

@rustbot 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 Jul 2, 2025
@rustbot
Copy link
Collaborator

rustbot commented Jul 2, 2025

Some changes occurred to the CTFE machinery

cc @RalfJung, @oli-obk, @lcnr

The Miri subtree was changed

cc @rust-lang/miri

Some changes occurred to the CTFE / Miri interpreter

cc @rust-lang/miri

Some changes occurred to the CTFE / Miri interpreter

cc @rust-lang/miri, @RalfJung, @oli-obk, @lcnr

@@ -1073,7 +1064,9 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
todo.extend(static_roots(self));
while let Some(id) = todo.pop() {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would have loved to also port this recursive traversal over to visit_reachable_allocs... but visit_reachable_allocs calls get_alloc_raw which can fail, and this here is in the context of a function that cannot fail, so it didn't seem worth it unfortunately.

@oli-obk
Copy link
Contributor

oli-obk commented Jul 2, 2025

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Jul 2, 2025

📌 Commit de1278b has been approved by oli-obk

It is now in the queue for this repository.

@bors 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 Jul 2, 2025
bors added a commit that referenced this pull request Jul 3, 2025
Rollup of 9 pull requests

Successful merges:

 - #143192 (Improve CSS for source code block line numbers)
 - #143251 (bootstrap: add build.tidy-extra-checks option)
 - #143273 (Make the enum check work for negative discriminants)
 - #143292 (Explicitly handle all nodes in `generics_of` when computing parent)
 - #143316 (Add bootstrap check snapshot tests)
 - #143321 (byte-addresses memory -> byte-addressed memory)
 - #143324 (interpret: move the native call preparation logic into Miri)
 - #143325 (Use non-global interner in `test_string_interning` in bootstrap)
 - #143327 (miri: improve errors for type validity assertion failures)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 7e600de into rust-lang:master Jul 3, 2025
10 checks passed
@rustbot rustbot added this to the 1.90.0 milestone Jul 3, 2025
rust-timer added a commit that referenced this pull request Jul 3, 2025
Rollup merge of #143324 - RalfJung:native-call-prep, r=oli-obk

interpret: move the native call preparation logic into Miri

`@nia-e` has to do a bunch of changes to this logic for her native call ptrace work, and it's getting annoying that the logic is split between Miri and rustc. So this moves the logic to Miri, keeping just the generic traversal part in rustc. It is unfortunate that this means we have to expose `get_alloc_raw`/`get_alloc_raw_mut`... I hope the function name is scary enough to reduce the risk of misuse.

r? `@oli-obk`
@RalfJung RalfJung deleted the native-call-prep branch July 3, 2025 07:37
RalfJung pushed a commit to RalfJung/miri that referenced this pull request Jul 3, 2025
Rollup of 9 pull requests

Successful merges:

 - rust-lang/rust#143192 (Improve CSS for source code block line numbers)
 - rust-lang/rust#143251 (bootstrap: add build.tidy-extra-checks option)
 - rust-lang/rust#143273 (Make the enum check work for negative discriminants)
 - rust-lang/rust#143292 (Explicitly handle all nodes in `generics_of` when computing parent)
 - rust-lang/rust#143316 (Add bootstrap check snapshot tests)
 - rust-lang/rust#143321 (byte-addresses memory -> byte-addressed memory)
 - rust-lang/rust#143324 (interpret: move the native call preparation logic into Miri)
 - rust-lang/rust#143325 (Use non-global interner in `test_string_interning` in bootstrap)
 - rust-lang/rust#143327 (miri: improve errors for type validity assertion failures)

r? `@ghost`
`@rustbot` modify labels: rollup
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants