Bug 163615

Summary: DFG worklist should use AutomaticThread
Product: WebKit Reporter: Filip Pizlo <fpizlo>
Component: JavaScriptCoreAssignee: Filip Pizlo <fpizlo>
Status: RESOLVED FIXED    
Severity: Normal CC: benjamin, cdumez, cmarcelo, commit-queue, dbates, keith_miller, mark.lam, msaboff, saam
Priority: P2    
Version: WebKit Nightly Build   
Hardware: All   
OS: All   
Bug Depends on: 163576    
Bug Blocks:    
Attachments:
Description Flags
maybe this will work
none
the patch
mark.lam: review+
patch for landing none

Filip Pizlo
Reported 2016-10-18 13:20:40 PDT
Patch forthcoming.
Attachments
maybe this will work (18.42 KB, patch)
2016-10-18 13:47 PDT, Filip Pizlo
no flags
the patch (22.74 KB, patch)
2016-10-18 19:45 PDT, Filip Pizlo
mark.lam: review+
patch for landing (22.97 KB, patch)
2016-10-18 22:21 PDT, Filip Pizlo
no flags
Filip Pizlo
Comment 1 2016-10-18 13:47:42 PDT
Created attachment 291980 [details] maybe this will work
Filip Pizlo
Comment 2 2016-10-18 19:45:36 PDT
Created attachment 292029 [details] the patch
Mark Lam
Comment 3 2016-10-18 22:09:50 PDT
Comment on attachment 292029 [details] the patch View in context: https://bugs.webkit.org/attachment.cgi?id=292029&action=review r=me > Source/JavaScriptCore/dfg/DFGWorklist.cpp:78 > + m_plan = nullptr; I think it might be cleaner to use an RAII object to (1) RELEASE_ASSERT(m_plan) above, and (2) nullify m_plan on return. > Source/WTF/wtf/AutomaticThread.h:150 > + // It's sometimes useful to allocate resources while the thread is running, and do destroy them typo: /do destroy/to destroy/
Filip Pizlo
Comment 4 2016-10-18 22:14:13 PDT
(In reply to comment #3) > Comment on attachment 292029 [details] > the patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=292029&action=review > > r=me > > > Source/JavaScriptCore/dfg/DFGWorklist.cpp:78 > > + m_plan = nullptr; > > I think it might be cleaner to use an RAII object to (1) > RELEASE_ASSERT(m_plan) above, and (2) nullify m_plan on return. I agree. I will do that. Also, I can use that scope to decrement m_numberOfActiveThreads. > > > Source/WTF/wtf/AutomaticThread.h:150 > > + // It's sometimes useful to allocate resources while the thread is running, and do destroy them > > typo: /do destroy/to destroy/ Fixed.
Filip Pizlo
Comment 5 2016-10-18 22:16:03 PDT
Comment on attachment 292029 [details] the patch View in context: https://bugs.webkit.org/attachment.cgi?id=292029&action=review >>> Source/JavaScriptCore/dfg/DFGWorklist.cpp:78 >>> + m_plan = nullptr; >> >> I think it might be cleaner to use an RAII object to (1) RELEASE_ASSERT(m_plan) above, and (2) nullify m_plan on return. > > I agree. I will do that. > > Also, I can use that scope to decrement m_numberOfActiveThreads. Hmmm, but that requires some tricks - since that count must be decremented when the lock is held. I'll come up with something.
Filip Pizlo
Comment 6 2016-10-18 22:17:31 PDT
(In reply to comment #5) > Comment on attachment 292029 [details] > the patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=292029&action=review > > >>> Source/JavaScriptCore/dfg/DFGWorklist.cpp:78 > >>> + m_plan = nullptr; > >> > >> I think it might be cleaner to use an RAII object to (1) RELEASE_ASSERT(m_plan) above, and (2) nullify m_plan on return. > > > > I agree. I will do that. > > > > Also, I can use that scope to decrement m_numberOfActiveThreads. > > Hmmm, but that requires some tricks - since that count must be decremented > when the lock is held. I'll come up with something. Oh it's easy! The m_numberOfActiveThreads count is just for debugging. So, although we want to hold the lock when decrementing it, we can do it in a separate critical section from everything else. This means that the scoped idiom still works.
Filip Pizlo
Comment 7 2016-10-18 22:21:54 PDT
Created attachment 292044 [details] patch for landing
Filip Pizlo
Comment 8 2016-10-18 22:23:55 PDT
I'm going to build the full stack so that I can run JetStream locally. I'm pretty sure that JetStream might thrash with the 1 second timeout. My hope is that it won't matter because the cost of starting a thread is low enough that you can safely pay it once per second.
WebKit Commit Bot
Comment 9 2016-10-18 22:26:40 PDT
Attachment 292044 [details] did not pass style-queue: ERROR: Source/JavaScriptCore/dfg/DFGWorklist.cpp:112: Multi line control clauses should use braces. [whitespace/braces] [4] Total errors found: 1 in 8 files If any of these errors are false positives, please file a bug against check-webkit-style.
Filip Pizlo
Comment 10 2016-10-19 10:48:51 PDT
(In reply to comment #8) > I'm going to build the full stack so that I can run JetStream locally. I'm > pretty sure that JetStream might thrash with the 1 second timeout. My hope > is that it won't matter because the cost of starting a thread is low enough > that you can safely pay it once per second. My experiments show that this patch might be a small JetStream progression.
Filip Pizlo
Comment 11 2016-10-19 10:50:52 PDT
Note You need to log in before you can comment on or make changes to this bug.