Bug 174298 - It should be easy to decide how WebKit yields
Summary: It should be easy to decide how WebKit yields
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:
Depends on:
Blocks:
 
Reported: 2017-07-09 11:17 PDT by Filip Pizlo
Modified: 2017-07-22 07:36 PDT (History)
12 users (show)

See Also:


Attachments
the.patch (13.70 KB, patch)
2017-07-09 11:19 PDT, Filip Pizlo
ysuzuki: review+
Details | Formatted Diff | Diff
the patch (35.83 KB, patch)
2017-07-14 14:44 PDT, Filip Pizlo
no flags Details | Formatted Diff | Diff
the patch (37.95 MB, patch)
2017-07-14 14:50 PDT, Filip Pizlo
sbarati: review-
Details | Formatted Diff | Diff
the patch (35.84 KB, patch)
2017-07-17 23:15 PDT, Filip Pizlo
sbarati: review+
Details | Formatted Diff | Diff
patch for landing (35.81 KB, patch)
2017-07-21 12:35 PDT, Filip Pizlo
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Filip Pizlo 2017-07-09 11:17:39 PDT
Currently, we call std::this_thread::yield(), which is super silly.  In all other regards, we go to the bare metal for threads.  We should use a syscall via a WTF abstraction, rather than using a C++ standard library abstraction.
Comment 1 Filip Pizlo 2017-07-09 11:19:57 PDT
Created attachment 314950 [details]
the.patch

I'm still improving this, but it can already be used for yielding experiments.
Comment 2 Filip Pizlo 2017-07-09 17:49:55 PDT
Comment on attachment 314950 [details]
the.patch

Actually, I like this approach.  R? it is.
Comment 3 Build Bot 2017-07-09 17:51:34 PDT
Attachment 314950 [details] did not pass style-queue:


ERROR: Source/WTF/benchmarks/ToyLocks.h:121:  Wrong number of spaces before statement. (expected: 20)  [whitespace/indent] [4]
ERROR: Source/WTF/benchmarks/ToyLocks.h:121:  Wrong number of spaces before statement. (expected: 20)  [whitespace/indent] [4]
Total errors found: 2 in 14 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 4 Yusuke Suzuki 2017-07-09 18:26:57 PDT
Comment on attachment 314950 [details]
the.patch

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

r=me with comment about windows fix.

> Source/WTF/wtf/Threading.cpp:190
> +void Thread::yield()
> +{
> +    sched_yield();
> +}

`sched_yield` is not defined in Windows.
So, let's define this in ThreadingPthreads.cpp. And in ThreadingWin.cpp, let's define it with SwitchToThread().
Comment 5 Filip Pizlo 2017-07-14 14:44:47 PDT
Created attachment 315489 [details]
the patch
Comment 6 Filip Pizlo 2017-07-14 14:50:14 PDT
Created attachment 315492 [details]
the patch
Comment 7 Saam Barati 2017-07-14 18:32:57 PDT
Comment on attachment 315492 [details]
the patch

r- for now because this patch contains a bunch of other stuff that appears to be from the WebKit2->WebKit rename and is therefore hard to review.
Comment 8 Filip Pizlo 2017-07-17 23:15:40 PDT
Created attachment 315769 [details]
the patch

This time, without the ridiculousness.
Comment 9 Build Bot 2017-07-17 23:17:11 PDT
Attachment 315769 [details] did not pass style-queue:


ERROR: Source/WTF/benchmarks/ToyLocks.h:121:  Wrong number of spaces before statement. (expected: 20)  [whitespace/indent] [4]
ERROR: Source/WTF/benchmarks/ToyLocks.h:121:  Wrong number of spaces before statement. (expected: 20)  [whitespace/indent] [4]
ERROR: Source/WTF/wtf/LockAlgorithm.h:125:  The parameter name "lock" adds no information, so it should be removed.  [readability/parameter_name] [5]
ERROR: Source/WTF/wtf/LockAlgorithm.h:131:  The parameter name "lock" adds no information, so it should be removed.  [readability/parameter_name] [5]
ERROR: Source/WTF/wtf/LockAlgorithm.h:131:  The parameter name "fairness" adds no information, so it should be removed.  [readability/parameter_name] [5]
ERROR: Source/WTF/wtf/RunLoopTimer.h:33:  Alphabetical sorting problem.  [build/include_order] [4]
Total errors found: 6 in 32 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 10 Saam Barati 2017-07-18 00:47:31 PDT
Comment on attachment 315769 [details]
the patch

r=me. Looks like you may need to do something for windows
Comment 11 Filip Pizlo 2017-07-21 12:35:29 PDT
Created attachment 316113 [details]
patch for landing
Comment 12 Build Bot 2017-07-21 12:38:26 PDT
Attachment 316113 [details] did not pass style-queue:


ERROR: Source/WTF/benchmarks/ToyLocks.h:121:  Wrong number of spaces before statement. (expected: 20)  [whitespace/indent] [4]
ERROR: Source/WTF/benchmarks/ToyLocks.h:121:  Wrong number of spaces before statement. (expected: 20)  [whitespace/indent] [4]
ERROR: Source/WTF/wtf/LockAlgorithm.h:125:  The parameter name "lock" adds no information, so it should be removed.  [readability/parameter_name] [5]
ERROR: Source/WTF/wtf/LockAlgorithm.h:131:  The parameter name "lock" adds no information, so it should be removed.  [readability/parameter_name] [5]
ERROR: Source/WTF/wtf/LockAlgorithm.h:131:  The parameter name "fairness" adds no information, so it should be removed.  [readability/parameter_name] [5]
ERROR: Source/WTF/wtf/RunLoopTimer.h:33:  Alphabetical sorting problem.  [build/include_order] [4]
Total errors found: 6 in 32 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 13 Filip Pizlo 2017-07-22 07:36:59 PDT
Landed in https://trac.webkit.org/changeset/219763/webkit