Atomic Ref Counting

Johann MacDonagh johann.macdonagh..no at spam..gmail.com
Tue Nov 23 21:46:47 PST 2010


On 11/23/2010 8:13 PM, Johann MacDonagh wrote:
> Did you try the inline ASM block without explicit register preservation?
> Walter replied to your message before
> (http://www.digitalmars.com/d/archives/digitalmars/D/Register_Preservation_in_Inline_ASM_Blocks_122470.html)
> and said the compiler will work around any registers you use in inline
> blocks. I tested it out and I can confirm he wasn't lying ;)
>
> I'm not by a machine with dmd otherwise I'd try myself. Try removing the
> explicit push/pops of the registers and use ecx instead of ebx in the
> second diff (use of it forces dmd to push ebx in the prologue because
> its callee save). Might save a considerable amount of cycles.

Ah nvm. Results in a 6% or so savings. It's definitely the lock prefix 
slowing it down.

Mostly OT, what was the rationale for requiring the lock prefix being a 
separate statement in inline ASM? NASM and MASM keep it inline with the 
statement it affects.


More information about the Digitalmars-d mailing list