[Issue 4440] inlined delegates produces different asm than straight lined code

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Jul 9 08:39:02 PDT 2010


http://d.puremagic.com/issues/show_bug.cgi?id=4440


Leandro Lucarella <llucax at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |llucax at gmail.com


--- Comment #1 from Leandro Lucarella <llucax at gmail.com> 2010-07-09 08:38:57 PDT ---
I'm not very keen at reading asm, but I'm seeing a couple of 'call's in the
generated code:

---
$ dmd -release -O -gc -inline -c test.d
$ objdump -d test.o

test.o:     file format elf32-i386


Disassembly of section .text:

00000000 <.text>:
   0:    c3                       ret    
   1:    60                       pusha  
   2:    b8 38 00 00 00           mov    $0x38,%eax
   7:    b9 00 00 00 00           mov    $0x0,%ecx
   c:    8b 11                    mov    (%ecx),%edx
   e:    89 10                    mov    %edx,(%eax)
  10:    89 01                    mov    %eax,(%ecx)
  12:    61                       popa   
  13:    c3                       ret    

Disassembly of section .text._D4test7find_ifFDFKiZbZi:

00000000 <_D4test7find_ifFDFKiZbZi>:
   0:    55                       push   %ebp
   1:    8b ec                    mov    %esp,%ebp
   3:    83 ec 0c                 sub    $0xc,%esp
   6:    53                       push   %ebx
   7:    8b 55 0c                 mov    0xc(%ebp),%edx
   a:    8b 45 08                 mov    0x8(%ebp),%eax
   d:    c7 45 fc 00 00 00 00     movl   $0x0,-0x4(%ebp)
  14:    89 d3                    mov    %edx,%ebx
  16:    8d 4d fc                 lea    -0x4(%ebp),%ecx
  19:    8b 45 08                 mov    0x8(%ebp),%eax
  1c:    51                       push   %ecx
  1d:    ff d3                    call   *%ebx
  1f:    84 c0                    test   %al,%al
  21:    74 0a                    je     2d <_D4test7find_ifFDFKiZbZi+0x2d>
  23:    8b 45 fc                 mov    -0x4(%ebp),%eax
  26:    5b                       pop    %ebx
  27:    8b e5                    mov    %ebp,%esp
  29:    5d                       pop    %ebp
  2a:    c2 08 00                 ret    $0x8
  2d:    ff 45 fc                 incl   -0x4(%ebp)
  30:    83 7d fc 64              cmpl   $0x64,-0x4(%ebp)
  34:    7c e0                    jl     16 <_D4test7find_ifFDFKiZbZi+0x16>
  36:    5b                       pop    %ebx
  37:    8b e5                    mov    %ebp,%esp
  39:    b8 ff ff ff ff           mov    $0xffffffff,%eax
  3e:    5d                       pop    %ebp
  3f:    c2 08 00                 ret    $0x8
  42:    90                       nop
  43:    90                       nop

Disassembly of section .text._Dmain:

00000000 <_Dmain>:
   0:    55                       push   %ebp
   1:    8b ec                    mov    %esp,%ebp
   3:    b9 00 00 00 00           mov    $0x0,%ecx
   8:    51                       push   %ecx
   9:    31 c0                    xor    %eax,%eax
   b:    50                       push   %eax
   c:    e8 fc ff ff ff           call   d <_Dmain+0xd>
  11:    5d                       pop    %ebp
  12:    c3                       ret    
  13:    90                       nop

Disassembly of section .text._D4test4mainFZi12__dgliteral1MFKiZb:

00000000 <_D4test4mainFZi12__dgliteral1MFKiZb>:
   0:    55                       push   %ebp
   1:    8b ec                    mov    %esp,%ebp
   3:    50                       push   %eax
   4:    8b 4d 08                 mov    0x8(%ebp),%ecx
   7:    b8 01 00 00 00           mov    $0x1,%eax
   c:    83 39 63                 cmpl   $0x63,(%ecx)
   f:    74 02                    je     13
<_D4test4mainFZi12__dgliteral1MFKiZb+0x13>
  11:    31 c0                    xor    %eax,%eax
  13:    8b e5                    mov    %ebp,%esp
  15:    5d                       pop    %ebp
  16:    c2 04 00                 ret    $0x4
---

Am I understanding it all wrong?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list