Skip to content

Runtime: correct invalid C++ workaround #42350

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
Apr 14, 2022
Merged

Conversation

compnerd
Copy link
Member

The placement new operator is only available when <new> has been
included. Add the missing include to the header to allow us to get the
definition of the placement new allocator. This allows us to remove the
workaround that was there for Windows, and should hopefully repair the
Android build as well.

Thanks to @grynspan for helping identify the underlying issue!

Replace this paragraph with a description of your changes and rationale. Provide links to external references/discussions if appropriate.

Resolves SR-NNNN.

The placement new operator is only available when `<new>` has been
included.  Add the missing include to the header to allow us to get the
definition of the placement new allocator.  This allows us to remove the
workaround that was there for Windows, and should hopefully repair the
Android build as well.

Thanks to @grynspan for helping identify the underlying issue!
@compnerd
Copy link
Member Author

@swift-ci please test

@finagolfin
Copy link
Member

This pull seems to make no difference when targeting Android armv7:

In file included from /home/butta/swift/stdlib/public/runtime/KnownMetadata.cpp:21:
/home/butta/swift/stdlib/public/runtime/MetadataImpl.h:103:12: error: no matching function for call to 'operator new'
    return new (dest) T(*src);

@compnerd
Copy link
Member Author

Ugh, okay, so reverting the change is not going to help as you mentioned - the underlying problem is that there is a fundamental allocator mismatch that we are not accounting for. We need to figure out how to fix the 32-bit platforms that are not guaranteeing 16-byte alignment (or does android guarantee that? in which case, we have a very simple fix)

@finagolfin
Copy link
Member

does android guarantee that?

Unsure, I don't use armv7 much.

@compnerd
Copy link
Member Author

Okay, verified that Android does not guarantee the required 16-byte alignment (you are only 8-byte aligned on 32-bit which is a problem). Although the ARMv7 builds are currently broken, it is a real issue that this is uncovering. I think that we should repair it forward rather than reverting the change as a result.

@compnerd
Copy link
Member Author

Let's continue the android discussion at #42347 and let this one through to improve the runtime.

@compnerd compnerd merged commit bc769ef into swiftlang:main Apr 14, 2022
@compnerd compnerd deleted the placement branch April 14, 2022 00:58
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.

3 participants