Skip to content

[TypeLowering] Define "copy into" for opaque vals. #62322

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

Conversation

nate-chandler
Copy link
Contributor

When building with opaque values enable, types which would otherwise get AddressOnlyTypeLowering instead get OpaqueValueTypeLowering. When such types need to be copied into an address, the emitCopyInto method gets called on the OpaqueValueTypeLowering. So it must be implemented.

Additionally, vary its implementation based on whether the module is address-lowered. If it's not address-lowered, emit a copy-into as if the type were loadable. If it is address-lowered, emit a copy-into as if the type were address-only.

The new flag allows TypeLowering to be forced to behave as though
-enable-sil-opaque-values was passed.  That's needed in order to
reasonably write tests on SIL which _notionally_ started out in opaque
values mode and have since been address lowered.
When building with opaque values enable, types which would otherwise get
AddressOnlyTypeLowering instead get OpaqueValueTypeLowering.  When such
types need to be copied into an address, the emitCopyInto method gets
called on the OpaqueValueTypeLowering.  So it must be implemented.

Additionally, vary its implementation based on whether the module is
address-lowered.  If it's not address-lowered, emit a copy-into as if
the type were loadable.  If it is address-lowered, emit a copy-into as
if the type were address-only.
@nate-chandler
Copy link
Contributor Author

@swift-ci please test

@nate-chandler
Copy link
Contributor Author

@swift-ci please test windows platform

@nate-chandler nate-chandler marked this pull request as ready for review December 1, 2022 19:13
@nate-chandler nate-chandler merged commit 4a089ea into swiftlang:main Dec 2, 2022
@nate-chandler nate-chandler deleted the opaque-values/1/20221128 branch December 2, 2022 16:19
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