Save 64 bytes from most Linux/amd64 interpreter frames. (#15926)
commite0335d357056f9017f7c170ed41f5cb7e3e32399
authorJay Krell <jaykrell@microsoft.com>
Wed, 31 Jul 2019 12:20:03 +0000 (31 05:20 -0700)
committerAlexander Köplinger <alex.koeplinger@outlook.com>
Wed, 31 Jul 2019 12:20:03 +0000 (31 14:20 +0200)
treee56eb431a8a01a75fec70c3ebb4ce9f2e0e732c4
parentc8fd75734b7f34ed42968bf7ed9b315303b31abc
Save 64 bytes from most Linux/amd64 interpreter frames. (#15926)

 Probably same on all 64bit architectures. half on 32bit.

before:
```
0000000000003ce0 <interp_exec_method_full>:
    3ce0: 55                    push   %rbp
    3ce1: 48 89 e5              mov    %rsp,%rbp
    3ce4: 41 57                 push   %r15
    3ce6: 41 56                 push   %r14
    3ce8: 41 55                 push   %r13
    3cea: 41 54                 push   %r12
    3cec: 49 89 f4              mov    %rsi,%r12
    3cef: 53                    push   %rbx
    3cf0: 48 89 fb              mov    %rdi,%rbx
    3cf3: 48 81 ec 78 01 00 00  sub    $0x178,%rsp
```

after:
```
0000000000003ce0 <interp_exec_method_full>:
    3ce0: 55                    push   %rbp
    3ce1: 48 89 e5              mov    %rsp,%rbp
    3ce4: 41 57                 push   %r15
    3ce6: 41 56                 push   %r14
    3ce8: 41 55                 push   %r13
    3cea: 41 54                 push   %r12
    3cec: 49 89 f4              mov    %rsi,%r12
    3cef: 53                    push   %rbx
    3cf0: 48 89 fb              mov    %rdi,%rbx
    3cf3: 48 81 ec 38 01 00 00  sub    $0x138,%rsp
```

It was 0x158 recently.

Some frames will be larger, i.e. dynamic + pinvoke.

Classic technique:
 pointer instead of struct
 initialized to null
 alloca it when needed and not null

A more detailed analysis might enable better, such as making
the parameter optional, and/or having the callee default it to its
local storage.
mono/mini/interp/interp.c