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

Ensure sanity of all computed ABIs #117500

Merged
merged 6 commits into from
Nov 19, 2023
Merged

Conversation

RalfJung
Copy link
Member

@RalfJung RalfJung commented Nov 1, 2023

This moves the ABI sanity assertions from the codegen backend to the ABI computation logic. Sadly, due to past mistakes, we have to be able to compute a sane ABI for nonsensical function types like extern "C" fn(str) -> str. So to make the sanity check pass we first need to make all ABI adjustment deal with unsized types... and we have no shared infrastructure for those adjustments, so that's a bunch of copy-paste. At least we have assertions failing loudly when one accidentally sets a different mode for an unsized argument.

To achieve this, this re-lands the parts of #80594 that got reverted in #81388. To avoid breaking wasm ABI again, that ABI now explicitly opts-in to the (wrong, broken) ABI that we currently keep for backwards compatibility. That's still better than having every ABI use the wrong broken default!

Cc @bjorn3
Fixes #115845

@rustbot
Copy link
Collaborator

rustbot commented Nov 1, 2023

r? @oli-obk

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

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Nov 1, 2023
@RalfJung RalfJung force-pushed the aggregate-abi branch 2 times, most recently from 94200f6 to 487853e Compare November 1, 2023 22:10
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@RalfJung
Copy link
Member Author

RalfJung commented Nov 3, 2023

Oli is on vacation.
r? compiler

@rustbot rustbot assigned TaKO8Ki and unassigned oli-obk Nov 3, 2023
@TaKO8Ki
Copy link
Member

TaKO8Ki commented Nov 15, 2023

It's better to reroll r? compiler

@rustbot rustbot assigned davidtwco and unassigned TaKO8Ki Nov 15, 2023
@davidtwco
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Nov 19, 2023

📌 Commit 0865a2e has been approved by davidtwco

It is now in the queue for this repository.

@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 Nov 19, 2023
@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 Nov 19, 2023
@bors
Copy link
Contributor

bors commented Nov 19, 2023

⌛ Testing commit cfb47ca with merge 7f172a1...

bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 19, 2023
Ensure sanity of all computed ABIs

This moves the ABI sanity assertions from the codegen backend to the ABI computation logic. Sadly, due to past mistakes, we [have to](rust-lang#117351 (comment)) be able to compute a sane ABI for nonsensical function types like `extern "C" fn(str) -> str`.  So to make the sanity check pass we first need to make all ABI adjustment deal with unsized types... and we have no shared infrastructure for those adjustments, so that's a bunch of copy-paste. At least we have assertions failing loudly when one accidentally sets a different mode for an unsized argument.

To achieve this, this re-lands the parts of rust-lang#80594 that got reverted in rust-lang#81388.  To avoid breaking wasm ABI again, that ABI now explicitly opts-in to the (wrong, broken) ABI that we currently keep for backwards compatibility. That's still better than having *every* ABI use the wrong broken default!

Cc `@bjorn3`
Fixes rust-lang#115845
@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Contributor

bors commented Nov 19, 2023

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Nov 19, 2023
@RalfJung
Copy link
Member Author

Ah, that's annoying... we are currently computing things like the noundef annotations before we call the target-specific ABI adjustments. So if such ABI adjustments make more arguments direct, as the wasm one does now, then it misses out on these annotations...

@RalfJung
Copy link
Member Author

Ah no I can easily fix that by changing make_direct_deprecated to never overwrite an already-direct argument.

@RalfJung
Copy link
Member Author

@bors r=davidtwco

@bors
Copy link
Contributor

bors commented Nov 19, 2023

📌 Commit c7b8dd4 has been approved by davidtwco

It is now in the queue for this repository.

@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 Nov 19, 2023
@bors
Copy link
Contributor

bors commented Nov 19, 2023

⌛ Testing commit c7b8dd4 with merge d19980e...

@RalfJung
Copy link
Member Author

@bors rollup=iffy

@bors
Copy link
Contributor

bors commented Nov 19, 2023

☀️ Test successful - checks-actions
Approved by: davidtwco
Pushing d19980e to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Nov 19, 2023
@bors bors merged commit d19980e into rust-lang:master Nov 19, 2023
12 checks passed
@rustbot rustbot added this to the 1.76.0 milestone Nov 19, 2023
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (d19980e): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
2.4% [2.0%, 2.7%] 2
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Cycles

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
2.4% [2.4%, 2.4%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 677.922s -> 675.906s (-0.30%)
Artifact size: 313.81 MiB -> 313.79 MiB (-0.00%)

@RalfJung RalfJung deleted the aggregate-abi branch November 20, 2023 07:09
bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 25, 2023
…errors

the unadjusted ABI needs to pass aggregates by-value

Fixes rust-lang#118124, a regression introduced in rust-lang#117500
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Nov 27, 2023
the unadjusted ABI needs to pass aggregates by-value

Fixes rust-lang/rust#118124, a regression introduced in rust-lang/rust#117500
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ice: 'PassMode::Direct' for aggregates only allowed on wasm targets
8 participants