RESOLVED FIXED 205905
Reduce binary size by purging C++ type information in Objective-C fields and parameters
https://bugs.webkit.org/show_bug.cgi?id=205905
Summary Reduce binary size by purging C++ type information in Objective-C fields and ...
Yusuke Suzuki
Reported 2020-01-07 21:16:40 PST
Reduce binary size by purging C++ type information in Objective-C fields and parameters
Attachments
Patch (110.84 KB, patch)
2020-01-07 21:23 PST, Yusuke Suzuki
no flags
Patch (114.11 KB, patch)
2020-01-07 21:31 PST, Yusuke Suzuki
no flags
Patch (117.53 KB, patch)
2020-01-07 21:38 PST, Yusuke Suzuki
saam: review+
Patch (122.33 KB, patch)
2020-01-07 21:50 PST, Yusuke Suzuki
no flags
Patch (124.91 KB, patch)
2020-01-07 23:27 PST, Yusuke Suzuki
no flags
Patch (124.91 KB, patch)
2020-01-08 15:14 PST, Yusuke Suzuki
no flags
Yusuke Suzuki
Comment 1 2020-01-07 21:23:53 PST
Yusuke Suzuki
Comment 2 2020-01-07 21:31:27 PST
Radar WebKit Bug Importer
Comment 3 2020-01-07 21:31:59 PST
Yusuke Suzuki
Comment 4 2020-01-07 21:38:57 PST
Yusuke Suzuki
Comment 5 2020-01-07 21:43:01 PST
Comment on attachment 387071 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=387071&action=review > Source/WTF/ChangeLog:19 > + This patch introduces NativeRef<T>. This is similar to Ref while it does not have any ownership. So it Native => Naked.
Saam Barati
Comment 6 2020-01-07 21:44:34 PST
Comment on attachment 387071 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=387071&action=review Nice!! r=me > Source/WTF/ChangeLog:8 > + Objective-C has reflection mechanism. This means that fields, methods, and their types "has reflection" => "has a reflection" > Source/WTF/ChangeLog:24 > + 2. T* / T& is in Objective-C fields or paramter types (including a return type). paramter => parameter
Saam Barati
Comment 7 2020-01-07 21:47:07 PST
Comment on attachment 387071 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=387071&action=review >> Source/WTF/ChangeLog:8 >> + Objective-C has reflection mechanism. This means that fields, methods, and their types > > "has reflection" => "has a reflection" actually, probably this should just be: "mechanism" => "mechanisms" since ObjC has more than one kind of reflection
Yusuke Suzuki
Comment 8 2020-01-07 21:50:33 PST
Created attachment 387073 [details] Patch iOS build fix
Mark Lam
Comment 9 2020-01-07 22:06:25 PST
Comment on attachment 387073 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=387073&action=review > Source/WTF/ChangeLog:36 > + becomes available in our platforms, we can consider it. But using NakedRef / NakedPtr is not harmless. Do you mean "is harmless" instead of "is not harmless", as in there is effectively no cost to using NakedRef / NakedPtr?
Yusuke Suzuki
Comment 10 2020-01-07 22:32:34 PST
I'm now looking WebKitLegacy crash.
Yusuke Suzuki
Comment 11 2020-01-07 22:39:44 PST
(In reply to Yusuke Suzuki from comment #10) > I'm now looking WebKitLegacy crash. OK, found the thing. Signature in WebViewInternal.h and WebView.mm were different. I really think this must be compile error even in Objective-C!
Yusuke Suzuki
Comment 12 2020-01-07 22:40:13 PST
(In reply to Yusuke Suzuki from comment #11) > (In reply to Yusuke Suzuki from comment #10) > > I'm now looking WebKitLegacy crash. > > OK, found the thing. Signature in WebViewInternal.h and WebView.mm were > different. > I really think this must be compile error even in Objective-C! I'll double-check and upload the patch for EWS before landing.
Yusuke Suzuki
Comment 13 2020-01-07 23:27:56 PST
Created attachment 387081 [details] Patch WebKitLegacy fix
Simon Fraser (smfr)
Comment 14 2020-01-08 11:28:11 PST
How do we ensure that people correctly use Naked<> in future? It's going to be very easy for new code to regress this again, right?
Yusuke Suzuki
Comment 15 2020-01-08 12:08:49 PST
(In reply to Simon Fraser (smfr) from comment #14) > How do we ensure that people correctly use Naked<> in future? It's going to > be very easy for new code to regress this again, right? I think we should track binary size as we are doing in performance testing.
Yusuke Suzuki
Comment 16 2020-01-08 15:14:31 PST
Created attachment 387147 [details] Patch Fix
Yusuke Suzuki
Comment 17 2020-01-08 17:40:41 PST
I've ensured that iOS simulator API tests pass locally.
Yusuke Suzuki
Comment 18 2020-01-08 17:42:46 PST
Sam Weinig
Comment 19 2020-01-09 17:56:45 PST
(In reply to Yusuke Suzuki from comment #15) > (In reply to Simon Fraser (smfr) from comment #14) > > How do we ensure that people correctly use Naked<> in future? It's going to > > be very easy for new code to regress this again, right? > > I think we should track binary size as we are doing in performance testing. Is this something we could automate at build time? e.g. could we add a script phase (similar to check-for-weak-vtables-and-externals) that checks for this specific issue, C++ type information in Objective-C fields and parameters?
Yusuke Suzuki
Comment 20 2020-01-09 17:59:54 PST
(In reply to Sam Weinig from comment #19) > (In reply to Yusuke Suzuki from comment #15) > > (In reply to Simon Fraser (smfr) from comment #14) > > > How do we ensure that people correctly use Naked<> in future? It's going to > > > be very easy for new code to regress this again, right? > > > > I think we should track binary size as we are doing in performance testing. > > Is this something we could automate at build time? e.g. could we add a > script phase (similar to check-for-weak-vtables-and-externals) that checks > for this specific issue, C++ type information in Objective-C fields and > parameters? PoC of this exists here :) https://bugs.webkit.org/show_bug.cgi?id=205968 Discussed with Simon and we can put this type of script as the same way to Scripts/check-for-exit-time-destructors etc.
Sam Weinig
Comment 21 2020-01-09 19:54:22 PST
(In reply to Yusuke Suzuki from comment #20) > (In reply to Sam Weinig from comment #19) > > (In reply to Yusuke Suzuki from comment #15) > > > (In reply to Simon Fraser (smfr) from comment #14) > > > > How do we ensure that people correctly use Naked<> in future? It's going to > > > > be very easy for new code to regress this again, right? > > > > > > I think we should track binary size as we are doing in performance testing. > > > > Is this something we could automate at build time? e.g. could we add a > > script phase (similar to check-for-weak-vtables-and-externals) that checks > > for this specific issue, C++ type information in Objective-C fields and > > parameters? > > PoC of this exists here :) https://bugs.webkit.org/show_bug.cgi?id=205968 > Discussed with Simon and we can put this type of script as the same way to > Scripts/check-for-exit-time-destructors etc. Very nice.
Note You need to log in before you can comment on or make changes to this bug.