A fast, portable Objective-C runtime written 100% in C11
C Other
Pull request Compare This branch is 7 commits ahead of mulle-nat:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.bootstrap
bin
dox
mulle-objc-runtime.xcodeproj
research-cache-spread
research.xcodeproj
src
tests
.gitignore
.travis.yml
CMakeLists.txt
LICENSE
README.md
RELEASENOTES.md

README.md

mulle-objc-runtime

A portable Objective-C runtime written in C11. No Assembler required. It follows the Apple "Objective-C 1 Runtime" and adds many features from "Objective-C 2.0", but the function calls are completely different. It is designed to be suitable for massive multi-threading.

Fork Build Status Release Version
Mulle kybernetiK Build Status Mulle kybernetiK tag Build Status
Community Build Status Community tag Build Status

What's so different ?

  • Runtime objects (like classes and selectors) are not referenced by name, but by a unique ID. No special linker action required.

  • Parameters outside of self and _cmd are passed via _param, a single pointer to a struct. This simplifies a lot of code, especially forwarding code. Return values are also returned with the same struct. Optimizations are done for simple methods with only none or one parameter and none or one return value.

  • It uses inlineable method calls for superior performance. The user can specify "fast" classes and "fast" methods for extra speed in performance critical cases.

  • retain/release semantics are built in. These are non-overridable, which makes them a lot faster.

  • isa is not part of the instance, but instead prefixed to the instance.

  • Protocol as a type and an object does not exist anymore.

  • No global lock. The runtime only locks during +initialize on a per class basis

  • Protections against the fragile base class problem

  • Multiple runtimes can coexist.

How to use it

If you haven't used an Objective-C runtime before, it is useful to get to know the much better documented "Mac OS X Objective-C 1.0" runtime first. Intro to the Objective-C Runtime could be a good starting point.

Data structures

API Description
_mulle_objc_class Deal with Classes
_mulle_objc_ivar et al. Instance variables
_mulle_objc_loadinfo Install Classes, Categories, Methods, Strings into the runtime
_mulle_objc_method et al. Deal with Methods
_mulle_objc_object et al. Deal with Instances
_mulle_objc_property et al. Handle Properties
_mulle_objc_runtime Work with the runtime

Other functions

API Description
Global Functions Global functions and conveniences
Exceptions Raising exceptions
Vararg extensions Dealing with variable arguments

Articles

These articles give you some background about the mulle-objc runtime:

  1. mulle-objc: a new Objective-C runtime
  2. mulle-objc: a meta calling convention
  3. mulle-objc: removing superflous ifs
  4. mulle-objc: inlined messaging
  5. mulle-objc: some research about selectors
  6. mulle-objc: hashes for classes, selectors and protocols
  7. mulle_objc: object layout, retain counting, finalize
  8. mulle_objc: inheriting methods from protocols
  9. mulle_objc: present and absent language features
  10. mulle_objc: the trouble with @property
  11. mulle_objc: ivar layout with @property
  12. mulle_objc: technically speaking
    1. mulle-clang, technically speaking
    2. mulle-objc-runtime, technically speaking
    3. MulleFoundation, technically speaking

If something is unclear, feel free to contact the author.

Install

On OS X and Linux you can use homebrew, respectively linuxbrew to install the library:

brew install mulle-objc/software/mulle-objc-runtime

On other platforms you can use mulle-install from mulle-build to install the library:

mulle-install --prefix /usr/local --branch release https://github.com/mulle-objc/mulle-objc-runtime

Otherwise read:

Platforms and Compilers

All platforms and compilers supported by mulle-c11 and mulle-thread.

Author

Nat! for Mulle kybernetiK and Codeon GmbH