Skip to content

Instantly share code, notes, and snippets.

@toshok

toshok/pgo.md Secret

Last active August 29, 2015 14:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save toshok/2c5f876e94ae7b492883 to your computer and use it in GitHub Desktop.
Save toshok/2c5f876e94ae7b492883 to your computer and use it in GitHub Desktop.

gcc 4.8 -O3 build:

00000000006f3dd0 <_ZN6pystonL21_checkUnpackingLengthEll>:
  6f3dd0:       48 39 fe                cmp    %rdi,%rsi
  6f3dd3:       74 4b                   je     6f3e20 <_ZN6pystonL21_checkUnpackingLengthEll+0x50>
  6f3dd5:       55                      push   %rbp
1 6f3dd6:       48 89 e5                mov    %rsp,%rbp
2 6f3dd9:       7f 47                   jg     6f3e22 <_ZN6pystonL21_checkUnpackingLengthEll+0x52>
  6f3ddb:       48 83 fe 01             cmp    $0x1,%rsi
  6f3ddf:       74 1f                   je     6f3e00 <_ZN6pystonL21_checkUnpackingLengthEll+0x30>
  6f3de1:       48 8b 3d f8 00 10 01    mov    0x11000f8(%rip),%rdi        # 17f3ee0 <PyExc_ValueError>
  6f3de8:       48 89 f2                mov    %rsi,%rdx
  6f3deb:       31 c0                   xor    %eax,%eax
  6f3ded:       be 20 4d 1f 01          mov    $0x11f4d20,%esi
  6f3df2:       e8 39 c6 01 00          callq  710430 <_ZN6pyston14raiseExcHelperEPNS_10BoxedClassEPKcz>
  6f3df7:       66 0f 1f 84 00 00 00    nopw   0x0(%rax,%rax,1)
  6f3dfe:       00 00
  6f3e00:       48 8b 3d d9 00 10 01    mov    0x11000d9(%rip),%rdi        # 17f3ee0 <PyExc_ValueError>
  6f3e07:       ba 01 00 00 00          mov    $0x1,%edx
  6f3e0c:       be f8 4c 1f 01          mov    $0x11f4cf8,%esi
  6f3e11:       31 c0                   xor    %eax,%eax
  6f3e13:       e8 18 c6 01 00          callq  710430 <_ZN6pyston14raiseExcHelperEPNS_10BoxedClassEPKcz>
  6f3e18:       0f 1f 84 00 00 00 00    nopl   0x0(%rax,%rax,1)
  6f3e1f:       00
3 6f3e20:       f3 c3                   repz retq
4 6f3e22:       48 8b 3d b7 00 10 01    mov    0x11000b7(%rip),%rdi        # 17f3ee0 <PyExc_ValueError>
  6f3e29:       be 5d 3a 22 01          mov    $0x1223a5d,%esi
  6f3e2e:       31 c0                   xor    %eax,%eax
  6f3e30:       e8 fb c5 01 00          callq  710430 <_ZN6pyston14raiseExcHelperEPNS_10BoxedClassEPKcz>
  6f3e35:       66 66 2e 0f 1f 84 00    data32 nopw %cs:0x0(%rax,%rax,1)
  6f3e3c:       00 00 00 00

0001e620 0000000000000024 0001e624 FDE cie=00000000 pc=00000000006f3dd0..00000000006f3e35
1 DW_CFA_advance_loc: 6 to 00000000006f3dd6
  DW_CFA_def_cfa_offset: 16
  DW_CFA_offset: r6 (rbp) at cfa-16
2 DW_CFA_advance_loc: 3 to 00000000006f3dd9
  DW_CFA_def_cfa_register: r6 (rbp)
3 DW_CFA_advance_loc1: 71 to 00000000006f3e20
  DW_CFA_def_cfa: r7 (rsp) ofs 8
  DW_CFA_restore: r6 (rbp)
4 DW_CFA_advance_loc: 2 to 00000000006f3e22
  DW_CFA_def_cfa: r6 (rbp) ofs 16
  DW_CFA_offset: r6 (rbp) at cfa-16
  DW_CFA_nop
  DW_CFA_nop
  DW_CFA_nop

gcc 4.8 -O3 -fprofile-generate build:

00000000008e2100 <_ZN6pystonL21_checkUnpackingLengthEll>:
  8e2100:       48 39 fe                  cmp    %rdi,%rsi
  8e2103:       74 4b                     je     8e2150 <_ZN6pystonL21_checkUnpackingLengthEll+0x50>
  8e2105:       55                        push   %rbp
1 8e2106:       48 89 e5                  mov    %rsp,%rbp
2 8e2109:       7f 4e                     jg     8e2159 <_ZN6pystonL21_checkUnpackingLengthEll+0x59>
  8e210b:       48 83 fe 01               cmp    $0x1,%rsi
  8e210f:       74 1f                     je     8e2130 <_ZN6pystonL21_checkUnpackingLengthEll+0x30>
  8e2111:       48 8b 3d 08 25 ba 01      mov    0x1ba2508(%rip),%rdi        # 2484620 <PyExc_ValueError>
  8e2118:       48 89 f2                  mov    %rsi,%rdx
  8e211b:       31 c0                     xor    %eax,%eax
  8e211d:       be 48 02 ae 01            mov    $0x1ae0248,%esi
  8e2122:       48 83 05 ce 56 5c 02 01   addq   $0x1,0x25c56ce(%rip)        # 2ea77f8 <__gcov0._ZN6pystonL21_checkUnpackingLengthEll+0x18>
  8e212a:       e8 d1 ef 02 00            callq  911100 <_ZN6pyston14raiseExcHelperEPNS_10BoxedClassEPKcz>
  8e212f:       90                        nop
  8e2130:       48 8b 3d e9 24 ba 01      mov    0x1ba24e9(%rip),%rdi        # 2484620 <PyExc_ValueError>
  8e2137:       ba 01 00 00 00            mov    $0x1,%edx
  8e213c:       be 20 02 ae 01            mov    $0x1ae0220,%esi
  8e2141:       31 c0                     xor    %eax,%eax
  8e2143:       48 83 05 a5 56 5c 02 01   addq   $0x1,0x25c56a5(%rip)        # 2ea77f0 <__gcov0._ZN6pystonL21_checkUnpackingLengthEll+0x10>
  8e214b:       e8 b0 ef 02 00            callq  911100 <_ZN6pyston14raiseExcHelperEPNS_10BoxedClassEPKcz>
3 8e2150:       48 83 05 88 56 5c 02 01   addq   $0x1,0x25c5688(%rip)        # 2ea77e0 <__gcov0._ZN6pystonL21_checkUnpackingLengthEll>
  8e2158:       c3                        retq
4 8e2159:       48 8b 3d c0 24 ba 01      mov    0x1ba24c0(%rip),%rdi        # 2484620 <PyExc_ValueError>
  8e2160:       be 24 db b1 01            mov    $0x1b1db24,%esi
  8e2165:       31 c0                     xor    %eax,%eax
  8e2167:       48 83 05 79 56 5c 02 01   addq   $0x1,0x25c5679(%rip)        # 2ea77e8 <__gcov0._ZN6pystonL21_checkUnpackingLengthEll+0x8>
  8e216f:       e8 8c ef 02 00            callq  911100 <_ZN6pyston14raiseExcHelperEPNS_10BoxedClassEPKcz>
  8e2174:       66 66 66 2e 0f 1f 84      data32 data32 nopw %cs:0x0(%rax,%rax,1)
  8e217b:       00 00 00 00 00

0002e178 0000000000000024 0002e17c FDE cie=00000000 pc=00000000008e2100..00000000008e2174
1 DW_CFA_advance_loc: 6 to 00000000008e2106
  DW_CFA_def_cfa_offset: 16
  DW_CFA_offset: r6 (rbp) at cfa-16
2 DW_CFA_advance_loc: 3 to 00000000008e2109
  DW_CFA_def_cfa_register: r6 (rbp)
3 DW_CFA_advance_loc1: 71 to 00000000008e2150
  DW_CFA_def_cfa: r7 (rsp) ofs 8
  DW_CFA_restore: r6 (rbp)
4 DW_CFA_advance_loc: 9 to 00000000008e2159
  DW_CFA_def_cfa: r6 (rbp) ofs 16
  DW_CFA_offset: r6 (rbp) at cfa-16
  DW_CFA_nop
  DW_CFA_nop
  DW_CFA_nop

the eh_frame has nearly the same advance_locs in both pgo and non-pgo builds. 6, 3, 71, and 2/9. advance_loc #3 and #4 correspond to the retq and the instruction following the retq in the non-pgo build but in the pgo build #3 doesn’t correspond to the retq anymore. it’s the addq for the gconv counter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment