[fpc-devel] Question about NOP instructions

Florian Klämpfl florian at freepascal.org
Sun Nov 3 20:26:31 CET 2019


Am 03.11.19 um 18:10 schrieb J. Gareth Moreton:
> Here's a larger snippet of the code in question - it's a bit too long to 
> post, but there's a lot of conditional jumps to .Lj1859 earlier on:
> 
> .Lj1875:
>      testl    $1024,92(%rbx)
>      jne    .Lj1878
>      leaq    .Ld523(%rip),%rax
>      movq    %rax,-56(%rbp)
>      movq    $11,-64(%rbp)
>      movq    64(%rbx),%rax
>      movq    %rax,-40(%rbp)
>      movq    $11,-48(%rbp)
>      leaq    .Ld524(%rip),%rax
>      movq    %rax,-24(%rbp)
>      movq    $11,-32(%rbp)
>      movq    80(%rbx),%rcx
>      leaq    -72(%rbp),%rdx
>      call CUSTOMCODETOOL$_$TCUSTOMCODETOOL_$__$$_MAINFILENAME$$ANSISTRING
>      movq    -72(%rbp),%rax
>      movq    %rax,-8(%rbp)
>      movq    $11,-16(%rbp)
>      leaq    -64(%rbp),%rcx
>      movl    $3,%edx
>      call    FILEPROCS_$$_DEBUGLN$array_of_const
>      orl    $1024,92(%rbx)
> .Lj1878:
>      movq    $0,24(%rbx)
> .Lj1859:
>      nop
> .Lj1858:
>      movq    %rbp,%rcx
>      call 
> IDENTCOMPLETIONTOOL$_$TIDENTIFIERLISTITEM_$_GETNODE$$TCODETREENODE_$$_fin$00000239 
> 
>      movq    %rsi,%rax
>      movq    -88(%rbp),%rbx
>      movq    -80(%rbp),%rsi
>      leaq    (%rbp),%rsp
>      popq    %rbp
>      ret
> .seh_handler __FPC_specific_handler, at unwind
> .seh_handlerdata
>      .long    1
>      .long    0
>      .rva    .Lj1857
>      .rva    .Lj1858
>      .rva 
> IDENTCOMPLETIONTOOL$_$TIDENTIFIERLISTITEM_$_GETNODE$$TCODETREENODE_$$_fin$00000239 
> 
> 
> The two unwind entries (.rva) are labels that come right after a NOP 
> instruction, and are the only references to these labels - meanwhile, 
> the conditional jumps nearer the top go to the labels that appear before 
> the nop instruction and are otherwise just testing registers and memory 
> locations with no calls to other routines.

Yes, this is exception handling code, have a look at 
compiler/x86_64/nx64flw.pas for details.


More information about the fpc-devel mailing list