This is an archive of the discontinued LLVM Phabricator instance.

[libc++abi] Simplify __cxa_get_globals_fast callsites
Changes PlannedPublic

Authored by smeenai on Nov 22 2022, 2:37 PM.

Details

Reviewers
MaskRay
Group Reviewers
Restricted Project
Summary

Now that __cxa_get_globals is unconditionally using TLS (if we support
threads), it's equivalent to __cxa_get_globals_fast, and we don't need
to check if the return value of the latter is null. Update the test to
check this property as well.

Diff Detail

Event Timeline

smeenai created this revision.Nov 22 2022, 2:37 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 22 2022, 2:37 PM
smeenai requested review of this revision.Nov 22 2022, 2:37 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 22 2022, 2:37 PM
Herald added a reviewer: Restricted Project. · View Herald Transcript
MaskRay added inline comments.Nov 22 2022, 2:43 PM
libcxxabi/test/test_exception_storage.pass.cpp
31

The adjustment should be merged into D138460

smeenai added inline comments.Nov 22 2022, 2:52 PM
libcxxabi/test/test_exception_storage.pass.cpp
31

D138460 was originally stacked under D138461, and D138461 is what guaranteed that __cxa_get_globals_fast would be non-null even if you called it on a thread before __cxa_get_globals, so it wasn't correct to make the change then. It could be folded into D138460 now (since D138461 landed before it), but I felt it made more sense to keep it here. This change is the follow-up to D138461 that tweaks the rest of the code to rely on __cxa_get_globals_fast never returning non-null, and so I wanted the test for that specific functionality to also live here.

MaskRay accepted this revision.Nov 22 2022, 3:09 PM

I checked every calls site of __cxa_get_globals_fast and confirm that this is comprehenstive.

libcxxabi/test/test_exception_storage.pass.cpp
31

Ah, right. Thanks for the description.

smeenai updated this revision to Diff 477325.Nov 22 2022, 3:33 PM

Update test comment

thakis added a subscriber: thakis.Nov 23 2022, 7:10 AM
thakis added inline comments.
libcxxabi/test/test_exception_storage.pass.cpp
31

D138461 seems to break things, so maybe it'll have to be reverted again (see comments over there).

smeenai planned changes to this revision.Nov 29 2022, 7:41 PM

Pausing this while D138461 is sorted out.