WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
238444
[JSC] Use spoolers in FTL OSR exit thunk
https://bugs.webkit.org/show_bug.cgi?id=238444
Summary
[JSC] Use spoolers in FTL OSR exit thunk
Yusuke Suzuki
Reported
2022-03-28 04:02:34 PDT
[JSC] Use spoolers in FTL OSR exit thunk
Attachments
Patch
(18.22 KB, patch)
2022-03-28 04:12 PDT
,
Yusuke Suzuki
no flags
Details
Formatted Diff
Diff
Patch
(18.88 KB, patch)
2022-03-28 04:15 PDT
,
Yusuke Suzuki
mark.lam
: review+
ews-feeder
: commit-queue-
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Yusuke Suzuki
Comment 1
2022-03-28 04:12:10 PDT
Created
attachment 455897
[details]
Patch
Yusuke Suzuki
Comment 2
2022-03-28 04:15:57 PDT
Created
attachment 455899
[details]
Patch
Mark Lam
Comment 3
2022-03-28 12:57:14 PDT
Comment on
attachment 455899
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=455899&action=review
Nice. r=me.
> Source/JavaScriptCore/ftl/FTLOSRExitCompiler.cpp:389 > + if (!undefinedGPR) {
Use UNLIKELY?
> Source/JavaScriptCore/ftl/FTLOSRExitCompiler.cpp:400 > + if (!undefinedGPR) {
Use UNLIKELY?
> Source/JavaScriptCore/ftl/FTLOSRExitCompiler.cpp:503 > + // The FTL compilation didn't preserve this register. This means that it also > + // didn't use the register. So its value at the beginning of OSR exit should be > + // preserved by the thunk. Luckily, we saved all registers into the register > + // scratch buffer, so we can restore them from there.
Since this now describe all the registers restorations below (as opposed to a single register as before), we should pluralized references to "register" in this comment. I suggest (with some additional detail for added context): unwindIndex == UINT_MAX indicates that the FTL compilation didn't preserve these registers. This means that it also didn't use them. Their values at the beginning of OSR exit should be the ones to retain. We saved all registers into the register scratch buffer at the beginning of the thunk. So we can restore them from there.
> Source/JavaScriptCore/ftl/FTLOSRExitCompiler.cpp:521 > + CCallHelpers::CopySpooler spooler(jit, GPRInfo::regT3, CCallHelpers::framePointerRegister, GPRInfo::regT0, GPRInfo::regT1, FPRInfo::fpRegT0, FPRInfo::fpRegT1);
nit: I suggest adding ASSERTs above the `jit.move(CCallHelpers::TrustedImmPtr(registerScratch), GPRInfo::regT3);` line above to ASSERT that regT0, refT1, and regT3 are not callee save since these loops include restoration of callee saves. Hence, we can't use callee saves as temps.
> Source/JavaScriptCore/ftl/FTLOSRExitCompiler.cpp:542 > + // The FTL compilation preserved the register. Its new value is therefore > + // irrelevant, but we can get the value that was preserved by using the unwind > + // data. We've already copied all unwind-able preserved registers into the unwind > + // scratch buffer, so we can get it from there.
Again, pluralize. I suggest: The FTL compilation preserved these registers. Their new values are therefore irrelevant, but we can get their values that were preserved by using the unwind data. We've already copied all unwind-able preserved registers into the unwind scratch buffer, so we can get the values to restore from there.
Yusuke Suzuki
Comment 4
2022-03-29 14:06:47 PDT
Comment on
attachment 455899
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=455899&action=review
Thank you!
>> Source/JavaScriptCore/ftl/FTLOSRExitCompiler.cpp:389 >> + if (!undefinedGPR) { > > Use UNLIKELY?
Nice. Added.
>> Source/JavaScriptCore/ftl/FTLOSRExitCompiler.cpp:400 >> + if (!undefinedGPR) { > > Use UNLIKELY?
Done.
>> Source/JavaScriptCore/ftl/FTLOSRExitCompiler.cpp:503 >> + // scratch buffer, so we can restore them from there. > > Since this now describe all the registers restorations below (as opposed to a single register as before), we should pluralized references to "register" in this comment. I suggest (with some additional detail for added context): > > unwindIndex == UINT_MAX indicates that the FTL compilation didn't preserve these registers. > This means that it also didn't use them. Their values at the beginning of OSR exit should be > the ones to retain. We saved all registers into the register scratch buffer at the beginning of > the thunk. So we can restore them from there.
Sounds good! Changed.
>> Source/JavaScriptCore/ftl/FTLOSRExitCompiler.cpp:521 >> + CCallHelpers::CopySpooler spooler(jit, GPRInfo::regT3, CCallHelpers::framePointerRegister, GPRInfo::regT0, GPRInfo::regT1, FPRInfo::fpRegT0, FPRInfo::fpRegT1); > > nit: I suggest adding ASSERTs above the `jit.move(CCallHelpers::TrustedImmPtr(registerScratch), GPRInfo::regT3);` line above to ASSERT that regT0, refT1, and regT3 are not callee save since these loops include restoration of callee saves. Hence, we can't use callee saves as temps.
Sounds good!
>> Source/JavaScriptCore/ftl/FTLOSRExitCompiler.cpp:542 >> + // scratch buffer, so we can get it from there. > > Again, pluralize. I suggest: > > The FTL compilation preserved these registers. Their new values are therefore > irrelevant, but we can get their values that were preserved by using the unwind > data. We've already copied all unwind-able preserved registers into the unwind > scratch buffer, so we can get the values to restore from there.
Nice, changed.
Yusuke Suzuki
Comment 5
2022-03-29 15:54:22 PDT
Committed
r292078
(
249005@trunk
): <
https://commits.webkit.org/249005@trunk
>
Radar WebKit Bug Importer
Comment 6
2022-03-29 15:55:19 PDT
<
rdar://problem/91009994
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug