9851 add sys/containerof.h and implement __containerof

Review Request #1218 - Created Sept. 19, 2018 and updated

Information
Toomas Soome
illumos-gate
9851
079fc4c...
Reviewers
general

9851 add sys/containerof.h and implement __containerof

disasm of vioif.c (because it is nice and small function):
before patch:

0000000000001700 <vioif_tx_handler>:
    1700:       55                      push   %rbp
    1701:       48 89 e5                mov    %rsp,%rbp
    1704:       57                      push   %rdi
    1705:       48 83 ef 08             sub    $0x8,%rdi
    1709:       56                      push   %rsi
    170a:       e8 71 f2 ff ff          callq  980 <vioif_reclaim_used_tx>
    170f:       b8 01 00 00 00          mov    $0x1,%eax
    1714:       c9                      leaveq 
    1715:       c3                      retq   
    1716:       66 2e 0f 1f 84 00 00    nopw   %cs:0x0(%rax,%rax,1)
    171d:       00 00 00 

and after:

0000000000001700 <vioif_tx_handler>:
    1700:       55                      push   %rbp
    1701:       48 89 e5                mov    %rsp,%rbp
    1704:       57                      push   %rdi
    1705:       48 83 ef 08             sub    $0x8,%rdi
    1709:       56                      push   %rsi
    170a:       e8 71 f2 ff ff          callq  980 <vioif_reclaim_used_tx>
    170f:       b8 01 00 00 00          mov    $0x1,%eax
    1714:       c9                      leaveq 
    1715:       c3                      retq   
    1716:       66 2e 0f 1f 84 00 00    nopw   %cs:0x0(%rax,%rax,1)
    171d:       00 00 00 

So we have exactly the same result, and the temporary variable and assignment are reduced.

Issues

  • 0
  • 7
  • 0
  • 7
Description From Last Updated
Toomas Soome
Joshua Clulow
Toomas Soome
Robert Mustacchi
Toomas Soome
Robert Mustacchi
Toomas Soome
Toomas Soome
Robert Mustacchi
Joshua Clulow
Toomas Soome
Joshua Clulow
Andy Fiddaman
Joshua Clulow
Toomas Soome
Review request changed

Testing Done:

  +

disasm of vioif.c (because it is nice and small function):

  + before patch:

  +
  +
0000000000001700 <vioif_tx_handler>:
  +
    1700:       55                      push   %rbp
  +
    1701:       48 89 e5                mov    %rsp,%rbp
  +
    1704:       57                      push   %rdi
  +
    1705:       48 83 ef 08             sub    $0x8,%rdi
  +
    1709:       56                      push   %rsi
  +
    170a:       e8 71 f2 ff ff          callq  980 <vioif_reclaim_used_tx>
  +
    170f:       b8 01 00 00 00          mov    $0x1,%eax
  +
    1714:       c9                      leaveq 
  +
    1715:       c3                      retq   
  +
    1716:       66 2e 0f 1f 84 00 00    nopw   %cs:0x0(%rax,%rax,1)
  +
    171d:       00 00 00 
  +
  +
  +

  +
  +

and after:

  +
  +
0000000000001700 <vioif_tx_handler>:
  +
    1700:       55                      push   %rbp
  +
    1701:       48 89 e5                mov    %rsp,%rbp
  +
    1704:       57                      push   %rdi
  +
    1705:       48 83 ef 08             sub    $0x8,%rdi
  +
    1709:       56                      push   %rsi
  +
    170a:       e8 71 f2 ff ff          callq  980 <vioif_reclaim_used_tx>
  +
    170f:       b8 01 00 00 00          mov    $0x1,%eax
  +
    1714:       c9                      leaveq 
  +
    1715:       c3                      retq   
  +
    1716:       66 2e 0f 1f 84 00 00    nopw   %cs:0x0(%rax,%rax,1)
  +
    171d:       00 00 00 
  +
  +
  +

  +
  +

So we have exactly the same result, and the temporary variable and assignment are reduced.

Andy Fiddaman
Ship It!
Loading...