[Swift-devel] Changes to array closing semantics?

Mihael Hategan hategan at mcs.anl.gov
Thu Nov 22 13:30:00 CST 2012


On Thu, 2012-11-22 at 10:44 -0600, Tim Armstrong wrote:

>         I'm guessing the total writer count is determined at run-time
>         by
>         incrementing every time an iteration starts?
>         
>         Can I steal that? I mean we favored doing this analysis
>         statically in
>         swift/k, but I don't see why that should necessarily be the
>         case.
> 
> Of course.  
> 
> Currently we do the dumb thing of incrementing once per loop
> iteration, but I'm going to make a change soon where, if we know how
> many loop iterations there are at the time the loop is started, we'll
> just increment the count by that amount at the start and decrement as
> each iteration finishes (or actually, since we chunk loops up and
> distribute them, as each chunk of the loop finishes).  This works well
> enough.  

I'm also guessing you start with a non-zero count if you have a loop.
Otherwise, if all other statements that write to an array finish before
you start the loop, the array will incorrectly be considered closed.

Mihael




More information about the Swift-devel mailing list