-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Conversation
LGTM, I'll let @arielb1 have a look first though |
r? @arielb1 |
@bors r+ |
📌 Commit 0baeae4 has been approved by |
@bors r=arielb1 |
📌 Commit bacb3ca has been approved by |
☔ The latest upstream changes (presumably #45825) made this pull request unmergeable. Please resolve the merge conflicts. |
@bors r=arielb1 |
📌 Commit 6db6893 has been approved by |
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
☀️ Test successful - status-appveyor, status-travis |
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 anOperand::Constant
argument locally if it's not immediate, and added a test that segfaults without the copy.cc @dotdash @arielb1