Bug 227052 - AssemblyHelpers should save/restore callee save FPRs
Summary: AssemblyHelpers should save/restore callee save FPRs
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Tadeu Zagallo
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-06-15 16:14 PDT by Tadeu Zagallo
Modified: 2021-06-16 09:09 PDT (History)
6 users (show)

See Also:


Attachments
Patch (10.01 KB, patch)
2021-06-15 16:35 PDT, Tadeu Zagallo
no flags Details | Formatted Diff | Diff
Patch (8.85 KB, patch)
2021-06-15 16:55 PDT, Tadeu Zagallo
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch (8.86 KB, patch)
2021-06-15 17:01 PDT, Tadeu Zagallo
no flags Details | Formatted Diff | Diff
Patch for landing (8.85 KB, patch)
2021-06-16 08:29 PDT, Tadeu Zagallo
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tadeu Zagallo 2021-06-15 16:14:38 PDT
<rdar://77080162>
Comment 1 Tadeu Zagallo 2021-06-15 16:35:42 PDT
Created attachment 431496 [details]
Patch
Comment 2 Mark Lam 2021-06-15 16:46:08 PDT
Comment on attachment 431496 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=431496&action=review

> Source/JavaScriptCore/jit/AssemblyHelpers.h:344
> +            if (entry.reg().isGPR())
> +                storePtr(entry.reg().gpr(), Address(framePointerRegister, entry.offset()));
> +            else
> +                storeDouble(entry.reg().fpr(), Address(framePointerRegister, entry.offset()));

You can just do:
    storeReg(entry.reg(), Address(framePointerRegister, entry.offset()));

> Source/JavaScriptCore/jit/AssemblyHelpers.h:383
> +                if (entry.reg().isGPR())
> +                    storePtr(entry.reg().gpr(), Address(framePointerRegister, offsetVirtualRegister.offsetInBytes() + entry.offset()));
> +                else
> +                    storeDouble(entry.reg().fpr(), Address(framePointerRegister, offsetVirtualRegister.offsetInBytes() + entry.offset()));
> +            }

Pretty sure this is not needed because this function is only ever called with a baseline CodeBlock.  Please check if I'm wrong.  If it is baseline CodeBlock only, then just RELEASE_ASSERT the Codeblock JITType at the top.

> Source/JavaScriptCore/jit/AssemblyHelpers.h:407
> +            if (entry.reg().isGPR())
> +                loadPtr(Address(framePointerRegister, entry.offset()), entry.reg().gpr());
> +            else
> +                loadDouble(Address(framePointerRegister, entry.offset()), entry.reg().fpr());

Just use loadReg(Address(framePointerRegister, entry.offset()), entry.reg());
Comment 3 Tadeu Zagallo 2021-06-15 16:55:58 PDT
Created attachment 431498 [details]
Patch
Comment 4 Tadeu Zagallo 2021-06-15 17:01:32 PDT
Created attachment 431499 [details]
Patch
Comment 5 Mark Lam 2021-06-15 17:09:00 PDT
Comment on attachment 431499 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=431499&action=review

r=me with ChangeLog fixes.

> Source/JavaScriptCore/ChangeLog:9
> +        We have 3 functions in AssemblyHelpers to save and restore callee save registers that were filtering

4 functions (according to this patch), not 3.

> Source/JavaScriptCore/ChangeLog:10
> +        out any FPRs. This is an issue since we do have callee save FPRs in arm64 and these helpers can be

/these helpers can be/there are helpers/?  Otherwise, it's not clear which helpers the "these helpers" refer to.

> Source/JavaScriptCore/ChangeLog:11
> +        called from the FTL, which uses those callee saves. The test case shows how that's an issue with tail

remove the ',' to go with the above edit?
Comment 6 Tadeu Zagallo 2021-06-15 17:15:34 PDT
Comment on attachment 431499 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=431499&action=review

Thanks for the reviews, I'll reword the changelog.

>> Source/JavaScriptCore/ChangeLog:9
>> +        We have 3 functions in AssemblyHelpers to save and restore callee save registers that were filtering
> 
> 4 functions (according to this patch), not 3.

There are 3 functions in AssemblyHelpers and one in DFGOSREntry, which I mention below.

>> Source/JavaScriptCore/ChangeLog:10
>> +        out any FPRs. This is an issue since we do have callee save FPRs in arm64 and these helpers can be
> 
> /these helpers can be/there are helpers/?  Otherwise, it's not clear which helpers the "these helpers" refer to.

I think the issue is because I edited the other part of the phrase, but forgot about this one. I meant to say "these functions", referring to the "3 functions" from the previous sentence.
Comment 7 Mark Lam 2021-06-15 17:20:37 PDT
Comment on attachment 431499 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=431499&action=review

>>> Source/JavaScriptCore/ChangeLog:9
>>> +        We have 3 functions in AssemblyHelpers to save and restore callee save registers that were filtering
>> 
>> 4 functions (according to this patch), not 3.
> 
> There are 3 functions in AssemblyHelpers and one in DFGOSREntry, which I mention below.

ok.

>>> Source/JavaScriptCore/ChangeLog:10
>>> +        out any FPRs. This is an issue since we do have callee save FPRs in arm64 and these helpers can be
>> 
>> /these helpers can be/there are helpers/?  Otherwise, it's not clear which helpers the "these helpers" refer to.
> 
> I think the issue is because I edited the other part of the phrase, but forgot about this one. I meant to say "these functions", referring to the "3 functions" from the previous sentence.

ok.
Comment 8 Tadeu Zagallo 2021-06-16 08:29:12 PDT
Created attachment 431549 [details]
Patch for landing
Comment 9 EWS 2021-06-16 09:09:32 PDT
Committed r278937 (238868@main): <https://commits.webkit.org/238868@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 431549 [details].