[PATCH] D31630: [tsan] Detect races on modifying accesses in Swift code

Kuba (Brecka) Mracek via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 21 18:02:31 PDT 2017


kubamracek added a comment.

> ThreadSanitizer: race on Swift array
>  ThreadSanitizer: race on Swift map

Unfortunately, we won't be able to tell the type of the variable (at least not now).  I've updated the patch to say "race on Swift variable", but that's not really exact and it's not describing the problem well.  Swift is getting exact threading rules that are very different from C/C++ and I'm trying to focus on making the reports readable and understandable by Swift users.

Is there a way we could still special-case the Swift reports?  I understand the desire to keep the API generic, but I think we need to make sure the users understand the report.  E.g. "Swift access race" much better describes what the problem is, and users words that define the Swift threading model.

> Also, could swift runtime register a tag at startup? Or performance overhead is a concern?

It's quite hard to make the runtime call the registration at process startup, because it would need to dynamically figure out whether we're running with TSan or not, plus we'd need to add an indirection to each access (to read the value of the tag).  I'd really prefer to keep the value as a well-defined constant in TSan.


https://reviews.llvm.org/D31630





More information about the llvm-commits mailing list