Very limited shared promotion

Ola Fosheim Grøstad ola.fosheim.grostad at gmail.com
Sat Jun 22 08:11:32 UTC 2019


On Saturday, 22 June 2019 at 07:53:49 UTC, Walter Bright wrote:
> On 6/21/2019 5:26 PM, Manu wrote:
>> You need an acquire fence before the function returns, it's 
>> trivial.
>
> That's right it is. But the compiler doesn't know you put one 
> there, and scope does not cause it to be put there, and @safe 
> does not, either.


I think perhaps it would be more clear if you make a distinction 
between:


1. fences that inform the compiler that "virtual registers" could 
be stale (conceptual entities at compile time)

2. fences targeting cache coherency (that hardware caches are 
stale at runtime).


If fun() is separately compiled then there should be no 
distinction. The calling context must assume that fun() might 
have changed the values.

So it does not affect (1). And if fun() flushes the caches 
explicitly or explictly loads the values changed by other threads 
after they are done, then it should not affect (2) either.

Right?


Ola.



More information about the Digitalmars-d mailing list