Skip to content

Revisit when to use RBP frames on x64 with SysV ABI #8557

@AndyAyersMS

Description

@AndyAyersMS

Various comments in the code lead one to believe that on x64 with SysV ABI we always want the jit to create RBP frames (eg to facilitate simple native unwinding through managed code).

However the JIT doesn't always generate RBP frames; as best I can tell the logic for deciding is found in rpMustCreateEBPFrame which has a number of critera. Quite often we see RBP frames that don't really serve any useful purpose and probably don't enhance diagnosability in any substantial way.

So it might make sense to revisit this and see if freeing up RBP in more cases makes sense.

For example, RBP frames frequently show up in simple IL stubs, eg

; Assembly listing for method DomainNeutralILStubClass:IL_STUB_InstantiatingStub():ref:this

G_M22978_IG01:
       55                   push     rbp
       488BEC               mov      rbp, rsp
G_M22978_IG02:
       48BE08017C42427F0000 mov      rsi, 0x7F42427C0108
       48B8F0C6613F427F0000 mov      rax, 0x7F423F61C6F0
G_M22978_IG03:
       5D                   pop      rbp
       48FFE0               rex.jmp  rax

A perhaps more contentious example is found in the benchmark Benchi/Ackermann, where the extra RPB push induces an otherwise useless push of RAX, presumably to maintain frame alignment.

; Assembly listing for method Ackermann:Acker(int,int):int

G_M25416_IG01:
       55                   push     rbp
       53                   push     rbx
       50                   push     rax
       488D6C2410           lea      rbp, [rsp+10H]
       8BDF                 mov      ebx, edi
...

In heavily recursive methods like this the epilog/prolog overhead has a significant impact on performance.

category:cq
theme:prolog-epilog
skill-level:intermediate
cost:medium

Metadata

Metadata

Assignees

Labels

area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMIenhancementProduct code improvement that does NOT require public API changes/additionsoptimizationos-linuxLinux OS (any supported distro)tenet-performancePerformance related issue

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions