DIP 1024---Shared Atomics---Final Review

Dennis dkorpel at gmail.com
Sun Dec 8 17:42:49 UTC 2019


On Sunday, 8 December 2019 at 16:25:21 UTC, Mike Parker wrote:
> https://github.com/dlang/DIPs/blob/78a5bc098fa00c44f11d1819919eb78b8d263254/DIPs/DIP1024.md

Do the limitations apply to inline assembly?

While working on a Phobos PR [1] I tried changing a __gshared 
variable declaration [2] to shared to make the function @safe. 
The variable is only written to with a mov instruction [3] for 
timing reasons, and never read.

The DIP doesn't specify what happens here, though I'd argue that 
assembly blocks are inherently "no type system, you know what 
you're doing" so it can be allowed.

If it is going to be forbidden, then I need to know how to cast 
away shared from a global variable in inline assembly.

[1] https://github.com/dlang/phobos/pull/7296
[2] 
https://github.com/dlang/phobos/blob/a24888e533adfe8d141eb598be22a50df5e26a66/std/internal/math/biguintx86.d#L759
[3] 
https://github.com/dlang/phobos/blob/a24888e533adfe8d141eb598be22a50df5e26a66/std/internal/math/biguintx86.d#L692


More information about the Digitalmars-d mailing list