[Tinyos Core WG] atomic statements and visibility
Philip Levis
pal at cs.stanford.edu
Wed May 23 16:42:40 PDT 2007
David Gay wrote:
> I've just made a small change to the __nesc_atomic_start and end
> functions on the atmega128, msp430 and pxa27x by adding
> asm volatile("" : : : "memory"); /* ensure atomic section effect
> visibility */
>
> The goal of this is to ensure that the effects of an atomic statement
> are visible to the rest of the code as soon as the atomic statement
> terminates. Without these statements, it's conceivable that the
> compiler might stash some pending state changes in registers or
> somewhere until some surprisingly late date.
>
> The impact on code size and performance should be minimal. See the
> attached paper (from the PLOS workshop last year) for way more detail
> on this than you probably wanted to know.
"... actually reduces code size slightly, on average. The cause for this
effect is not obvious..."
!!
Phil
More information about the Tinyos-2.0wg
mailing list