Re: Max-specific C code optimization guidelines ?


“…and the result you get is not shared among threads.”

It should, but according to “speculative register promotion” and others “Out-Of-Thin-Air Stores” it seems not a compiler guarantee.

I do not want to frightened you ; i did a quick test on my macbook with agressive optimization and everything looks correct (assembly test joined) and my question is more to speculate (and i’m not an expert) that to solve issues…

…but i do not use ATOMIC anymore for this kind off synchronization as i consider mutex much more safe and i do not think speed matters for that as i do nothing RT like DSP callback.


movl	%esi,0x04(%esp,1)
movl	$0x00000001,(%esp,1)

calll	0x0000200f	; symbol stub for: _OSAtomicAdd32Barrier

subl	$0x01,%eax
jne	0x00000f9a

My 2 cents.

Guru’s opinion ?

  1. asm.txt
Jul 30, 2012 at 9:41am #229903