This is an archive of the discontinued LLVM Phabricator instance.

[libcxxabi] Make InitByteGlobalMutex check GetThreadID instead of PlatformThreadID
ClosedPublic

Authored by DanielMcIntosh-IBM on Sep 20 2021, 11:17 AM.

Details

Summary

By relying on PlatformSupportsThreadID, InitByteGlobalMutex disregards
the GetThreadID template argument, rendering it useless.

This is the 2nd of 5 changes to overhaul cxa_guard.
See D108343 for what the final result will be.

Depends on D109539

Diff Detail

Event Timeline

DanielMcIntosh-IBM requested review of this revision.Sep 20 2021, 11:17 AM
DanielMcIntosh-IBM created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptSep 20 2021, 11:17 AM
Herald added a reviewer: Restricted Project. · View Herald Transcript
DanielMcIntosh-IBM edited the summary of this revision. (Show Details)Sep 20 2021, 11:50 AM
ldionne requested changes to this revision.Sep 20 2021, 2:02 PM

Can you quickly explain why this is going to simplify your life in the other patches? Without knowing more about your motivations, I would say that PlatformSupportsThreadID() provides more information to the reader than testing PlatfromThreadID != nullptr, so I'd be tempted to think it's a useful abstraction to keep. Why are you removing it?

This revision now requires changes to proceed.Sep 20 2021, 2:02 PM
DanielMcIntosh-IBM added a comment.EditedSep 20 2021, 2:37 PM

Can you quickly explain why this is going to simplify your life in the other patches? Without knowing more about your motivations, I would say that PlatformSupportsThreadID() provides more information to the reader than testing PlatfromThreadID != nullptr, so I'd be tempted to think it's a useful abstraction to keep. Why are you removing it?

Removing PlatformSupportsThreadID() was not the purpose of this change. The purpose was to fix InitByteGlobalMutex. It just so happens that after fixing InitByteGlobalMutex, PlatformSupportsThreadID() is no longer used outside the test, at which point I figured it's dead code and should be removed. I could leave it there too, and it wouldn't cause any problems, but since all the Guards (except InitByteNoThreads) have a function pointer template parameter, they should be checking their template argument, not PlatfromThreadID, rendering PlatformSupportsThreadID useless anyways.

As for simplifying my life in the other patches, I suppose it doesn't really, and could probably go in as a separate patch independent of the rest of the cxa_guard re-write.

No change, just need to trigger the build again

ldionne accepted this revision.Sep 23 2021, 9:12 AM

Ahhh I see, thanks. I hadn't read the commit description carefully, thanks a lot. LGTM (and good find)!

This revision is now accepted and ready to land.Sep 23 2021, 9:12 AM
DanielMcIntosh-IBM edited the summary of this revision. (Show Details)Sep 23 2021, 9:25 AM

(I'm waiting for the other 5 related PRs to get approved before landing to reduce the number of times we have to resolve merge conflicts downstream)

DanielMcIntosh-IBM edited the summary of this revision. (Show Details)Dec 8 2021, 11:43 AM

No change, just re-trigger CI so later dependent changes update their base revision

DanielMcIntosh-IBM edited the summary of this revision. (Show Details)Jan 10 2022, 2:19 PM
This revision was landed with ongoing or failed builds.Jan 12 2022, 2:30 PM
This revision was automatically updated to reflect the committed changes.