Bug 238777 - [JSC] Reduce sizeof(BaselineCallLinkInfo) to make bug 238535 good
Summary: [JSC] Reduce sizeof(BaselineCallLinkInfo) to make bug 238535 good
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:
Blocks:
 
Reported: 2022-04-04 16:27 PDT by Yusuke Suzuki
Modified: 2022-04-04 21:19 PDT (History)
7 users (show)

See Also:


Attachments
Patch (8.19 KB, patch)
2022-04-04 16:28 PDT, Yusuke Suzuki
no flags Details | Formatted Diff | Diff
Patch (8.17 KB, patch)
2022-04-04 16:29 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-04 16:27:02 PDT
[JSC] Reduce sizeof(BaselineCallLinkInfo) to make bug 238535 good
Comment 1 Yusuke Suzuki 2022-04-04 16:28:08 PDT
Created attachment 456647 [details]
Patch
Comment 2 Yusuke Suzuki 2022-04-04 16:29:35 PDT
Created attachment 456648 [details]
Patch
Comment 3 Mark Lam 2022-04-04 17:03:50 PDT
Comment on attachment 456648 [details]
Patch

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

> Source/JavaScriptCore/bytecode/Repatch.cpp:1735
> +            CallFrameShuffleData shuffleData = CallFrameShuffleData::createForBaselineOrLLIntTailCall(bytecode, callerCodeBlock->numParameters());

According to my local dump-class-layout of CallFrameShuffleData, it is 616 bytes in size (not including the backing store for the Vector in it).  Here, we're returning by value, which may not be as big an issue due to forwarding.  However, see below ...

> Source/JavaScriptCore/bytecode/Repatch.cpp:1744
> +            frameShuffler.emplace(stubJit, *optimizingCallLinkInfo.frameShuffleData());

Here, we're copying the CallFrameShuffleData, right?  Can we change the idiom such that we use:

    CallFrameShuffler localFrameShuffler;
    std::optional<CallFrameShuffler*> frameShuffler;

... and in the baseline case, pass the &localFrameShuffler to an init function (factored out of createForBaselineOrLLIntTailCall()) instead of calling createForBaselineOrLLIntTailCall() directly?
Comment 4 Yusuke Suzuki 2022-04-04 17:18:06 PDT
Comment on attachment 456648 [details]
Patch

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

>> Source/JavaScriptCore/bytecode/Repatch.cpp:1744
>> +            frameShuffler.emplace(stubJit, *optimizingCallLinkInfo.frameShuffleData());
> 
> Here, we're copying the CallFrameShuffleData, right?  Can we change the idiom such that we use:
> 
>     CallFrameShuffler localFrameShuffler;
>     std::optional<CallFrameShuffler*> frameShuffler;
> 
> ... and in the baseline case, pass the &localFrameShuffler to an init function (factored out of createForBaselineOrLLIntTailCall()) instead of calling createForBaselineOrLLIntTailCall() directly?

Ah, no. CallFrameShuffler just constructs itself via `const CallFrameShuffleData&`, and does not copy it. So it is just referencing the value.
Comment 5 Mark Lam 2022-04-04 17:44:34 PDT
Comment on attachment 456648 [details]
Patch

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

r=me

>>> Source/JavaScriptCore/bytecode/Repatch.cpp:1744
>>> +            frameShuffler.emplace(stubJit, *optimizingCallLinkInfo.frameShuffleData());
>> 
>> Here, we're copying the CallFrameShuffleData, right?  Can we change the idiom such that we use:
>> 
>>     CallFrameShuffler localFrameShuffler;
>>     std::optional<CallFrameShuffler*> frameShuffler;
>> 
>> ... and in the baseline case, pass the &localFrameShuffler to an init function (factored out of createForBaselineOrLLIntTailCall()) instead of calling createForBaselineOrLLIntTailCall() directly?
> 
> Ah, no. CallFrameShuffler just constructs itself via `const CallFrameShuffleData&`, and does not copy it. So it is just referencing the value.

Sorry.  I conflated CallFrameShuffleData with CallFrameShuffler.  You are correct that there's no unnecessary copying here.
Comment 6 Yusuke Suzuki 2022-04-04 21:18:26 PDT
Committed r292373 (249238@trunk): <https://commits.webkit.org/249238@trunk>
Comment 7 Radar WebKit Bug Importer 2022-04-04 21:19:17 PDT
<rdar://problem/91276232>