make functions frameless if they don't need a frame #43208
Labels
area-vm
Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends.
type-performance
Issue relates to performance or code size
vm-aot-code-size
Related to improvements in AOT code size
If a function is a leaf and does not contain any spills it does not need a frame.
POC mraleph@a70a694 reveals that a lot of functions in Flutter Gallery fit this definition - and dropping frame setup leads to a significant code size improvement (and potentially performance improvement as well).
Store barrier introduces a slight complication into this on ARM/ARM64 because of its outlined slow-path. This slow-path can only call leaf-runtime entry, but nevertheless calling the slow-path clobbers
LR
. We already support generating store barriers in intrinsics - which are also frameless and thus don't haveLR
saved - however this introduces explicit pushing and popping ofLR
which needs to be taken into account when deciding if it is worth to setup a frame (e.g. POC allows at most 1 instruction with a store barrier per frameless function). One dodgy part here is the lack of static guarantee: location summaries capture which instructions perform calls and which don't, with the exception of store barrier call. I suggest that turning POC into a real implementation requires at least adding an assertion that checks that branch-link instruction is only allows to be emitted when IL instruction is marked as clobbering LR.part of go/dart-llvm-assessment
/cc @mkustermann for triage and assignment
The text was updated successfully, but these errors were encountered: