RESOLVED FIXED 211867
[IWYU] Remove unnecessary includes from JSC implementation files
https://bugs.webkit.org/show_bug.cgi?id=211867
Summary [IWYU] Remove unnecessary includes from JSC implementation files
Ross Kirsling
Reported 2020-05-13 16:08:04 PDT
Continuation of bug 211821 -- let's go through include-what-you-use's recommended #include removals for Source/JavaScriptCore/**/*.cpp.
Attachments
WIP Patch (directories L and up) (214.27 KB, patch)
2020-05-13 16:17 PDT, Ross Kirsling
no flags
WIP Patch (directories L and up) (214.69 KB, patch)
2020-05-13 16:24 PDT, Ross Kirsling
no flags
WIP Patch (directories L and up) (213.08 KB, patch)
2020-05-13 18:34 PDT, Ross Kirsling
no flags
WIP Patch (directories L and up) (212.87 KB, patch)
2020-05-13 19:05 PDT, Ross Kirsling
no flags
WIP Patch (directories L and up) (213.08 KB, patch)
2020-05-13 20:21 PDT, Ross Kirsling
no flags
WIP Patch (directories L and up) (212.58 KB, patch)
2020-05-13 21:58 PDT, Ross Kirsling
no flags
Patch (448.54 KB, patch)
2020-05-14 18:27 PDT, Ross Kirsling
no flags
Patch (447.96 KB, patch)
2020-05-14 18:46 PDT, Ross Kirsling
no flags
Patch (447.39 KB, patch)
2020-05-14 19:03 PDT, Ross Kirsling
no flags
Patch (446.92 KB, patch)
2020-05-14 19:47 PDT, Ross Kirsling
no flags
Patch (446.92 KB, patch)
2020-05-14 19:50 PDT, Ross Kirsling
no flags
Patch (446.92 KB, patch)
2020-05-14 20:02 PDT, Ross Kirsling
no flags
Patch (447.00 KB, patch)
2020-05-14 20:35 PDT, Ross Kirsling
no flags
Ross Kirsling
Comment 1 2020-05-13 16:17:07 PDT Comment hidden (obsolete)
Ross Kirsling
Comment 2 2020-05-13 16:24:38 PDT Comment hidden (obsolete)
Ross Kirsling
Comment 3 2020-05-13 18:34:36 PDT Comment hidden (obsolete)
Mark Lam
Comment 4 2020-05-13 18:41:17 PDT
What is your methodology for doing this change? (1) Just trial and error to see if removing a #include causes a compilation error? Or (2)do you have another means of doing this?
Keith Miller
Comment 5 2020-05-13 18:44:33 PDT
(In reply to Mark Lam from comment #4) > What is your methodology for doing this change? (1) Just trial and error to > see if removing a #include causes a compilation error? Or (2)do you have > another means of doing this? [IWYU] is "include what you use" it's a clang tool. Although, it seems to have broken things here...
Ross Kirsling
Comment 6 2020-05-13 18:51:23 PDT
(In reply to Mark Lam from comment #4) > What is your methodology for doing this change? (1) Just trial and error to > see if removing a #include causes a compilation error? Or (2)do you have > another means of doing this? I described it in bug 211821 comment 2 -- IWYU spits out a list of recommended insertions/deletions and I'm going through them manually. It's tedious, but more sustainable than blind trial-and-error...although given how error-prone it is, the cost/benefit might be questionable. I think it gets pretty confused by our *Inlines.h approach; evidently there are lots of linking errors that simply won't happen with JSCOnly.
Ross Kirsling
Comment 7 2020-05-13 19:05:30 PDT Comment hidden (obsolete)
Ross Kirsling
Comment 8 2020-05-13 20:21:07 PDT Comment hidden (obsolete)
Ross Kirsling
Comment 9 2020-05-13 21:58:40 PDT
Created attachment 399332 [details] WIP Patch (directories L and up)
Ross Kirsling
Comment 10 2020-05-14 11:03:46 PDT
(Also, sorry for the noise; EWS auto-CCs even without r? but I'm planning to finish the other half of this before asking for review...)
Ross Kirsling
Comment 11 2020-05-14 18:27:04 PDT Comment hidden (obsolete)
Ross Kirsling
Comment 12 2020-05-14 18:46:19 PDT Comment hidden (obsolete)
Ross Kirsling
Comment 13 2020-05-14 19:03:30 PDT Comment hidden (obsolete)
Ross Kirsling
Comment 14 2020-05-14 19:47:01 PDT Comment hidden (obsolete)
Ross Kirsling
Comment 15 2020-05-14 19:50:03 PDT Comment hidden (obsolete)
Ross Kirsling
Comment 16 2020-05-14 20:02:16 PDT Comment hidden (obsolete)
Ross Kirsling
Comment 17 2020-05-14 20:35:14 PDT
Ross Kirsling
Comment 18 2020-05-14 20:44:34 PDT
Comment on attachment 399450 [details] Patch Phew, I think all bots should be happy now.
Ross Kirsling
Comment 19 2020-05-14 22:16:06 PDT
To be slightly more explicit about how I "went through the removals manually", for the curious: 1. Open a batch of files and prune includes from each as recommended 2. Build and see what compile/link errors occur a. First do the non-unified JSCOnly build as usual. b. Then do a normal build-jsc run, since it encounters WAY more link errors (in spite of being a unified build, which ideally shouldn't be used here at all). 3. Put some includes back a. Compile errors are usually as simple as "you said we didn't need that line but clearly we do". b. Link errors are always because of an *Inlines.h include. In most of these cases, it's possible to replace that include with a single smaller *Inlines.h (but if you need multiple then you may as well restore the original). 4. Profit? I wouldn't necessarily recommend others to spend multiple days of their life doing such a thing, but as you can see, the manual effort does produce concrete results, whereas I probably would've just given up outright before ever figuring out how to make IWYU play nicely with WK in an automated fashion (as KeithR said he did a number of years ago).
Keith Miller
Comment 20 2020-05-15 01:17:43 PDT
(In reply to Ross Kirsling from comment #19) > To be slightly more explicit about how I "went through the removals > manually", for the curious: > > 1. Open a batch of files and prune includes from each as recommended > > 2. Build and see what compile/link errors occur > a. First do the non-unified JSCOnly build as usual. > b. Then do a normal build-jsc run, since it encounters WAY more link > errors (in spite of being a unified build, which ideally shouldn't be used > here at all). > > 3. Put some includes back > a. Compile errors are usually as simple as "you said we didn't need that > line but clearly we do". > b. Link errors are always because of an *Inlines.h include. In most of > these cases, it's possible to replace that include with a single smaller > *Inlines.h (but if you need multiple then you may as well restore the > original). > > 4. Profit? > > I wouldn't necessarily recommend others to spend multiple days of their life > doing such a thing, but as you can see, the manual effort does produce > concrete results, whereas I probably would've just given up outright before > ever figuring out how to make IWYU play nicely with WK in an automated > fashion (as KeithR said he did a number of years ago). I'm kinda surprised that IWYU can't figure out how to sink the includes. I'm guessing it's because it doesn't look at every translation unit at once? Seems like it could export some graph to be processed offline though. Not saying that's a trivial project...
Joseph Pecoraro
Comment 21 2020-05-15 11:18:22 PDT
(In reply to Ross Kirsling from comment #18) > Comment on attachment 399450 [details] > Patch > > Phew, I think all bots should be happy now. Wow, nice! Did this produce any noticeable build time improvement?
Keith Miller
Comment 22 2020-05-15 11:33:35 PDT
Comment on attachment 399450 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=399450&action=review rs=me > Source/JavaScriptCore/ChangeLog:9 > + * API/: > + * assembler/: Lol, I love the blank lines.
Ross Kirsling
Comment 23 2020-05-15 12:23:51 PDT
(In reply to Joseph Pecoraro from comment #21) > (In reply to Ross Kirsling from comment #18) > > Comment on attachment 399450 [details] > > Patch > > > > Phew, I think all bots should be happy now. > > Wow, nice! Did this produce any noticeable build time improvement? I'm hoping so! Gonna do a before-and-after now and see what time/size differences I can detect.
EWS
Comment 24 2020-05-15 12:39:47 PDT
Committed r261755: <https://trac.webkit.org/changeset/261755> All reviewed patches have been landed. Closing bug and clearing flags on attachment 399450 [details].
Radar WebKit Bug Importer
Comment 25 2020-05-15 12:40:20 PDT
Ross Kirsling
Comment 26 2020-05-15 13:50:53 PDT
Well, it doesn't seem like there's any difference in the size of the build products with a normal unified `build-jsc` run (which I guess shouldn't surprise me). My Debug build did complete 45s faster, although I don't have enough data points to ensure this wasn't a fluke.
Note You need to log in before you can comment on or make changes to this bug.