Skip to content

Make constants immortal #3063

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

Merged
merged 1 commit into from
Aug 27, 2021
Merged

Conversation

drexin
Copy link
Contributor

@drexin drexin commented Aug 27, 2021

rdar://82441851

@drexin
Copy link
Contributor Author

drexin commented Aug 27, 2021

@swift-ci test

@parkera
Copy link
Contributor

parkera commented Aug 27, 2021

Is there any way we can verify this with a test case?

@drexin
Copy link
Contributor Author

drexin commented Aug 27, 2021

@parkera I think there might be. It's not going to be pretty, but I think I can make it work.

rdar://82441851
@drexin drexin force-pushed the wip-immortal-constants branch from 886ece7 to 1a3b9a3 Compare August 27, 2021 16:30
@drexin
Copy link
Contributor Author

drexin commented Aug 27, 2021

@swift-ci test

let trueRefCount = truePtr.advanced(by: 1).pointee
let falseRefCount = falsePtr.advanced(by: 1).pointee

XCTAssertEqual(trueRefCount, falseRefCount)
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure we need to actually verify the reference count, so much as verify that releasing it a bunch then using it doesn't crash.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's actually important that it doesn't change. Otherwise we are just masking the problem by assigning a very high ref count.

@drexin drexin merged commit 2e72cf3 into swiftlang:main Aug 27, 2021
@drexin drexin deleted the wip-immortal-constants branch August 27, 2021 20:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants