4 ms·
Maybe this Objective-C optimization isn't implemented in iOS: http://www.shannah.ca/blog/?p=226 http://www.shannah.ca/blog/?p=226
by invalidname 13y ago
Maybe this Objective-C optimization isn't implemented in iOS:
http://www.shannah.ca/blog/?p=226 http://www.shannah.ca/blog/?p=226
- kybernetyk 13y agoIt really isn't that big of a deal. Trampolining is pretty straight forward and a caching of memory addresses isn't a big deal either. So I don't know why Apple wouldn't add this optimization to the iOS obj-c runtime.
- asveikau 13y agoTrampolining is harder to do if you keep around this absurdity (sorry "security feature") of not being able to mark pages as executable. If they open this up for the objc runtime then any other code in the same process would be able to do it too.
- pbsdp 13y agoYou're assuming writable trampolines. objc_msgSend()'s trampoline works by caching the target lookup and having an extremely short fast-path in the case that the target method implementation is cached. objc_msgSend is a trampoline in the sense that it leaves the frame/registers untouched and jumps straight to the target implementation. That said, you can implement the kinds of trampolines you're referring to without writable code pages, it just requires more work: http://landonf.bikemonkey.org/2011/04/index.html http://landonf.bikemonkey.org/2011/04/index.html