Bug 186924

Summary: [Cocoa] reduce unnecessary use of .mm source files in WTF, spruce up some implementation details
Product: WebKit Reporter: Darin Adler <darin>
Component: Web Template FrameworkAssignee: Darin Adler <darin>
Status: RESOLVED FIXED    
Severity: Normal CC: andersca, benjamin, cdumez, cmarcelo, dbates, ddkilzer, ews-watchlist, mitz, realdawei, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=187009
https://bugs.webkit.org/show_bug.cgi?id=189082
Attachments:
Description Flags
Patch
andersca: review+
Part 2
ews-watchlist: commit-queue-
Archive of layout-test-results from ews125 for ios-simulator-wk2
none
Archive of layout-test-results from ews206 for win-future none

Darin Adler
Reported 2018-06-22 08:44:42 PDT
[Cocoa] reduce unnecessary use of .mm source files in WTF, spruce up some implementation details
Attachments
Patch (45.38 KB, patch)
2018-06-22 09:07 PDT, Darin Adler
andersca: review+
Part 2 (7.03 KB, patch)
2018-07-09 19:18 PDT, David Kilzer (:ddkilzer)
ews-watchlist: commit-queue-
Archive of layout-test-results from ews125 for ios-simulator-wk2 (900.05 KB, application/zip)
2018-07-09 20:56 PDT, EWS Watchlist
no flags
Archive of layout-test-results from ews206 for win-future (12.79 MB, application/zip)
2018-07-10 00:26 PDT, EWS Watchlist
no flags
Darin Adler
Comment 1 2018-06-22 09:07:29 PDT
Darin Adler
Comment 2 2018-06-22 09:08:09 PDT
This is better for the ARC transition since .cpp files aren’t affected by ARC.
Anders Carlsson
Comment 3 2018-06-22 09:11:12 PDT
Comment on attachment 343329 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=343329&action=review > Source/WTF/wtf/cocoa/CPUTimeCocoa.cpp:83 > + return Seconds(info.user_time.seconds + info.system_time.seconds) + Seconds::fromMicroseconds(info.user_time.microseconds + info.system_time.microseconds); Could make this use uniform initialization.
Darin Adler
Comment 4 2018-06-22 21:00:54 PDT
(In reply to Anders Carlsson from comment #3) > Comment on attachment 343329 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=343329&action=review > > > Source/WTF/wtf/cocoa/CPUTimeCocoa.cpp:83 > > + return Seconds(info.user_time.seconds + info.system_time.seconds) + Seconds::fromMicroseconds(info.user_time.microseconds + info.system_time.microseconds); > > Could make this use uniform initialization. The two arguments are int64_t but the argument is a double, so I can’t easily do that without adding type casts or local variables.
Darin Adler
Comment 5 2018-06-22 21:18:34 PDT
Radar WebKit Bug Importer
Comment 6 2018-06-22 21:19:21 PDT
Dawei Fenton (:realdawei)
Comment 7 2018-06-25 17:40:48 PDT
Reverted r233120 for reason: caused regression in ios API tests Committed r233186: <https://trac.webkit.org/changeset/233186>
Darin Adler
Comment 8 2018-06-25 18:15:07 PDT
What regression did this cause in iOS API tests?
David Kilzer (:ddkilzer)
Comment 9 2018-06-26 06:49:11 PDT
(In reply to Darin Adler from comment #8) > What regression did this cause in iOS API tests? It caused 50+ layout tests to fail on iOS Simulator. Here's a run with crash logs in the layout test results: <https://build.webkit.org/results/Apple%20iOS%2011%20Simulator%20Release%20WK2%20(Tests)/r233120%20(5744)/results.html> This shows where the 50+ layout tests stopped crashing after this was reverted in r233186: <https://build.webkit.org/builders/Apple%20iOS%2011%20Simulator%20Release%20WK2%20(Tests)?numbuilds=50> The thing I can't figure out is why this patch would cause these crashes. The crash is happening in QuickLookSoftLink.mm when trying to load the symbol for the QLTypeCopyBestMimeTypeForFileNameAndMimeType() function. The SOFT_LINK_FUNCTION_FOR_SOURCE() macro used in QuickLookSoftLink.mm is defined in Source/WTF/wtf/cocoa/SoftLinking.h. The only thing remotely related to that might be the inline constructor change to WTFString.h, but I'm not sure how that constructor would be used in the dispatch_once() block in the SOFT_LINK_FUNCTION_FOR_SOURCE() macro.
David Kilzer (:ddkilzer)
Comment 10 2018-06-26 06:53:47 PDT
(In reply to David Kilzer (:ddkilzer) from comment #9) > (In reply to Darin Adler from comment #8) > > What regression did this cause in iOS API tests? > > It caused 50+ layout tests to fail on iOS Simulator. Here's a run with > crash logs in the layout test results: > <https://build.webkit.org/results/ > Apple%20iOS%2011%20Simulator%20Release%20WK2%20(Tests)/r233120%20(5744)/ > results.html> > > This shows where the 50+ layout tests stopped crashing after this was > reverted in r233186: > <https://build.webkit.org/builders/ > Apple%20iOS%2011%20Simulator%20Release%20WK2%20(Tests)?numbuilds=50> > > The thing I can't figure out is why this patch would cause these crashes. > The crash is happening in QuickLookSoftLink.mm when trying to load the > symbol for the QLTypeCopyBestMimeTypeForFileNameAndMimeType() function. The > SOFT_LINK_FUNCTION_FOR_SOURCE() macro used in QuickLookSoftLink.mm is > defined in Source/WTF/wtf/cocoa/SoftLinking.h. > > The only thing remotely related to that might be the inline constructor > change to WTFString.h, but I'm not sure how that constructor would be used > in the dispatch_once() block in the SOFT_LINK_FUNCTION_FOR_SOURCE() macro. Does this constructor need to be marked explicit? String(NSString *);
Darin Adler
Comment 11 2018-06-26 09:11:07 PDT
(In reply to David Kilzer (:ddkilzer) from comment #10) > Does this constructor need to be marked explicit? > > String(NSString *); No.
Dawei Fenton (:realdawei)
Comment 12 2018-06-26 09:23:02 PDT
(In reply to David Kilzer (:ddkilzer) from comment #9) > (In reply to Darin Adler from comment #8) > > What regression did this cause in iOS API tests? > > It caused 50+ layout tests to fail on iOS Simulator. Here's a run with > crash logs in the layout test results: > <https://build.webkit.org/results/ > Apple%20iOS%2011%20Simulator%20Release%20WK2%20(Tests)/r233120%20(5744)/ > results.html> > > This shows where the 50+ layout tests stopped crashing after this was > reverted in r233186: > <https://build.webkit.org/builders/ > Apple%20iOS%2011%20Simulator%20Release%20WK2%20(Tests)?numbuilds=50> > > The thing I can't figure out is why this patch would cause these crashes. > The crash is happening in QuickLookSoftLink.mm when trying to load the > symbol for the QLTypeCopyBestMimeTypeForFileNameAndMimeType() function. The > SOFT_LINK_FUNCTION_FOR_SOURCE() macro used in QuickLookSoftLink.mm is > defined in Source/WTF/wtf/cocoa/SoftLinking.h. > > The only thing remotely related to that might be the inline constructor > change to WTFString.h, but I'm not sure how that constructor would be used > in the dispatch_once() block in the SOFT_LINK_FUNCTION_FOR_SOURCE() macro. My apologies for omitting this earlier, here's also a run with logs from the API test results: https://build.webkit.org/builders/Apple%20iOS%2011%20Simulator%20Release%20WK2%20%28Tests%29/builds/5744/steps/run-api-tests/logs/stdio
Darin Adler
Comment 13 2018-06-26 09:35:01 PDT
(In reply to David Kilzer (:ddkilzer) from comment #9) > The crash is happening in QuickLookSoftLink.mm when trying to load the > symbol for the QLTypeCopyBestMimeTypeForFileNameAndMimeType() function. The > SOFT_LINK_FUNCTION_FOR_SOURCE() macro used in QuickLookSoftLink.mm is > defined in Source/WTF/wtf/cocoa/SoftLinking.h. I also see that in other cases the crash is when trying to load the symbol for QLPreviewGetSupportedMIMETypes, which returns an NSSet so I don’t think it has anything to do with the NSString symbols. And at least in the cases I looked at, the crash is doubly nested inside dispatch_once, which means the crash is actually in SOFT_LINK_FRAMEWORK_FOR_SOURCE in that dispatch_once block. I agree that I don’t see how the patch could have any effect on this. I don’t see it touching any file included by QuickLookSoftLink.mm. I guess I can hold off indefinitely until someone figures it out.
Darin Adler
Comment 14 2018-06-26 09:37:30 PDT
Just a wild guess, but I think this is a build and dependencies problem. I suspect that if we forced a full rebuild the errors would go away.
Darin Adler
Comment 15 2018-06-28 09:11:27 PDT
I have three ideas of how to proceed: 1) Get someone who can reproduce the simulator test crash to apply the patch, reproduce the crash, and then try a full rebuild to see if that makes the crash go away. 2) Try landing a version of this patch with everything else except for the changes to WTFString.h and StringMac.mm since it seems impossible that the other changes have any impact on the crash. 3) Set up myself so that I can to reproduce the simulator crash locally myself (may make this take a long time). Anyone want to help me decide? Your thoughts?
David Kilzer (:ddkilzer)
Comment 16 2018-06-29 11:31:20 PDT
(In reply to Darin Adler from comment #15) > I have three ideas of how to proceed: > > 1) Get someone who can reproduce the simulator test crash to apply the > patch, reproduce the crash, and then try a full rebuild to see if that makes > the crash go away. 1a) Reland the patch and have a bot watcher force a clean build on all the bots. It’s too bad we don’t have a “force clean build” flag when marking a bug for commit queue. (If course it would be better to try to fix the dependency, but that may not be the best use of time?) > 2) Try landing a version of this patch with everything else except for the > changes to WTFString.h and StringMac.mm since it seems impossible that the > other changes have any impact on the crash. I would start with (2), then coordinae with someone to do (1a) for the second part.
Darin Adler
Comment 17 2018-06-29 17:24:00 PDT
Darin Adler
Comment 18 2018-06-29 17:30:27 PDT
OK, started with (2). Landed a version of the patch without the WTFString.h change.
David Kilzer (:ddkilzer)
Comment 19 2018-07-09 19:18:27 PDT
Reopening to attach new patch.
David Kilzer (:ddkilzer)
Comment 20 2018-07-09 19:18:28 PDT
David Kilzer (:ddkilzer)
Comment 21 2018-07-09 19:20:20 PDT
(In reply to David Kilzer (:ddkilzer) from comment #20) > Created attachment 344655 [details] > Part 2 I did a clean iOS Simulator Release build with this patch, and ran the tests that failed before (on iOS 12, not iOS 11.x): $ ./Tools/Scripts/run-webkit-tests --ios-simulator --release css3 dom Using port 'ios-simulator' Test configuration: <, x86_64, release> Placing test results in /var/build/Release-iphonesimulator/layout-test-results Baseline search path: platform/ios-simulator-12-wk2 -> platform/ios-simulator-12 -> platform/ios-simulator-wk2 -> platform/ios-simulator -> platform/ios-12 -> platform/ios-wk2 -> platform/ios -> platform/wk2 -> generic Using Release build Pixel tests disabled Regular timeout: 30000, slow test timeout: 150000 Command line: /var/build/Release-iphonesimulator/WebKitTestRunnerApp.app - Found 4435 tests; running 4345, skipping 90. Running 4345 tests Running 2 WebKitTestRunnerApp.apps in parallel. [44/4345] css3/font-variant-small-caps-synthesis-coverage.html passed unexpectedly css3/color/gradients.html -> ref test hashes didn't match but diff passed css3/color-filters/color-filter-backgrounds-borders.html -> ref test hashes didn't match but diff passed css3/color-filters/svg/color-filter-inline-svg.html -> ref test hashes didn't match but diff passed css3/color-filters/color-filter-box-shadow.html -> ref test hashes didn't match but diff passed css3/color-filters/color-filter-color-property-list-item.html -> ref test hashes didn't match but diff passed css3/color-filters/color-filter-color-property.html -> ref test hashes didn't match but diff passed css3/color-filters/color-filter-color-text-decorations.html -> ref test hashes didn't match but diff passed css3/color-filters/color-filter-column-rule.html -> ref test hashes didn't match but diff passed css3/color-filters/color-filter-composition-underline-color.html -> ref test hashes didn't match but diff passed css3/color-filters/color-filter-contrast.html -> ref test hashes didn't match but diff passed css3/color-filters/color-filter-current-color.html -> ref test hashes didn't match but diff passed css3/color-filters/color-filter-inherits.html -> ref test hashes didn't match but diff passed css3/color-filters/color-filter-opacity.html -> ref test hashes didn't match but diff passed css3/color-filters/color-filter-outline.html -> ref test hashes didn't match but diff passed css3/color-filters/color-filter-text-decoration-shadow.html -> ref test hashes didn't match but diff passed css3/color-filters/color-filter-text-emphasis.html -> ref test hashes didn't match but diff passed css3/color-filters/color-filter-text-shadow.html -> ref test hashes didn't match but diff passed css3/color-filters/color-filter-text-stroke.html -> ref test hashes didn't match but diff passed css3/filters/backdrop/backdrop-filter-with-clip-path.html is a reftest, but has an unused expectation file. Please remove /Users/ddkilzer/Data/WebKit.git/LayoutTests/css3/filters/backdrop/backdrop-filter-with-clip-path-expected.txt. [452/4345] css3/filters/backdrop/dynamic-with-clip-path.html passed unexpectedly [554/4345] css3/flexbox/image-percent-max-height.html passed unexpectedly [985/4345] css3/flexbox/csswg/ttwf-reftest-flex-wrap-reverse.html passed unexpectedly [990/4345] css3/flexbox/csswg/ttwf-reftest-flex-wrap.html passed unexpectedly 4340 tests ran as expected, 5 didn't: Expected to fail, but passed: (5) css3/filters/backdrop/dynamic-with-clip-path.html css3/flexbox/csswg/ttwf-reftest-flex-wrap-reverse.html css3/flexbox/csswg/ttwf-reftest-flex-wrap.html css3/flexbox/image-percent-max-height.html css3/font-variant-small-caps-synthesis-coverage.html
EWS Watchlist
Comment 22 2018-07-09 20:56:40 PDT
Comment on attachment 344655 [details] Part 2 Attachment 344655 [details] did not pass ios-sim-ews (ios-simulator-wk2): Output: https://webkit-queues.webkit.org/results/8489519 Number of test failures exceeded the failure limit.
EWS Watchlist
Comment 23 2018-07-09 20:56:42 PDT
Created attachment 344660 [details] Archive of layout-test-results from ews125 for ios-simulator-wk2 The attached test failures were seen while running run-webkit-tests on the ios-sim-ews. Bot: ews125 Port: ios-simulator-wk2 Platform: Mac OS X 10.13.4
EWS Watchlist
Comment 24 2018-07-10 00:26:00 PDT
Comment on attachment 344655 [details] Part 2 Attachment 344655 [details] did not pass win-ews (win): Output: https://webkit-queues.webkit.org/results/8491135 New failing tests: http/tests/security/canvas-remote-read-remote-video-localhost.html
EWS Watchlist
Comment 25 2018-07-10 00:26:13 PDT
Created attachment 344675 [details] Archive of layout-test-results from ews206 for win-future The attached test failures were seen while running run-webkit-tests on the win-ews. Bot: ews206 Port: win-future Platform: CYGWIN_NT-6.1-2.9.0-0.318-5-3-x86_64-64bit
David Kilzer (:ddkilzer)
Comment 26 2018-07-10 07:49:22 PDT
Moving back to RESOLVED/FIXED state. I'm not set up to test iOS 11.x Simulator at this time.
Note You need to log in before you can comment on or make changes to this bug.