Skip to content

[Runtime] Remove a few uses of operator new/delete. #64327

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
Mar 14, 2023

Conversation

mikeash
Copy link
Contributor

@mikeash mikeash commented Mar 13, 2023

Replace them with swift_cxx_newObject/swift_cxx_deleteObject to avoid calling overridden global operators. Overridden global operators can sometimes fail when called from places the authors didn't expect.

The particular uses being changed here are:

  1. Creation of new SingletonMetadataCacheEntry objects.
  2. Allocation of the _globalIvarOffsets array in initGenericObjCClass.
  3. Creation/destruction of SwiftTLSContext objects.

rdar://106238547

@mikeash mikeash requested a review from al45tair March 13, 2023 20:04
Replace them with swift_cxx_newObject/swift_cxx_deleteObject to avoid calling overridden global operators. Overridden global operators can sometimes fail when called from places the authors didn't expect.

The particular uses being changed here are:

1. Creation of new SingletonMetadataCacheEntry objects.
2. Allocation of the _globalIvarOffsets array in initGenericObjCClass.
3. Creation/destruction of SwiftTLSContext objects.

rdar://106238547
@mikeash
Copy link
Contributor Author

mikeash commented Mar 13, 2023

@swift-ci please test

@mikeash mikeash merged commit 1dfd1ed into swiftlang:main Mar 14, 2023
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