ASM nop

Bruno Medeiros brunodomedeirosATgmail at SPAM.com
Sun Jun 11 15:34:06 PDT 2006


pragma wrote:
> In article <e6c9mm$v9q$1 at digitaldaemon.com>, AKhropov says...
>> Did your turn maximum optimization on?
> 
> As a matter of fact, I did not.  Sure enough, with "-O -inline release"
> specified, the enter/leave instructions dissapear and are replaced with their
> push/pop/mov counterparts (see attached).  :)
> 
> - Eric
> 
> SUB_L00402010:
> push	ebp
> mov	ebp,esp
> nop
> nop
> nop
> cmp	dword ptr [ebp+08h],00000000h
> jnz	L00402022
> mov	eax,[ebp+0Ch]
> inc	eax
> pop	ebp
> retn
> ;------------------------------------------------------------------------------
> L00402022:
> cmp	dword ptr [ebp+0Ch],00000000h
> jnz	L00402039
> push	00000001h
> mov	eax,[ebp+08h]
> dec	eax
> push	eax
> call	SUB_L00402010
> add	esp,00000008h
> pop	ebp
> retn
> ;------------------------------------------------------------------------------
> L00402039:
> mov	eax,[ebp+0Ch]
> dec	eax
> push	eax
> push	[ebp+08h]
> call	SUB_L00402010
> add	esp,00000008h
> push	eax
> mov	eax,[ebp+08h]
> dec	eax
> push	eax
> call	SUB_L00402010
> add	esp,00000008h
> pop	ebp
> retn
> 
> 

What are those NOPs for, if I may ask?

-- 
Bruno Medeiros - CS/E student
http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#D



More information about the Digitalmars-d mailing list