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

Use the linker for selectors instead of the runtime #18

Merged
merged 1 commit into from
Aug 20, 2024

Conversation

mjbshaw
Copy link
Contributor

@mjbshaw mjbshaw commented Aug 18, 2024

This gets rid of runtime selector initialization. How it works is pretty straightforward:

Instead of calling objc_msgSend, we call objc_msgSend$SELECTOR, where SELECTOR is the selector we want to call. Two examples:

  • To use the "description" selector on an object, we call objc_msgSend$description.
  • To use the "setObject:forKey:" selector on an object, we call objc_msgSend$setObject:forKey:.

The linker then automatically patches these up to the correct selector. The value of the second argument to objc_msgSend (the selector) doesn't matter so this just passes undefined.

  • By selecting this checkbox, I agree to license my contributions to this project under the license(s) described in the LICENSE file, and I have the right to do so or have received permission to do so by an employer or client I am producing work for whom has this right.

@slimsag
Copy link
Member

slimsag commented Aug 18, 2024

@mjbshaw some merge-conflicts from your other PR to address

@mjbshaw
Copy link
Contributor Author

mjbshaw commented Aug 18, 2024

@slimsag Resolved. I guess I should abandon my fight against GitHub and trying to do one-commit-per-PR. I'll batch the next PR so it has multiple commits.

@slimsag
Copy link
Member

slimsag commented Aug 20, 2024

@mjbshaw multiple commits per PR is totally fine, especially when changes are as solid as the ones you are making so far :)

@slimsag slimsag merged commit 2f988dc into hexops:main Aug 20, 2024
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants