Summary: | [JSC] Use LazyNeverDestroyed & std::call_once for complex singletons | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Yusuke Suzuki <ysuzuki> | ||||||||
Component: | New Bugs | Assignee: | Yusuke Suzuki <ysuzuki> | ||||||||
Status: | RESOLVED FIXED | ||||||||||
Severity: | Normal | CC: | benjamin, cdumez, cmarcelo, ews-watchlist, hi, joepeck, keith_miller, kkinnunen, mark.lam, msaboff, saam, tzagallo, webkit-bug-importer | ||||||||
Priority: | P2 | Keywords: | InRadar | ||||||||
Version: | WebKit Nightly Build | ||||||||||
Hardware: | Unspecified | ||||||||||
OS: | Unspecified | ||||||||||
Attachments: |
|
Description
Yusuke Suzuki
2020-08-04 18:05:36 PDT
Created attachment 405972 [details]
Patch
Created attachment 405973 [details]
Patch
Created attachment 405975 [details]
Patch
Comment on attachment 405975 [details]
Patch
r=me
stress/put-by-val-direct-putprivate.js.dfg-eager is failing recently. Committed r265276: <https://trac.webkit.org/changeset/265276> All reviewed patches have been landed. Closing bug and clearing flags on attachment 405975 [details]. Should we have a class that contains the std::once and whatnot? Maybe call it ConcurrentLazyNeverDestroyed or something? What's the logic in the commit? > WebKit's static does not have thread-safety. Isn't the deduction against c++11 spec? Function local static initialization is specified to be thread-safe? Here is example: https://godbolt.org/z/jcMz9M11d Here is discussion: https://stackoverflow.com/questions/26013650/threadsafe-lazy-initialization-static-vs-stdcall-once-vs-double-checked-locki/27206650 What makes WebKit statics broken? Asking because I see plenty of static uses in WebKit that rely on this... (In reply to Kimmo Kinnunen from comment #9) > What's the logic in the commit? > > > WebKit's static does not have thread-safety. > > Isn't the deduction against c++11 spec? We are explicitly disabling that in WebKit for performance reason via -fno-threadsafe-statics. Check GCC_THREADSAFE_STATICS in WebKit tree. > > Function local static initialization is specified to be thread-safe? > > Here is example: > https://godbolt.org/z/jcMz9M11d > > Here is discussion: > https://stackoverflow.com/questions/26013650/threadsafe-lazy-initialization- > static-vs-stdcall-once-vs-double-checked-locki/27206650 > > What makes WebKit statics broken? > Asking because I see plenty of static uses in WebKit that rely on this... |