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

Dmitry Vyukov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 25 09:20:54 PDT 2017


dvyukov added a comment.

In https://reviews.llvm.org/D31630#736944, @kubamracek wrote:

> In https://reviews.llvm.org/D31630#736670, @dvyukov wrote:
>
> > In https://reviews.llvm.org/D31630#734474, @kubamracek wrote:
> >
> > > > 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.
> >
> >
> > Humm... what is so special about Swift? Isn't it that concurrent accesses to some objects are a bug? I would expect that it is, and then it's no different from C/C++ variables, C++ containers, Go variables and containers, Java containers, file descriptors and everything else.
> >
> > I don't understand why saying race or data race on something is confusing or not understand-able. What's ambiguous/obscure/wrong about it?
> >  On the other hand I have problems understanding meaning of "Swift access race". Does it mean "race during access to a Swift object"? If so it's semantically equivalent to "race on Swift object".
>
>
> The memory/threading model of Swift defines races in terms of accesses:  Starting a new "modifying" access requires that there are no outstanding accesses.  And "access" here means the formal duration over which the variable is accessed, e.g. the whole function call for inout arguments.  This is all pretty new and still being worked on:  https://github.com/apple/swift/blob/master/docs/OwnershipManifesto.md.


Then let's register report header for external tags.


https://reviews.llvm.org/D31630





More information about the llvm-commits mailing list