This is an archive of the discontinued LLVM Phabricator instance.

[tsan] Add __cxa_guard_acquire hooks to support cooperative scheduling
ClosedPublic

Authored by vitalybuka on Nov 16 2018, 11:31 PM.

Diff Detail

Event Timeline

vitalybuka created this revision.Nov 16 2018, 11:31 PM

Is this Linux-only?

dvyukov added inline comments.Nov 17 2018, 9:28 AM
compiler-rt/lib/tsan/rtl/tsan_interceptors.cc
234

I think it will be better to call these annotations in a more generic way. Later we may need to use for other functions as well, e.g. phtread_mutex_lock. Internally we call them potentially_blocking_region_begin/end, so if we don't have better naming ideas we could just copy that.

880

For my education, why can't at_scope_exit call the function 2 or 3 times? Can't it create 2 or 3 copies of RunOnDestruction, each of which will call the function?

dvyukov added inline comments.Nov 17 2018, 9:29 AM
compiler-rt/lib/tsan/rtl/tsan_interceptors.cc
880

Don't we need to define move constructor for RunOnDestruction, delete copy constructor and all that stuff?

vitalybuka marked 3 inline comments as done.

renamed

Is this Linux-only?

Should apply to anything with __cxa_guard_acquire interceptor.

compiler-rt/lib/tsan/rtl/tsan_interceptors.cc
880

That's https://en.cppreference.com/w/cpp/language/copy_elision
If I read this correctly "required" section applies to this case.

dvyukov accepted this revision.Nov 19 2018, 10:23 PM
This revision is now accepted and ready to land.Nov 19 2018, 10:23 PM
This revision was automatically updated to reflect the committed changes.
Herald added a subscriber: Restricted Project. · View Herald TranscriptNov 20 2018, 10:24 AM