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

Give OpTy access to locals for priroda #55179

Merged
merged 8 commits into from
Oct 21, 2018

Conversation

bjorn3
Copy link
Member

@bjorn3 bjorn3 commented Oct 18, 2018

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 18, 2018
@oli-obk
Copy link
Contributor

oli-obk commented Oct 18, 2018

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Oct 18, 2018

📌 Commit 7403d55 has been approved by oli-obk

@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 Oct 18, 2018
kennytm added a commit to kennytm/rust that referenced this pull request Oct 18, 2018
@RalfJung
Copy link
Member

Oh, why does it need that? I wanted to have something like an abstraction here :(

@oli-obk
Copy link
Contributor

oli-obk commented Oct 19, 2018

We need a way to go from a stackframe ID and a local ID to an OpTy. This seemed the easiest way. Since you have legit concerns here, let's do it right by adding a convenience function for the specific use case.

@bors r-

@bors bors 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-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Oct 19, 2018
@kennytm
Copy link
Member

kennytm commented Oct 19, 2018

@bors rollup-

@oli-obk
Copy link
Contributor

oli-obk commented Oct 19, 2018

r? @RalfJung

@rust-highfive rust-highfive assigned RalfJung and unassigned oli-obk Oct 19, 2018
@bjorn3
Copy link
Member Author

bjorn3 commented Oct 19, 2018

Got some errors locally. Fixing...

@bjorn3
Copy link
Member Author

bjorn3 commented Oct 19, 2018

Fixed

@bjorn3 bjorn3 mentioned this pull request Oct 19, 2018
let local_ty = self.monomorphize(local_ty, frame.instance.substs);
let layout = self.layout_of(local_ty)?;
Ok(OpTy { op, layout })
}
Copy link
Member

Choose a reason for hiding this comment

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

Why don't you use stack()? locals is public, so that should give you all you need?

Copy link
Member Author

Choose a reason for hiding this comment

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

That gives an Operand while I need an OpTy which cant be made outside rustc_mir.

Copy link
Member

Choose a reason for hiding this comment

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

Oh I see. In that case, please use layout_of_local, and please change eval_place_to_operand to use your new method.

Copy link
Member Author

Choose a reason for hiding this comment

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

layout_of_local expects a frame id, while this takes an arbitrary Frame. I can do the other thing though.

Copy link
Member

Choose a reason for hiding this comment

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

And you don't have a frame ID where you need this?

You can change layout_of_local to take &Frame as well.

Copy link
Member Author

Choose a reason for hiding this comment

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

And you don't have a frame ID where you need this?

Currently I do have it, but in the future I want to do some caching for stepping back in time, which could involve printing frames not on the stack. (I am not sure how to do the caching yet, just anticipating.)

You can change layout_of_local to take &Frame as well.

+1

@bjorn3
Copy link
Member Author

bjorn3 commented Oct 19, 2018

@oli-obk suggested adding another thing to this PR, which I will do tomorrow.

@bjorn3
Copy link
Member Author

bjorn3 commented Oct 20, 2018

This is ready for review.

&self,
frame: &super::Frame<'mir, 'tcx, M::PointerTag>,
local: mir::Local,
layout: Option<TyLayout<'tcx>>,
Copy link
Member

Choose a reason for hiding this comment

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

Uh, I forgot we already know the layout there sometimes. Exposing this is not nice.

I do not have a good idea for how to avoid it, though.

Copy link
Member Author

Choose a reason for hiding this comment

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

Layout is also passed to eval_place_to_op which calls this function now.

@RalfJung
Copy link
Member

@bors r-

Sorry I forgot something: Could you add an assert! to make sure nobody accesses the return place? Also, a doc comment explaining that Option<TyLayout> would be nice.

@bors bors 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-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Oct 21, 2018
@RalfJung
Copy link
Member

@bors delegate+

r=me with that fixed.

@bors
Copy link
Contributor

bors commented Oct 21, 2018

✌️ @bjorn3 can now approve this pull request

@bors
Copy link
Contributor

bors commented Oct 21, 2018

☔ The latest upstream changes (presumably #55125) made this pull request unmergeable. Please resolve the merge conflicts.

@bjorn3
Copy link
Member Author

bjorn3 commented Oct 21, 2018

@bors r+

@bors
Copy link
Contributor

bors commented Oct 21, 2018

📌 Commit b178553 has been approved by bjorn3

@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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Oct 21, 2018
@RalfJung
Copy link
Member

This should have been

@bors r=RalfJung

@bors
Copy link
Contributor

bors commented Oct 21, 2018

💡 This pull request was already approved, no need to approve it again.

@bors
Copy link
Contributor

bors commented Oct 21, 2018

📌 Commit b178553 has been approved by RalfJung

@bjorn3
Copy link
Member Author

bjorn3 commented Oct 21, 2018

Didn't know I had to do it that way.

@RalfJung
Copy link
Member

It's okay, now you do. :)

"r+" means "I did the review and approve". "r=someone" means "I solemnly swear that someone did the review and approved".

@bors
Copy link
Contributor

bors commented Oct 21, 2018

⌛ Testing commit b178553 with merge 424a749...

bors added a commit that referenced this pull request Oct 21, 2018
Give OpTy access to locals for priroda

r? @oli-obk
@bors
Copy link
Contributor

bors commented Oct 21, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: RalfJung
Pushing 424a749 to master...

@bors bors merged commit b178553 into rust-lang:master Oct 21, 2018
@bjorn3 bjorn3 deleted the miri_public_op_field branch October 22, 2018 08:15
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants