This repo is a small Objective-C runtime for arm64 macOS. It keeps the scope intentionally narrow so the code stays readable and useful for learning how Clang-emitted Objective-C metadata connects to message dispatch.
- Class-method dispatch only
- Basic parameters and return values
- Normal Objective-C call syntax such as
[Math addA:15 b:20] - A tiny
objc_msgSendbridge plus readable lookup logic in C
- Instance allocation or instance methods
- ARC integration
- Method caches
- Categories, protocols, ivars, or full runtime APIs
- Platforms other than arm64 macOS
The project is split into two small pieces:
- runtime.c: walks Clang-emitted class metadata, finds a selector, and returns an
IMP - objc_msgSend.s: a tiny arm64 ABI bridge that preserves argument registers, resolves the method, and jumps to the implementation
The key idea is that method lookup is easy to explain in C, while objc_msgSend still needs a small assembly wrapper because Objective-C syntax expects ABI-correct argument forwarding.
- runtime.h: minimal public runtime types
- runtime.c: selector lookup and failure handling
- objc_msgSend.s: arm64 message-send trampoline
- examples: short demos
make runExample output:
Hello from the mini runtime.
15 + 20 = 35
abs(-7) = 7