Bug 165910 - Make the collector's fixpoint smart about scheduling work
Summary: Make the collector's fixpoint smart about scheduling work
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Filip Pizlo
URL:
Keywords:
: 165963 (view as bug list)
Depends on: 165911 165963
Blocks: 165909 166828 166827 166831
  Show dependency treegraph
 
Reported: 2016-12-15 12:18 PST by Filip Pizlo
Modified: 2017-01-09 16:16 PST (History)
1 user (show)

See Also:


Attachments
possible patch (145.25 KB, patch)
2017-01-08 11:54 PST, Filip Pizlo
no flags Details | Formatted Diff | Diff
the patch (148.03 KB, patch)
2017-01-08 14:27 PST, Filip Pizlo
no flags Details | Formatted Diff | Diff
the patch (148.26 KB, patch)
2017-01-08 15:32 PST, Filip Pizlo
no flags Details | Formatted Diff | Diff
the patch (148.27 KB, patch)
2017-01-08 15:46 PST, Filip Pizlo
keith_miller: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Filip Pizlo 2016-12-15 12:18:54 PST
The GC currently scans a bunch of things in each fixpoint iteration.  It will sometimes do many fixpoint iterations.  I suspect that when it does have to perform multiple fixpoint iterations, it's because some specific part of the fixpoint is being very needy.  This implies that we can dramatically improve the fixpoint's performance using traditional fixpoint optimization tricks.
Comment 1 Filip Pizlo 2016-12-15 14:49:12 PST
I'm imagining that each of the phases of the weak fixpoint would be put into a SharedTask or some even smarter object, and then we'd be able to write some scheduler that runs them in an order that reduces the average number of executions.
Comment 2 Filip Pizlo 2017-01-08 11:34:10 PST
*** Bug 165963 has been marked as a duplicate of this bug. ***
Comment 3 Filip Pizlo 2017-01-08 11:36:33 PST
I was originally thinking that in bug 165963, I would implement the infrastructure that's needed to intelligently schedule work and then in this bug I would use that infrastructure to get an optimization. I ended up doing both of those things in bug 165963.
Comment 4 Filip Pizlo 2017-01-08 11:54:29 PST
Created attachment 298310 [details]
possible patch
Comment 5 Filip Pizlo 2017-01-08 14:27:22 PST
Created attachment 298316 [details]
the patch
Comment 6 WebKit Commit Bot 2017-01-08 14:29:15 PST
Attachment 298316 [details] did not pass style-queue:


ERROR: Source/JavaScriptCore/heap/MarkingConstraintSet.cpp:201:  An else statement can be removed when the prior "if" concludes with a return, break, continue or goto statement.  [readability/control_flow] [4]
ERROR: Source/JavaScriptCore/heap/MarkingConstraint.cpp:37:  Code inside a namespace should not be indented.  [whitespace/indent] [4]
ERROR: Source/JavaScriptCore/heap/MarkingConstraint.cpp:37:  Wrong number of spaces before statement. (expected: 8)  [whitespace/indent] [4]
ERROR: Source/JavaScriptCore/heap/MarkingConstraint.cpp:38:  Wrong number of spaces before statement. (expected: 8)  [whitespace/indent] [4]
ERROR: Source/JavaScriptCore/heap/MarkingConstraint.cpp:39:  Wrong number of spaces before statement. (expected: 8)  [whitespace/indent] [4]
ERROR: Source/JavaScriptCore/heap/MarkingConstraint.cpp:40:  Wrong number of spaces before statement. (expected: 8)  [whitespace/indent] [4]
ERROR: Source/JavaScriptCore/heap/MarkingConstraint.cpp:49:  Wrong number of spaces before statement. (expected: 8)  [whitespace/indent] [4]
ERROR: Source/JavaScriptCore/heap/MarkingConstraint.cpp:50:  Wrong number of spaces before statement. (expected: 8)  [whitespace/indent] [4]
ERROR: Source/JavaScriptCore/heap/MarkingConstraint.cpp:51:  Wrong number of spaces before statement. (expected: 8)  [whitespace/indent] [4]
ERROR: Source/JavaScriptCore/heap/MarkingConstraint.cpp:52:  Wrong number of spaces before statement. (expected: 8)  [whitespace/indent] [4]
ERROR: Source/JavaScriptCore/heap/MarkingConstraint.cpp:53:  Wrong number of spaces before statement. (expected: 8)  [whitespace/indent] [4]
Total errors found: 11 in 27 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 7 Filip Pizlo 2017-01-08 15:32:38 PST
Created attachment 298320 [details]
the patch
Comment 8 WebKit Commit Bot 2017-01-08 15:35:45 PST
Attachment 298320 [details] did not pass style-queue:


ERROR: Source/JavaScriptCore/heap/MarkingConstraintSet.cpp:201:  An else statement can be removed when the prior "if" concludes with a return, break, continue or goto statement.  [readability/control_flow] [4]
ERROR: Source/JavaScriptCore/heap/MarkingConstraint.cpp:37:  Code inside a namespace should not be indented.  [whitespace/indent] [4]
ERROR: Source/JavaScriptCore/heap/MarkingConstraint.cpp:37:  Wrong number of spaces before statement. (expected: 8)  [whitespace/indent] [4]
ERROR: Source/JavaScriptCore/heap/MarkingConstraint.cpp:38:  Wrong number of spaces before statement. (expected: 8)  [whitespace/indent] [4]
ERROR: Source/JavaScriptCore/heap/MarkingConstraint.cpp:39:  Wrong number of spaces before statement. (expected: 8)  [whitespace/indent] [4]
ERROR: Source/JavaScriptCore/heap/MarkingConstraint.cpp:40:  Wrong number of spaces before statement. (expected: 8)  [whitespace/indent] [4]
ERROR: Source/JavaScriptCore/heap/MarkingConstraint.cpp:49:  Wrong number of spaces before statement. (expected: 8)  [whitespace/indent] [4]
ERROR: Source/JavaScriptCore/heap/MarkingConstraint.cpp:50:  Wrong number of spaces before statement. (expected: 8)  [whitespace/indent] [4]
ERROR: Source/JavaScriptCore/heap/MarkingConstraint.cpp:51:  Wrong number of spaces before statement. (expected: 8)  [whitespace/indent] [4]
ERROR: Source/JavaScriptCore/heap/MarkingConstraint.cpp:52:  Wrong number of spaces before statement. (expected: 8)  [whitespace/indent] [4]
ERROR: Source/JavaScriptCore/heap/MarkingConstraint.cpp:53:  Wrong number of spaces before statement. (expected: 8)  [whitespace/indent] [4]
Total errors found: 11 in 27 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 9 Filip Pizlo 2017-01-08 15:46:06 PST
Created attachment 298321 [details]
the patch
Comment 10 WebKit Commit Bot 2017-01-08 15:48:54 PST
Attachment 298321 [details] did not pass style-queue:


ERROR: Source/JavaScriptCore/heap/MarkingConstraintSet.cpp:201:  An else statement can be removed when the prior "if" concludes with a return, break, continue or goto statement.  [readability/control_flow] [4]
ERROR: Source/JavaScriptCore/heap/MarkingConstraint.cpp:37:  Code inside a namespace should not be indented.  [whitespace/indent] [4]
ERROR: Source/JavaScriptCore/heap/MarkingConstraint.cpp:37:  Wrong number of spaces before statement. (expected: 8)  [whitespace/indent] [4]
ERROR: Source/JavaScriptCore/heap/MarkingConstraint.cpp:38:  Wrong number of spaces before statement. (expected: 8)  [whitespace/indent] [4]
ERROR: Source/JavaScriptCore/heap/MarkingConstraint.cpp:39:  Wrong number of spaces before statement. (expected: 8)  [whitespace/indent] [4]
ERROR: Source/JavaScriptCore/heap/MarkingConstraint.cpp:40:  Wrong number of spaces before statement. (expected: 8)  [whitespace/indent] [4]
ERROR: Source/JavaScriptCore/heap/MarkingConstraint.cpp:49:  Wrong number of spaces before statement. (expected: 8)  [whitespace/indent] [4]
ERROR: Source/JavaScriptCore/heap/MarkingConstraint.cpp:50:  Wrong number of spaces before statement. (expected: 8)  [whitespace/indent] [4]
ERROR: Source/JavaScriptCore/heap/MarkingConstraint.cpp:51:  Wrong number of spaces before statement. (expected: 8)  [whitespace/indent] [4]
ERROR: Source/JavaScriptCore/heap/MarkingConstraint.cpp:52:  Wrong number of spaces before statement. (expected: 8)  [whitespace/indent] [4]
ERROR: Source/JavaScriptCore/heap/MarkingConstraint.cpp:53:  Wrong number of spaces before statement. (expected: 8)  [whitespace/indent] [4]
Total errors found: 11 in 27 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 11 Keith Miller 2017-01-09 12:57:06 PST
Comment on attachment 298321 [details]
the patch

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

r=me with some minor comments.

> Source/JavaScriptCore/heap/MarkingConstraintSet.cpp:124
> +void MarkingConstraintSet::add(
> +    std::unique_ptr<MarkingConstraint> constraint)

Nit, put this on one line.

> Source/JavaScriptCore/heap/SpaceTimeMutatorScheduler.cpp:2
> + * Copyright (C) 2016 Apple Inc. All rights reserved.

2017

> Source/JavaScriptCore/heap/SpaceTimeMutatorScheduler.h:2
> + * Copyright (C) 2016 Apple Inc. All rights reserved.

2017
Comment 12 Filip Pizlo 2017-01-09 12:58:41 PST
(In reply to comment #11)
> Comment on attachment 298321 [details]
> the patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=298321&action=review
> 
> r=me with some minor comments.
> 
> > Source/JavaScriptCore/heap/MarkingConstraintSet.cpp:124
> > +void MarkingConstraintSet::add(
> > +    std::unique_ptr<MarkingConstraint> constraint)
> 
> Nit, put this on one line.

Done.

> 
> > Source/JavaScriptCore/heap/SpaceTimeMutatorScheduler.cpp:2
> > + * Copyright (C) 2016 Apple Inc. All rights reserved.
> 
> 2017

You're commenting on the pseudofile that the patch is showing you.  In fact, SpaceTimeMutatorScheduler.cpp:2 is:

 * Copyright (C) 2016-2017 Apple Inc. All rights reserved.

> 
> > Source/JavaScriptCore/heap/SpaceTimeMutatorScheduler.h:2
> > + * Copyright (C) 2016 Apple Inc. All rights reserved.
> 
> 2017

Ditto.
Comment 13 Filip Pizlo 2017-01-09 13:48:27 PST
Landed in https://trac.webkit.org/changeset/210521
Comment 14 Filip Pizlo 2017-01-09 16:16:31 PST
Fixed cloop in https://trac.webkit.org/changeset/210530