-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[Runtime] Scribble on metadata allocations. #32408
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
[Runtime] Scribble on metadata allocations. #32408
Conversation
@swift-ci please test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one small change, otherwise looks great. This should help a lot. I wonder if we should set up CI to run with this enabled (aside from performance tests) permanently?
stdlib/public/runtime/Metadata.cpp
Outdated
// SWIFT_DEBUG_ENABLE_MALLOC_SCRIBBLE environment variable is set. | ||
static OnceToken_t getenvToken; | ||
SWIFT_ONCE_F(getenvToken, checkMallocScribbleEnvironmentVariable, nullptr); | ||
if (SWIFT_UNLIKELY(_swift_debug_mallocScribbleEnabled)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The SWIFT_DEBUG_ENABLE_MALLOC_SCRIBBLE()
call will compile down to a SWIFT_ONCE_F
and an access to a global variable, so you can remove your own SWIFT_ONCE_F
and global and just check that directly. (You might have seen me doing this with _swift_debug_metadataAllocationIterationEnabled
, but that's only because there's additional setup needed when it's enabled.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the explanation! Fixed.
Build failed |
0ff21a1
to
4d4d90e
Compare
Previously, when NDEBUG was not defined, the allocations made for value metadata records were filled with 0xAA bytes. Here, that behavior is both expanded to all metadata records and enabled in release builds when the environment variable SWIFT_DEBUG_ENABLE_MALLOC_SCRIBBLE is set.
Build failed |
4d4d90e
to
5f67ef4
Compare
@swift-ci please test |
Build failed |
Build failed |
@swift-ci please clean test os x platform |
Previously, when
NDEBUG
was not defined, the allocations made for value metadata records were filled with0xAA
bytes. Here, that behavior is both expanded to all metadata records and enabled in release builds when the environment variableSWIFT_DEBUG_ENABLE_MALLOC_SCRIBBLE
is set.