-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
revise std::vector uninit-mem hacks under libc++ #1912
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This pull request was exported from Phabricator. Differential Revision: D42459219 |
Summary: Pull Request resolved: facebook#1912 Closes: facebook#1867 The `std::__vector_base` class in libc++ is removed in libc++ 15 (llvm/llvm-project@b82da8b). So the two current implementations of the hacks - the implementation for libc++ 14 and the implementation for earlier libc++ - both fail. Even with libc++ 14, which retains `std::__vector_base`, Xcode 14 fails to compile the hacks: ``` In file included from folly/memory/test/UninitializedMemoryHacksODR.cpp:17: folly/memory/UninitializedMemoryHacks.h:461:1: error: conversion from 'std::__vector_base<char, std::allocator<char>>::pointer std::__vector_base<char, std::allocator<char>>::*' to 'char *std::vector<char>::*' is not allowed in a converted constant expression FOLLY_DECLARE_VECTOR_RESIZE_WITHOUT_INIT(char) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ folly/memory/UninitializedMemoryHacks.h:327:7: note: expanded from macro 'FOLLY_DECLARE_VECTOR_RESIZE_WITHOUT_INIT' &std::vector<TYPE>::__end_, \ ^~~~~~~~~~~~~~~~~~~~~~~~~~ ... ``` Since libc++ is unlikely to change the internal layout of `std::vector` on a cadence which is too frequent for folly - any material change would be an ABI break -, we can use a layout struct rather than a template instance for the hacks and have it work for a range of versions of libc++ and Xcode. Reviewed By: simpkins, swolchok Differential Revision: D42459219 fbshipit-source-id: 379b86055601e5cc166a4d3364ab8d10be86f001
This pull request was exported from Phabricator. Differential Revision: D42459219 |
yfeldblum
force-pushed
the
export-D42459219
branch
from
January 14, 2023 00:52
1e0ce7a
to
a147f52
Compare
This pull request has been merged in f32f2ef. |
facebook-github-bot
pushed a commit
to facebook/hhvm
that referenced
this pull request
Jan 14, 2023
Summary: X-link: facebook/folly#1912 Closes: facebook/folly#1867 The `std::__vector_base` class in libc++ is removed in libc++ 15 (llvm/llvm-project@b82da8b). So the two current implementations of the hacks - the implementation for libc++ 14 and the implementation for earlier libc++ - both fail. Even with libc++ 14, which retains `std::__vector_base`, Xcode 14 fails to compile the hacks: ``` In file included from folly/memory/test/UninitializedMemoryHacksODR.cpp:17: folly/memory/UninitializedMemoryHacks.h:461:1: error: conversion from 'std::__vector_base<char, std::allocator<char>>::pointer std::__vector_base<char, std::allocator<char>>::*' to 'char *std::vector<char>::*' is not allowed in a converted constant expression FOLLY_DECLARE_VECTOR_RESIZE_WITHOUT_INIT(char) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ folly/memory/UninitializedMemoryHacks.h:327:7: note: expanded from macro 'FOLLY_DECLARE_VECTOR_RESIZE_WITHOUT_INIT' &std::vector<TYPE>::__end_, \ ^~~~~~~~~~~~~~~~~~~~~~~~~~ ... ``` Since libc++ is unlikely to change the internal layout of `std::vector` on a cadence which is too frequent for folly - any material change would be an ABI break -, we can use a layout struct rather than a template instance for the hacks and have it work for a range of versions of libc++ and Xcode. Reviewed By: simpkins, swolchok Differential Revision: D42459219 fbshipit-source-id: e23ef383869681b5c81e4301114020b9089c7461
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary:
The
std::__vector_base
class in libc++ is removed in libc++ 15 (llvm/llvm-project@b82da8b). So the two current implementations of the hacks - the implementation for libc++ 14 and the implementation for earlier libc++ - both fail.Even with libc++ 14, which retains
std::__vector_base
, Xcode 14 fails to compile the hacks:Since libc++ is unlikely to change the internal layout of
std::vector
on a cadence which is too frequent for folly, we can use a layout struct rather than a template instance for the hacks and have it work for a range of versions of libc++ and Xcode.Closes: #1867.
Differential Revision: D42459219