Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to __objc_msg_forward2 for better forwarding efficiency #2932

Open
DHowett-MSFT opened this issue Nov 20, 2019 · 1 comment
Open

Switch to __objc_msg_forward2 for better forwarding efficiency #2932

DHowett-MSFT opened this issue Nov 20, 2019 · 1 comment

Comments

@DHowett-MSFT
Copy link

Hi,

I was looking through your changes and found myself looking at the message forwarding. The current code can be simplified with the new forwarding interface, which moves slot maintenance into the runtime. If you use __objc_msg_forward2 as the forwarding hook, things are more efficient with the new runtime. The v2 ABI now has a single global version for whether caching is safe, rather than a per-method one (methods are sufficiently rare that it’s fine to invalidate all method caches when they change – at some point I’ll rewrite the LLVM pass that I had that did automatic method caching for loops, let me know if you have any workloads I can use for benchmarking…).

This test shows the new interface (which is actually the very old interface, because that one was already the right shape):

https://github.com/gnustep/libobjc2/blob/master/Test/Forward.m

Oh, and the comment on _NSWeakLoad is slightly wrong: There’s a third condition, this hook is used only for classes that implement their own retain / release / autorelease and don’t claim to be ARC compatible. It’s mostly dead code, so you might want to log a warning that a weak reference was used to a class that is not ARC-safe when this is reached.

David

@edvv
Copy link

edvv commented Nov 22, 2019

... looking forward to any fixes and improvements! :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants