Bug 238777

Summary: [JSC] Reduce sizeof(BaselineCallLinkInfo) to make bug 238535 good
Product: WebKit Reporter: Yusuke Suzuki <ysuzuki>
Component: New BugsAssignee: Yusuke Suzuki <ysuzuki>
Status: RESOLVED FIXED    
Severity: Normal CC: ews-watchlist, keith_miller, mark.lam, msaboff, saam, tzagallo, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch mark.lam: review+

Yusuke Suzuki
Reported 2022-04-04 16:27:02 PDT
[JSC] Reduce sizeof(BaselineCallLinkInfo) to make bug 238535 good
Attachments
Patch (8.19 KB, patch)
2022-04-04 16:28 PDT, Yusuke Suzuki
no flags
Patch (8.17 KB, patch)
2022-04-04 16:29 PDT, Yusuke Suzuki
mark.lam: review+
Yusuke Suzuki
Comment 1 2022-04-04 16:28:08 PDT
Yusuke Suzuki
Comment 2 2022-04-04 16:29:35 PDT
Mark Lam
Comment 3 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?
Yusuke Suzuki
Comment 4 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.
Mark Lam
Comment 5 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.
Yusuke Suzuki
Comment 6 2022-04-04 21:18:26 PDT
Radar WebKit Bug Importer
Comment 7 2022-04-04 21:19:17 PDT
Note You need to log in before you can comment on or make changes to this bug.