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

MIR: hide .rodata constants vs by-ref ABI clash in trans. #45996

Merged
merged 1 commit into from
Nov 17, 2017

Conversation

eddyb
Copy link
Member

@eddyb eddyb commented Nov 15, 2017

Back in #45380, constants were copied into locals during MIR creation to ensure that arguments ' memory can be used by the callee, if the constant is placed in .rodata and the ABI passes it by-ref.

However, there are several drawbacks (see #45380 (comment)), most importantly the complication of constant propagation (UB if a constant ends up in Call arguments) and inconveniencing analyses.

Instead, I've modified the rustc_trans implementation of calls to copy an Operand::Constant argument locally if it's not immediate, and added a test that segfaults without the copy.

cc @dotdash @arielb1

@kennytm kennytm added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 15, 2017
@dotdash
Copy link
Contributor

dotdash commented Nov 15, 2017

LGTM, I'll let @arielb1 have a look first though

@kennytm
Copy link
Member

kennytm commented Nov 15, 2017

r? @arielb1

@arielb1
Copy link
Contributor

arielb1 commented Nov 15, 2017

@bors r+

@bors
Copy link
Contributor

bors commented Nov 15, 2017

📌 Commit 0baeae4 has been approved by arielb1

@kennytm kennytm 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 Nov 15, 2017
@eddyb
Copy link
Member Author

eddyb commented Nov 16, 2017

@bors r=arielb1

@bors
Copy link
Contributor

bors commented Nov 16, 2017

📌 Commit bacb3ca has been approved by arielb1

@bors
Copy link
Contributor

bors commented Nov 16, 2017

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

@eddyb
Copy link
Member Author

eddyb commented Nov 16, 2017

@bors r=arielb1

@bors
Copy link
Contributor

bors commented Nov 16, 2017

📌 Commit 6db6893 has been approved by arielb1

@bors
Copy link
Contributor

bors commented Nov 17, 2017

⌛ Testing commit 6db6893 with merge aabfed5...

bors added a commit that referenced this pull request Nov 17, 2017
MIR: hide .rodata constants vs by-ref ABI clash in trans.

Back in #45380, constants were copied into locals during MIR creation to ensure that arguments ' memory can be used by the callee, if the constant is placed in `.rodata` and the ABI passes it by-ref.

However, there are several drawbacks (see #45380 (comment)), most importantly the complication of constant propagation (UB if a constant ends up in `Call` arguments) and inconveniencing analyses.

Instead, I've modified the `rustc_trans` implementation of calls to copy an `Operand::Constant` argument locally if it's not immediate, and added a test that segfaults without the copy.

cc @dotdash @arielb1
@bors
Copy link
Contributor

bors commented Nov 17, 2017

☀️ Test successful - status-appveyor, status-travis
Approved by: arielb1
Pushing aabfed5 to master...

@bors bors merged commit 6db6893 into rust-lang:master Nov 17, 2017
@eddyb eddyb deleted the even-mirer-1 branch November 17, 2017 16: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.

5 participants