blog

Photo of dog digging by jettef on Flickr

Digging Into the Objective-C Runtime

by

Greg Parker recently tweeted a link to fantastic site he created, An Illustrated History of objc_msgSend, that provides a trip through history of one of the likely most often called, but unheard of functions in iOS or OS X, objc_msgSend. The function dates back to NeXT and the origins of Mac OS and iOS. It’s interesting to see how it has evolved through the versions of the OS, the transitions between processor architectures, and how priorities in the algorithm have changed as hardware has. It was the underpinning of the Objective-C runtime back on those first PowerPC based Macs and still is today on the latest A7 based iOS devices. Incredible.

If you want to learn more about the Objective-C runtime it’s actually open source and is available from Apple’s open source site at objc4-555.1. To go along with the source Apple provides the Objective-C Runtime Programming Guide and Objective-C Runtime Reference. Definitely read through these and take the time to learn more about how the runtime and your modern Objective-C code are related.

Outside of Apple’s documentation, perhaps the best series of posts on the Objective-C runtime and how you can use it are by Mike Ash. Despite the fact that they date back to 2009 and 2010, they’re still very relevant today.

Finally, if you’re looking to do some hacking on the runtime itself, or experiment with patterns and practices from other languages check out libextobjc by Justin Spahr-Summers, one of the Mac developers at GitHub.

Thanks again to Greg Parker for the retrospective, his time spent hacking away on the runtime, and for the inspiration for this post!

+ more

Accurate Timing

Accurate Timing

In many tasks we need to do something at given intervals of time. The most obvious ways may not give you the best results. Time? Meh. The most basic tasks that don't have what you might call CPU-scale time requirements can be handled with the usual language and...

read more