Re: Compiler load/store barrier; volatile pointer; barriers in general

  • From: Mike Pall <mike-1502@xxxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Tue, 3 Feb 2015 22:03:35 +0100

Luke Gorrie wrote:
> Does LuaJIT also forward loads/stores through FFI pointers that are
> declared volatile?

Yes, because the volatile attribute is ignored. See:
http://luajit.org/ext_ffi_semantics.html#status

> (Would the C volatile keyword be a good choice for
> telling LuaJIT about loads/stores that are not to be forwarded?)

Not really. The semantics of C's 'volatile' are a) most often
misunderstood by its users, b) tricky to implement for a compiler
and c) not that useful in practice. That's why I didn't bother to
implement it. Barriers are a much better concept.

--Mike

Other related posts: