Skip to content

Miri: use extern fn to expose interpreter operations to program; fix leak checker on Windows - #74681

Merged
bors merged 3 commits into
rust-lang:masterfrom
RalfJung:miri-extern-fn
Jul 24, 2020
Merged

Miri: use extern fn to expose interpreter operations to program; fix leak checker on Windows#74681
bors merged 3 commits into
rust-lang:masterfrom
RalfJung:miri-extern-fn

Conversation

@RalfJung

@RalfJungRalfJung commented Jul 23, 2020

Copy link
Copy Markdown
Member

This PR realizes an idea that @oli-obk has been suggesting for a while: to use Miri-specific extern functions to provide some extra capabilities to the program. Initially, we have two of these methods, which libstd itself needs:

  • miri_start_panic, which replaces the intrinsic of the same name (mostly for consistency, to avoid having multiple mechanisms for Miri-specific functionality).
  • miri_static_root, which adds an allocation to a list of static "roots" that Miri considers as not having leaked (including all memory reachable through them). This is needed for Enable leak checker on Windows miri#1302.

We use extern functions instead of intrinsics for this so that user code can more easily call these Miri hoolks -- e.g. miri_static_root should be useful for rust-lang/miri#1318.

The Miri side of this is at rust-lang/miri#1485.

r? @oli-obk

@rust-highfiverust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 23, 2020
@RalfJungRalfJung changed the title Miri: use extern fn to expose interpreter operations to program Miri: use extern fn to expose interpreter operations to program; fix leak checker on WindowsJul 23, 2020
Comment threadsrc/libstd/sys/windows/thread_local_key.rs Outdated
@oli-obk

Copy link
Copy Markdown
Contributor

I like how this change can be done without any boostrapping problems.

r=me with the nit

@RalfJung

Copy link
Copy Markdown
MemberAuthor

@bors r=oli-obk

@bors

bors commented Jul 23, 2020

Copy link
Copy Markdown
Collaborator

📌 Commit e715b0efabf0a0eae8bae52260a886f2a169aea9 has been approved by oli-obk

@borsbors 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 23, 2020
@RalfJung

Copy link
Copy Markdown
MemberAuthor

Fixed a typo.
@bors r=oli-obk

@bors

bors commented Jul 23, 2020

Copy link
Copy Markdown
Collaborator

📌 Commit 45abbe01a2162da3998889426bba7a00af0a6e24 has been approved by oli-obk

@RalfJung

Copy link
Copy Markdown
MemberAuthor

@bors r=oli-obk

@bors

bors commented Jul 23, 2020

Copy link
Copy Markdown
Collaborator

📌 Commit 67b4f3b has been approved by oli-obk

Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Jul 24, 2020
 Miri: use extern fn to expose interpreter operations to program; fix leak checker on Windows
This PR realizes an idea that @oli-obk has been suggesting for a while: to use Miri-specific `extern` functions to provide some extra capabilities to the program. Initially, we have two of these methods, which libstd itself needs:
* `miri_start_panic`, which replaces the intrinsic of the same name (mostly for consistency, to avoid having multiple mechanisms for Miri-specific functionality).
* `miri_static_root`, which adds an allocation to a list of static "roots" that Miri considers as not having leaked (including all memory reachable through them). This is needed for rust-lang/miri#1302.
We use `extern` functions instead of intrinsics for this so that user code can more easily call these Miri hoolks -- e.g. `miri_static_root` should be useful for rust-lang/miri#1318.
The Miri side of this is at rust-lang/miri#1485.
r? @oli-obk
@bors

bors commented Jul 24, 2020

Copy link
Copy Markdown
Collaborator

⌛ Testing commit 67b4f3b with merge 5ef299e...

@bors

bors commented Jul 24, 2020

Copy link
Copy Markdown
Collaborator

☀️ Test successful - checks-actions, checks-azure
Approved by: oli-obk
Pushing 5ef299e to master...

@borsbors added the merged-by-bors This PR was explicitly merged by bors. label Jul 24, 2020
@bors
bors merged commit 5ef299e into rust-lang:masterJul 24, 2020
@borsbors mentioned this pull request Jul 25, 2020
bors added a commit to rust-lang/miri that referenced this pull request Jul 25, 2020
 Miri: use extern fn to expose interpreter operations to program; fix leak checker on Windows
This is the Miri side of rust-lang/rust#74681.
Fixes#1302Fixes#1318
@RalfJung
RalfJung deleted the miri-extern-fn branch July 28, 2020 06:59
@cuvipercuviper added this to the 1.47.0 milestone May 2, 2024
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merged-by-borsThis PR was explicitly merged by bors.S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@RalfJung@oli-obk@bors@cuviper@rust-highfive