为什么Android编译器为相同代码生成不同的Methodref

发布于 2025-02-12 22:00:07 字数 547 浏览 1 评论 0原文

我碰巧遇到了一些有线编译的字体模式,我相信这两者都共享类似于以下

class SomeWebView extends WebView {
   SomeWebView() {
      this.getSettings();      
   }
}

版本1(app a中的代码写)的相同源代码发射代码,例如:

invoke-virtual **WebView**->getSettings() WebSettings, p0

2版(复制到应用程序b)发射代码,例如

invoke-virtual **SomeWebView**->getSettings() WebSettings, p0

:没有更改正确性(?),但是我想知道哪个步骤介绍了此更改及其官方优化名称(例如Devirtualization?但是我确定不是),

请注意某些webview不会覆盖getSettings

i happened to encounter some wired compiled bytecode which i believe both sharing the same source code like below

class SomeWebView extends WebView {
   SomeWebView() {
      this.getSettings();      
   }
}

version 1 (above code write in app a) emits code like:

invoke-virtual **WebView**->getSettings() WebSettings, p0

version 2 (with same code copied to app b) emits code like:

invoke-virtual **SomeWebView**->getSettings() WebSettings, p0

although this changes nothing in correctness(?), but i want to know which step introduced this change and its official optimization name (like devirtualization? but i'm sure it's not)

notice SomeWebView DOES NOT override getSettings

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文