WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
54832
Remove pthreads dependency in JSLock when it's not needed
https://bugs.webkit.org/show_bug.cgi?id=54832
Summary
Remove pthreads dependency in JSLock when it's not needed
Patrick R. Gansterer
Reported
2011-02-20 13:09:36 PST
Use WTF::Mutex in JSLock
Attachments
Patch
(2.27 KB, patch)
2011-02-20 13:10 PST
,
Patrick R. Gansterer
ap
: review-
ap
: commit-queue-
Details
Formatted Diff
Diff
Patch
(3.94 KB, patch)
2011-02-23 03:47 PST
,
Patrick R. Gansterer
no flags
Details
Formatted Diff
Diff
Patch
(2.14 KB, patch)
2011-02-23 11:35 PST
,
Patrick R. Gansterer
no flags
Details
Formatted Diff
Diff
Patch
(2.20 KB, patch)
2011-02-23 13:05 PST
,
Patrick R. Gansterer
no flags
Details
Formatted Diff
Diff
Show Obsolete
(3)
View All
Add attachment
proposed patch, testcase, etc.
Patrick R. Gansterer
Comment 1
2011-02-20 13:10:50 PST
Created
attachment 83101
[details]
Patch
Alexey Proskuryakov
Comment 2
2011-02-20 17:27:02 PST
Comment on
attachment 83101
[details]
Patch There is a race condition initializing the static mutex now. Typically, we would create the static mutex from JSC::initializeThreading(). But I don't think that you need JSLock to work at all. The only times it's used with LockForReal argument is for deprecated Mac OS X SPI behavior where concurrent access to a JS context was serialized with a mutex automagically.
Patrick R. Gansterer
Comment 3
2011-02-22 12:50:31 PST
(In reply to
comment #2
)
> (From update of
attachment 83101
[details]
) > There is a race condition initializing the static mutex now. Typically, we would create the static mutex from JSC::initializeThreading(). > > But I don't think that you need JSLock to work at all. The only times it's used with LockForReal argument is for deprecated Mac OS X SPI behavior where concurrent access to a JS context was serialized with a mutex automagically.
Is it safe to remove the Mutex as a whole? Or should i upload a new patch with a initializeThreading() call?
Alexey Proskuryakov
Comment 4
2011-02-22 13:08:11 PST
I suggest making JSMutex no-op on non-Mac platforms (like it's no-op on Mac when SilenceAssertionsOnly is passed).
Patrick R. Gansterer
Comment 5
2011-02-23 03:47:35 PST
Created
attachment 83466
[details]
Patch I digged a little bit deeper into this, but AKAICS I don't want to remove it as a whole. So this patch removes the race condition from the previous patch.
Alexey Proskuryakov
Comment 6
2011-02-23 08:50:10 PST
So, why don't you want to make JSLock no-op on non-Mac platforms? What is "AKAICS"?
Patrick R. Gansterer
Comment 7
2011-02-23 11:35:57 PST
Created
attachment 83514
[details]
Patch
Darin Adler
Comment 8
2011-02-23 11:40:39 PST
Comment on
attachment 83514
[details]
Patch I don’t think USE(PTHREADS) is the correct thing here. The obsolete execution model only matters on certain platforms. It’s arguably a "coincidence" that USE(PTHREADS) happens to be true on those platforms.
Patrick R. Gansterer
Comment 9
2011-02-23 11:43:13 PST
(In reply to
comment #8
)
> (From update of
attachment 83514
[details]
) > I don’t think USE(PTHREADS) is the correct thing here. The obsolete execution model only matters on certain platforms. It’s arguably a "coincidence" that USE(PTHREADS) happens to be true on those platforms.
ap (and me too) preferred USE(PTHREADS) over OS(DARWIN), so you get the ASSERTION on other platforms when using pthread too.
Alexey Proskuryakov
Comment 10
2011-02-23 12:51:39 PST
it's true that due to this change, we'll subtly break Mac if we switch from pthreads to something else. May be best to add an #error for this case. #if PLATFORM(MAC) && !USE(PTHREADS) #error...
Patrick R. Gansterer
Comment 11
2011-02-23 13:05:00 PST
Created
attachment 83530
[details]
Patch
Alexey Proskuryakov
Comment 12
2011-02-23 13:13:53 PST
Comment on
attachment 83530
[details]
Patch OK. I still think that an #error would have been better, because someone may remove the seemingly redundant OS(DARWIN) || USE(PTHREADS) check without deep thinking in the future.
Patrick R. Gansterer
Comment 13
2011-02-23 13:37:05 PST
Comment on
attachment 83530
[details]
Patch (In reply to
comment #12
)
> (From update of
attachment 83530
[details]
) > OK. I still think that an #error would have been better, because someone may remove the seemingly redundant OS(DARWIN) || USE(PTHREADS) check without deep thinking in the future.
I also made a version with #error, but the resulting code looked a kind of ugly to me. The three lines of comments explaining why we have OS(DARWIN) in the #if will be part of a possible removal patch, so it shouldn't be too easy to do this by accident.
WebKit Commit Bot
Comment 14
2011-02-24 07:49:49 PST
Comment on
attachment 83530
[details]
Patch Clearing flags on attachment: 83530 Committed
r79564
: <
http://trac.webkit.org/changeset/79564
>
WebKit Commit Bot
Comment 15
2011-02-24 07:49:56 PST
All reviewed patches have been landed. Closing bug.
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