[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:43:06 PDT 2017


dvyukov added a comment.

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

> >> 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.
>
> What do you mean by that?  Can you explain?


Currently we have:

  void *__tsan_external_register_tag(const char *object_type);

I am proposing:

  void *__tsan_external_register_tag(const char *report_header, const char *object_type);

Then we can have customized report header for external tags.
For the dedicated swift tag, you will need to pre-populate the global tag descriptor with necessary report header and object name. Then we don't need any swift-specific changes in ReportRace/PrintReport.
To make this work we will also need to associate tag with the whole report (rather than with memory access descriptors), but it looks like the right thing to do regardless.
I am not sure if we will still need object_type then.


https://reviews.llvm.org/D31630





More information about the llvm-commits mailing list