gpt4 book ai didi

objective-c - GCC -fobjc-direct-dispatch 选项究竟做了什么?

转载 作者:搜寻专家 更新时间:2023-10-30 20:07:55 28 4
gpt4 key购买 nike

GCC 手册说:

-fobjc-direct-dispatch

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

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

最佳答案

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

来自 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.

关于objective-c - GCC -fobjc-direct-dispatch 选项究竟做了什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2794434/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com