GCC -fobjc-direct-dispatch 选项到底有什么作用?

发布于 2024-08-31 10:19:08 字数 191 浏览 2 评论 0原文

海湾合作委员会手册说:

-fobjc-direct-dispatch

允许快速跳转到消息调度程序。在 达尔文这是通过通信页面完成的。

我可以假设这个标志消除了动态调度吗?它是如何运作的? 我相信如果直接链接它应该和 C 函数调用一样快。

The GCC manual says:

-fobjc-direct-dispatch

Allow fast jumps to the message dispatcher. On
Darwin this is accomplished via the comm page.

Can I assume this flag eliminates dynamic dispatch? How does it work?
I believe it should be as fast as a C function call if it is linked directly.

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

樱花坊 2024-09-07 10:19:08

不,动态调度仍然存在(调用仍然通过 objc_msgSend 路由)。此选项目前与 x86(-64) 没有任何区别。

来自 http:// /developer.apple.com/legacy/mac/library/documentation/DeveloperTools/gcc-3.3/gcc/Objective_002dC-Dialect-Options.html

对于一些被 Objective-C 程序频繁调用的函数(例如 objc_msgSend),高内存中存在特殊的入口点,可以直接跳转到(例如,通过“bla”” PowerPC 上的指令)以提高性能。 fobjc-direct-dispatch 选项将导致生成此类跳转。该选项仅与 NeXT 运行时结合使用;此外,使用 -fobjc-direct-dispatch 选项构建的程序只能在 Mac OS X 10.4 (Tiger) 或更高版本的系统上运行。

No, the dynamic dispatch is still there (calls still route through objc_msgSend). And this option doesn't introduce any difference currently with x86(-64).

From http://developer.apple.com/legacy/mac/library/documentation/DeveloperTools/gcc-3.3/gcc/Objective_002dC-Dialect-Options.html:

For some functions (such as objc_msgSend) called very frequently by Objective-C programs, special entry points exist in high memory that may be jumped to directly (e.g., via the "bla" instruction on the PowerPC) for improved performance. The fobjc-direct-dispatch option will cause such jumps to be generated. This option is only available in conjunction with the NeXT runtime; furthermore, programs built with the -fobjc-direct-dispatch option will only run on Mac OS X 10.4 (Tiger) or later systems.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文