Emit retags in codegen to support BorrowSanitizer (part 2)#156210
Conversation
|
|
|
r? saethlin |
This comment has been minimized.
This comment has been minimized.
951a9ed to
4e3df71
Compare
This comment has been minimized.
This comment has been minimized.
|
Now that #154327 has been merged, we no longer need special handling for drop glue. |
This comment has been minimized.
This comment has been minimized.
4e3df71 to
5135340
Compare
This comment has been minimized.
This comment has been minimized.
| LocalRef::PendingOperand => LocalRef::PendingOperand, | ||
| }) | ||
| .collect::<Vec<_>>(); | ||
| // If we branched during retagging, then we need to update the |
There was a problem hiding this comment.
How would retagging introduce a branch?
There was a problem hiding this comment.
We selectively retag variants of enums that contain references or Box. For example,
fn foo(opt: Option<Box<i32>>) { .. }This will branch on the discriminant of opt to retag the Box, if it's there.
5135340 to
23602aa
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
|
@bors r+ rollup=iffy |
|
⌛ Testing commit 23602aa with merge 509a1fb... Workflow: https://github.com/rust-lang/rust/actions/runs/26929479425 |
Emit retags in codegen to support BorrowSanitizer (part 2) Tracking issue: #154760 [Zulip Thread](https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/Staging.20for.20emitting.20retags.20in.20codegen/with/593004012) This is one of several PRs that will add experimental support for emitting retags as function calls in codegen. Each PR will be a minimal, improved slice of the changes in #155965. This PR adds a new unstable flag `-Zcodegen-emit-retag`, which will enable experimental retag calls in generated code. This flag is a nop for now, but the relevant methods have been added to codegen_ssa, and they are called wherever retags are necessary. Subsequent PRs will complete this implementation. This does not depend on #156208. r? @RalfJung
|
@bors yield |
|
Auto build was cancelled. Cancelled workflows: The next pull request likely to be tested is #157404. |
Rollup merge of #156210 - BorrowSanitizer:codegen-emit-retag-2, r=saethlin Emit retags in codegen to support BorrowSanitizer (part 2) Tracking issue: #154760 [Zulip Thread](https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/Staging.20for.20emitting.20retags.20in.20codegen/with/593004012) This is one of several PRs that will add experimental support for emitting retags as function calls in codegen. Each PR will be a minimal, improved slice of the changes in #155965. This PR adds a new unstable flag `-Zcodegen-emit-retag`, which will enable experimental retag calls in generated code. This flag is a nop for now, but the relevant methods have been added to codegen_ssa, and they are called wherever retags are necessary. Subsequent PRs will complete this implementation. This does not depend on #156208. r? @RalfJung
…-3, r=saethlin Emit retags in codegen to support BorrowSanitizer (part 3) Tracking issue: rust-lang#154760 [Zulip Thread](https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/Staging.20for.20emitting.20retags.20in.20codegen/with/593004012) This is one of several PRs that will add experimental support for emitting retags as function calls in codegen. This PR adds `RetagPlan`, which describes where the pointers that need to be retagged live within the layout of a type. We create a `RetagPlan` ahead of time because only a subset of the variants of a type might contain retagable values. We only want to branch to these variants, and ignore all of the others. If a type can generate a `RetagPlan`, then we will use it as a guide for inserting calls to our retag intrinsics. If a type does not generate a `RetagPlan`, then it does not need to be retagged, and we can skip it. This does not emit a `RetagPlan::EmitRetag` yet. That will come in a subsequent PR. Previous parts: rust-lang#156208, rust-lang#156210 cc: @RalfJung r? @saethlin
Rollup merge of #157825 - BorrowSanitizer:codegen-emit-retag-3, r=saethlin Emit retags in codegen to support BorrowSanitizer (part 3) Tracking issue: #154760 [Zulip Thread](https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/Staging.20for.20emitting.20retags.20in.20codegen/with/593004012) This is one of several PRs that will add experimental support for emitting retags as function calls in codegen. This PR adds `RetagPlan`, which describes where the pointers that need to be retagged live within the layout of a type. We create a `RetagPlan` ahead of time because only a subset of the variants of a type might contain retagable values. We only want to branch to these variants, and ignore all of the others. If a type can generate a `RetagPlan`, then we will use it as a guide for inserting calls to our retag intrinsics. If a type does not generate a `RetagPlan`, then it does not need to be retagged, and we can skip it. This does not emit a `RetagPlan::EmitRetag` yet. That will come in a subsequent PR. Previous parts: #156208, #156210 cc: @RalfJung r? @saethlin
Tracking issue: #154760
Zulip Thread
This is one of several PRs that will add experimental support for emitting retags as function calls in codegen. Each PR will be a minimal, improved slice of the changes in #155965.
This PR adds a new unstable flag
-Zcodegen-emit-retag, which will enable experimental retag calls in generated code. This flag is a nop for now, but the relevant methods have been added to codegen_ssa, and they are called wherever retags are necessary. Subsequent PRs will complete this implementation.This does not depend on #156208.
r? @RalfJung