Yet again - as just confirmed in a follow-up e-mail of the original poster, better keep him in Cc: of your responses.
Tomas ---------------------------- Original Message ---------------------------- Subject: Re: [fpc-pascal] Lack of 'volatile' a serious issue. Any other such caveats? From: "Marco van de Voort" <mar...@stack.nl> Date: Fri, December 18, 2015 12:24 To: "FPC-Pascal users discussions" <fpc-pascal@lists.freepascal.org> In our previous episode, Jonas Maebe said: > > (you also need it for variables you access from interrupt routines, as they > > might change while a procedure is running) > > If they're global variables, which they presumably are, that's no more > necessary than in the multi-threading case. True, but I write less low level hardware interfacing code there, and use a lot more globals on embedded :-) Also the OS level synchronization primitives used in threaded "full" applications are usually not available on microcontrollers, volatile and the atomicity of (some) instructions is all you have to work with. (yes I do the microcontrollers in C, so the below condition doesn't apply) > >> In FPC, every statement is basically considered to be a compiler-level > >> memory barrier for accesses to global variables. So within a single > >> statement multiple accesses can be optimised, but that cannot happen not > >> across statements. It's not perfect since it inhibits some optimisation, > >> but on the flip side it's very simple and easy to reason about. > > > > That's what I remember from earlier "volatile" discussions. But what about > > LLVM? If you want to squeeze performance out of it, won't that need > > volatile sooner or later? > > It will help, but optimising accesses to global variables is not the > only thing LLVM can do :) Is this between statements caching rule really only globals, or anything non local (like a field of a class) ? _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal