WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
201631
[JSC] Manually adding 256 size class to make the current JSC allocation behavior stable
https://bugs.webkit.org/show_bug.cgi?id=201631
Summary
[JSC] Manually adding 256 size class to make the current JSC allocation behav...
Yusuke Suzuki
Reported
2019-09-09 22:17:06 PDT
We have old and hacky code like this. add(sizeof(UnlinkedFunctionCodeBlock)); This manually adds sizeof(UnlinkedFunctionCodeBlock) to size class sequence. This is really fragile since size-class sequence depends on UnlinkedFunctionCodeBlock size. The size-class sequence is very fundamental thing for JSC's allocation pattern. And changing this completely changes how JSC allocates.
bug 201613
changed sizeof(UnlinkedFunctionCodeBlock) and dramatically changes the allocation behavior of JSC. We should make the previous allocation pattern stable. Instead of adding `add(sizeof(UnlinkedFunctionCodeBlock));`, adding `add(256)` directly to make the previous behavior as baseline.
Attachments
Patch
(3.82 KB, patch)
2019-09-09 22:42 PDT
,
Yusuke Suzuki
no flags
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Yusuke Suzuki
Comment 1
2019-09-09 22:42:51 PDT
Created
attachment 378443
[details]
Patch
Yusuke Suzuki
Comment 2
2019-09-09 22:42:59 PDT
The previous size-class sequence JSC Heap MarkedSpace size class dump: 16, 32, 48, 64, 80, 112, 160, 224, 256, 320, 432, 608, 880, 1232, 1776, 2672, 4016, 5360, 8032 The current size-class sequence JSC Heap MarkedSpace size class dump: 16, 32, 48, 64, 80, 112, 160, 224, 240, 320, 432, 608, 880, 1232, 1776, 2672, 4016, 5360, 8032 This patch will explicitly select the previous sequence. 224 <-> 240 is only 16, one cell size. We know 256 works well so we will pick 256 here. 256's characteristics is nice. 256*2 will becomes 608 size class, and 608*2 will becomes 1232. We know the previous size-class sequence tends to work well with the code like, var array = []; while (...) array.push(value);
Mark Lam
Comment 3
2019-09-09 23:16:42 PDT
Comment on
attachment 378443
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=378443&action=review
r=me
> Source/JavaScriptCore/ChangeLog:38 > + This patch explicitly adds 256 into the size-class to make the size-class sequence the thing we know it works well.
I suggest /know it works well/know works well/.
> Source/JavaScriptCore/heap/MarkedSpace.cpp:139 > + // Manually adding 256 case, empiricailly know this produces good sequence of size classes.
I suggest rephrasing slightly: "Manually adding 256 case. We know empirically that this produces efficient memory usage of size classes."
Mark Lam
Comment 4
2019-09-09 23:19:14 PDT
Comment on
attachment 378443
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=378443&action=review
>> Source/JavaScriptCore/heap/MarkedSpace.cpp:139 >> + // Manually adding 256 case, empiricailly know this produces good sequence of size classes. > > I suggest rephrasing slightly: "Manually adding 256 case. We know empirically that this produces efficient memory usage of size classes."
Better yet: "Manually adding 256 case. We know empirically that having this size class results in more efficient memory usage." or something like that.
Yusuke Suzuki
Comment 5
2019-09-10 02:06:43 PDT
Hmm, after checking the regression, it seems that this does not affect much. I'll look into further. macOS regression seems due to scavenger's change.
Yusuke Suzuki
Comment 6
2019-09-10 02:08:22 PDT
Comment on
attachment 378443
[details]
Patch I'll look into the problem further. After I'm confident this is better, I'll upload the revised version of this.
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