[Bug 126] Add support for attribute to mark data as volatile.
via D.gnu
d.gnu at puremagic.com
Mon Jun 2 04:44:01 PDT 2014
http://bugzilla.gdcproject.org/show_bug.cgi?id=126
--- Comment #11 from Mike <slavo5150 at yahoo.com> ---
Ok, clearly I have not fully understood shared semantics.
> In future, the compiler would memoize the loop and go straight for the
> assignment.
>
> mov $12, _D4test4globi(%rip)
That would be very bad for my memory-mapped I/O needs.
> Regarding peek/poke functions: Don't you think that's too cumbersome?
> I also think shared + peek/poke has the drawback that you can still
> accidentally access it like a normal shared variable, without the peek/poke
> guarantees.
I do find it cumbersome, but I'm ok with it because I'll be wrapping it in a
mixin or a template. But you make a good point about "accidental" access.
> BTW: I finally finished the volatile DIP, see http://wiki.dlang.org/DIP62.
> It'd be great to get some early feedback from you and Iain, and feel free to
> edit the DIP :-)
The DIP is extremely well written. I've read it a couple of times and I'm
currently studying some of the references. I think you've made a very
compelling case for adding volatile semantics, and I support it, but I must be
honest, peek() and poke() intrinsics would also be fine for me (more about that
later). I'm under the impression, however, that this DIP will be a very tough
sell to Walter.
I've created a "design discussion" around this debate on the D wiki:
http://wiki.dlang.org/Language_design_discussions#volatile
If we are to lobby the core design team to accept this DIP it would probably be
wise to review past discussions and prepare offensive and defensive arguments.
Walter said in the past that there is debate about what 'volatile' really means
(http://forum.dlang.org/post/l4afr7$2pj8$1@digitalmars.com) and argues that
peek() and poke() intrinsics is the "correct and guaranteed way" to do
memory-mapped I/O (http://forum.dlang.org/post/l4abnd$2met$1@digitalmars.com)
Daniel Murphy argued that it is property of the load/store operation and not
the variable (http://forum.dlang.org/post/l4b1j4$acl$1@digitalmars.com) and, I
think this is the core of the debate.
DIP62 makes a compelling case for why 'volatile' should be a property of the
type, but I think it would help to justify why 'volatile' is not a property of
the load/store operation. I can actually see it both ways, and am therefore
somewhat on the fence.
--
You are receiving this mail because:
You are watching all bug changes.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/d.gnu/attachments/20140602/fbd613fc/attachment.html>
More information about the D.gnu
mailing list