Bug 239578 - [JSC] Remove TempRegisterSet
Summary: [JSC] Remove TempRegisterSet
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Yusuke Suzuki
URL:
Keywords: InRadar
Depends on: 239613
Blocks:
  Show dependency treegraph
 
Reported: 2022-04-20 17:24 PDT by Yusuke Suzuki
Modified: 2022-04-21 17:52 PDT (History)
12 users (show)

See Also:


Attachments
Patch (31.28 KB, patch)
2022-04-21 14:55 PDT, Yusuke Suzuki
mark.lam: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Yusuke Suzuki 2022-04-20 17:24:22 PDT
[JSC] Remove TempRegisterSet
Comment 1 Yusuke Suzuki 2022-04-20 17:27:27 PDT
Pull request: https://github.com/WebKit/WebKit/pull/337
Comment 2 EWS 2022-04-20 22:29:18 PDT
Committed r293146 (249842@main): <https://commits.webkit.org/249842@main>

Reviewed commits have been landed. Closing PR #337 and removing active labels.
Comment 3 Radar WebKit Bug Importer 2022-04-20 22:30:14 PDT
<rdar://problem/92073330>
Comment 4 WebKit Commit Bot 2022-04-21 10:30:58 PDT
Re-opened since this is blocked by bug 239613
Comment 5 Yusuke Suzuki 2022-04-21 14:55:32 PDT
Created attachment 458095 [details]
Patch
Comment 6 Mark Lam 2022-04-21 15:15:03 PDT
Comment on attachment 458095 [details]
Patch

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

r=me

> Source/JavaScriptCore/ChangeLog:10
> +        We can always use RegisterSet. TempRegisterSet can save several bytes, but we have no code using TempRegisterSet in
> +        heap-allocated class, so this does not make sense anymore. Instead of TempRegisterSet, we should consistently use
> +        ScratchRegisterAllocator.

I suggest slightly rephrasing this as follows:

We can always use RegisterSet. TempRegisterSet can save several bytes, but we have no code using TempRegisterSet in
heap-allocated classes. So, this does not make sense anymore. Instead of TempRegisterSet, we will consistently use
RegisterSet to pass register info and ScratchRegisterAllocator to manage allocation of temp / scratch registers.

> Source/JavaScriptCore/ChangeLog:14
> +        We also remove copyCalleeSavesToEntryFrameCalleeSavesBuffer function with no scratch register. We were using TempRegisterSet
> +        to allocate scratch register, but the caller of this function has particular assumption on how register is allocated from
> +        TempRegisterSet. This is very fragile and dangerous. We should pass scratch register explicitly in that case.

We also remove the copyCalleeSavesToEntryFrameCalleeSavesBuffer function which takes no scratch register. It was
using TempRegisterSet to allocate a scratch register, but the caller of this function was making assumptions on how
TempRegisterSet will allocate that scratch. This is very fragile and dangerous. We should explicitly pass a scratch
register instead in that case.
Comment 7 Yusuke Suzuki 2022-04-21 16:08:25 PDT
Comment on attachment 458095 [details]
Patch

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

Thank you!

>> Source/JavaScriptCore/ChangeLog:10
>> +        ScratchRegisterAllocator.
> 
> I suggest slightly rephrasing this as follows:
> 
> We can always use RegisterSet. TempRegisterSet can save several bytes, but we have no code using TempRegisterSet in
> heap-allocated classes. So, this does not make sense anymore. Instead of TempRegisterSet, we will consistently use
> RegisterSet to pass register info and ScratchRegisterAllocator to manage allocation of temp / scratch registers.

Sounds good, changed.

>> Source/JavaScriptCore/ChangeLog:14
>> +        TempRegisterSet. This is very fragile and dangerous. We should pass scratch register explicitly in that case.
> 
> We also remove the copyCalleeSavesToEntryFrameCalleeSavesBuffer function which takes no scratch register. It was
> using TempRegisterSet to allocate a scratch register, but the caller of this function was making assumptions on how
> TempRegisterSet will allocate that scratch. This is very fragile and dangerous. We should explicitly pass a scratch
> register instead in that case.

Changed.
Comment 8 Yusuke Suzuki 2022-04-21 17:52:05 PDT
Committed r293203 (?): <https://commits.webkit.org/r293203>