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,@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.

In the meantime, I've got my jump code fully tested for i386-win32 and x86_64-win64, but am still documenting everything before I post them in a patch.  I'm not sure how it behaves on non-Intel platforms yet, but I can confirm that it at least compiles.

Gareth aka. Kit

On 03/11/2019 10:44, Florian Klaempfl wrote:
Am 02.11.2019 um 15:08 schrieb J. Gareth Moreton:
Hi everyone,

During my optimisation travels, I frequently stumble across lone NOP
instructions in the compiled assembly language.  Normally I leave these
alone, but occasionally I stumble across things like this:

     ...
     movq    $0,24(%rbx)
.Lj1859:
     nop
.Lj1858:
     movq    %rbp,%rcx
     ...

Can you please post the complete code? Without it, it's hard to say

And there are jumps elsewhere that go to one label or the other. Is
there any reason why a jump should lead to the NOP, or can they all be
redirected to after the NOP instruction?
Some are the result of exception handling on x86_64-win64, see
compiler/x86_64/nx64flw.pas
_______________________________________________
fpc-devel maillist  -  fpc-devel@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

_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply via email to