On Fri, May 4, 2012 at 1:51 PM, John Harrison <[email protected]> wrote: > I know the llvm-ir has constructs for volatile but I was referring to any > optimizations done above the llvm-ir, such as at the AST level. I am not sure > what kinds of optimizations Rust currently does, so this might not be an > issue.
Good point. One of the core devs would be able to answer for sure, but I think that by virtue of being an unsafe function operating on an unsafe pointer, a volatile_load function should be an optimization barrier relative to the value pointed to by the pointer. I don't think the language can assume anything about the pointee after an unsafe call. One thing I was wondering—don't C11's atomics mostly supersede the use of volatile for shared-memory and MMIO? Volatile's guarantees are pretty weak and are only really sufficient for setjmp/longjmp and (in POSIX) sig_atomic_t on modern architectures. Embedded toolchains may of course have stronger platform-specific guarantees for volatile, but the atomic operations would be more portable and generally useful. -Joe _______________________________________________ Rust-dev mailing list [email protected] https://mail.mozilla.org/listinfo/rust-dev
