开发者

What exactly does GCC -fobjc-direct-dispatch option do?

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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜