Skip to content

IRGen: re-enable generate static arrays in read-only data sections. #59612

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
Jun 23, 2022

Conversation

eeckstein
Copy link
Contributor

So far, static arrays had to be put into a writable section, because the isa pointer and the (immortal) ref count field were initialized dynamically at the first use of such an array.

But with a new runtime library, which exports the symbols for the (immortal) ref count field and the isa pointer, it's possible to put the whole array into a read-only section. I.e. make it a constant global.

rdar://94185998

This reverts the revert commit df353ff.
Also, I added a frontend option to disable this optimization: -disable-readonly-static-objects

So far, static arrays had to be put into a writable section, because the isa pointer and the (immortal) ref count field were initialized dynamically at the first use of such an array.

But with a new runtime library, which exports the symbols for the (immortal) ref count field and the isa pointer, it's possible to put the whole array into a read-only section. I.e. make it a constant global.

rdar://94185998

This reverts the revert commit df353ff.
Also, I added a frontend option to disable this optimization: `-disable-readonly-static-objects`
@eeckstein
Copy link
Contributor Author

@swift-ci smoke test

@eeckstein eeckstein merged commit d418b91 into swiftlang:main Jun 23, 2022
@eeckstein eeckstein deleted the reenable-readonly-arrays branch June 23, 2022 05:11
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.

1 participant