[fpc-devel] Question about NOP instructions

J. Gareth Moreton gareth at moreton-family.com
Sun Nov 3 21:54:50 CET 2019


I figured that was the case.  I don't intend to touch NOP instructions 
because of their uses in exception handling, but is there any harm in 
moving the local jumps to branch to after the NOP instructions, for example?

Gareth aka. Kit

On 03/11/2019 19:26, Florian Klämpfl wrote:
> 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.
> _______________________________________________
> fpc-devel maillist  -  fpc-devel at lists.freepascal.org
> https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
>

-- 
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus



More information about the fpc-devel mailing list