Bug 171387 - AirLowerStackArgs: generate less code for large offsets
Summary: AirLowerStackArgs: generate less code for large offsets
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on: 170215
Blocks:
  Show dependency treegraph
 
Reported: 2017-04-27 12:47 PDT by JF Bastien
Modified: 2017-04-27 12:47 PDT (History)
6 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description JF Bastien 2017-04-27 12:47:05 PDT
As part of bug #170215 I'm teaching AirowerStackArgs to handle large offsets from FP / SP on ARM, because it used to just assert.

We'll turn code such as:
    Move (spill337), (spill201), %r0, @8735

Into:
    Move $1404, %r16, @8736
    Add64 %sp, %r16, @8736
    Move (%r16), 2032(%sp), %r0, @8736

The code I'm writing for now will be silly and won't re-use r16 for large offsets even if it could.

This could be generated:
    Move 1416(%sp), 2016(%sp), %r0, @8735
    Move $1404, %r16, @8736
    Add64 %sp, %r16, @8736
    Move (%r16), 2032(%sp), %r0, @8736
    Move 1400(%sp), 2024(%sp), %r0, @8737
    Move 16(%r16), 2160(%sp), %r0, @8738
    Move 360(%r16), 2280(%sp), %r0, @8739
    Move 1376(%sp), 2080(%sp), %r0, @8740
    Move 24(%r16), 2104(%sp), %r0, @8741
    Move 1040(%sp), -208(%fp), %r0, @8742
    Move 1360(%sp), 2200(%sp), %r0, @8743
    Move 8(%r16), 2048(%sp), %r0, @8744
    Move 1048(%sp), -248(%fp), %r0, @8745
    Move 1328(%sp), -200(%fp), %r0, @8746
    Move 1392(%sp), 2176(%sp), %r0, @8747
    Move 1384(%sp), 2088(%sp), %r0, @8748
    Move 32(%r16), 2096(%sp), %r0, @8749
    Move 1344(%sp), 2328(%sp), %r0, @8750
    Move 40(%r16), 2120(%sp), %r0, @8751
    Move 56(%r16), 2240(%sp), %r0, @8752
    Move 1312(%sp), -216(%fp), %r0, @8753
    Move 1320(%sp), -232(%fp), %r0, @8754
    Move 1336(%sp), 2248(%sp), %r0, @8755
    Move 64(%r16), 2224(%sp), %r0, @8756
    Move32 1356(%sp), %r1, @8757

The code simply needs to, per basic block:
 - Track the last offset value generated in r16
 - Invalidate on clobber (dest==r16 or writesPinned calls)
 - If a new offset doesn't fit in addr, update the tracking value

This isn't super risky but also isn't worth doing in #170215.