Skip to content
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

Wrap const_eval_stack_frame_limit in a LockCell #56085

Closed
wants to merge 2 commits into from

Conversation

Aaron1011
Copy link
Member

This allows Miri to set const_eval_stack_frame_limit as needed,
while still keeping Session thread-safe

This allows Miri to set const_eval_stack_frame_limit as needed,
while still keeping Session thread-safe
@rust-highfive
Copy link
Collaborator

r? @varkor

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 19, 2018
@Aaron1011
Copy link
Member Author

r? @Zoxc

@rust-highfive rust-highfive assigned Zoxc and unassigned varkor Nov 19, 2018
@Zoxc
Copy link
Contributor

Zoxc commented Nov 19, 2018

This doesn't look correct since Miri could be used on multiple threads.

@Aaron1011
Copy link
Member Author

Miri currently doesn't support multiple threads. I don't believe anyone is currently working on adding multithreading support, so I think this change should be fine for the forseeable future.

@Zoxc
Copy link
Contributor

Zoxc commented Nov 20, 2018

Miri can't emulate multiple threads, but you can have Miri executions on multiple threads in rustc currently.

Miri can be run from multiple rustc threads
@Aaron1011 Aaron1011 changed the title Wrap const_eval_stack_frame_limit in a OneThread<Cell> Wrap const_eval_stack_frame_limit in a LockCell Nov 20, 2018
@Aaron1011
Copy link
Member Author

@Zoxc: I've switched const_eval_stack_frame_limit to use a LockCell

@Zoxc
Copy link
Contributor

Zoxc commented Nov 20, 2018

I'd like to know how you plan on changing const_eval_stack_frame_limit in Miri in order to check that it's actually thread-safe. I don't think you could change const_eval_stack_frame_limit using LockCell in the rustc driver in a race-free way.

@Aaron1011
Copy link
Member Author

@Zoxc: I'll be changing it here, before Miri starting running the target function.

@Zoxc
Copy link
Contributor

Zoxc commented Nov 21, 2018

That doesn't seem correct either, assuming that the Miri driver will use rustc's const_eval for consistency. I think the correct move would be to add a stack_limit field to EvalContext and have the Miri driver populate that differently from rustc's const_eval. cc @oli-obk

@oli-obk
Copy link
Contributor

oli-obk commented Nov 21, 2018

cc @RalfJung

We should probably remove this field entirely and make the engine depend on the recursion limit that is also used for macros and such. This way users can control the recursion depth directly from the source

@RalfJung
Copy link
Member

@oli-obk Actually I think miri-the-tool wants no limit at all here, TBH.

For CTFE, the "normal" recursion limit seems fine. What is its default value?

@oli-obk
Copy link
Contributor

oli-obk commented Nov 21, 2018

What is its default value?

update_limit(sess, krate, &sess.recursion_limit, "recursion_limit",
"recursion limit", 64);

Actually I think miri-the-tool wants no limit at all here, TBH.

That seems like an easy change to make by making the check a Machine-method

@RalfJung
Copy link
Member

That seems like an easy change to make by making the check a Machine-method

Actually, wouldn't the stack_push hook added by #56094 suffice for that?

@oli-obk
Copy link
Contributor

oli-obk commented Nov 21, 2018

Yes that seems like the correct place to check that

@TimNN TimNN added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 27, 2018
@TimNN
Copy link
Contributor

TimNN commented Dec 4, 2018

Ping from triage @Aaron1011: It looks like some changes have been requested to your PR.

@Dylan-DPC-zz
Copy link

Ping from triage. @Aaron1011 Unfortunately we haven't heard from you on this in a while, so I'm closing the PR to keep things tidy. Don't worry though, if you'll have time again in the future please reopen this PR, we'll be happy to review it again!

@Dylan-DPC-zz Dylan-DPC-zz added S-inactive Status: Inactive and waiting on the author. This is often applied to closed PRs. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jan 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-inactive Status: Inactive and waiting on the author. This is often applied to closed PRs.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants