apple open source: https://opensource.apple.com/tarballs/
alloc process:
What is runtime: c c ++ compilation of writing api, c oc transition to run-time, reflecting the learning and application runtime of
objec_msgSend (id message recipient, sel) --- send message
alloc create an instance of an object through our class
Why init need, had nothing to do directly back self --- is a design pattern, for freedom (for rewrite, write on demand, you can not rewrite)
LLVM Optimization - What?
Compile, link, run, idle
Memory aligned (8) :( num + 7) >> 3 << 3 results returned 8 fold, give it at the end. (Space for time)
By creating a class runtime:
Class tempClass = objc_allocateClassPair([NSObject class], "TempClass", 0);
// add properties, the registration must be added, because it is read-only ro (read only)
Class TempClass = objc_allocateClassPair([NSObject class], "TempClass", 0);
// add properties
NSString *name = @"name";
objc_registerClassPair(TempClass);
class_addIvar(TempClass, name.UTF8String, sizeof(id), log2(sizeof(id)), @encode(id));
id p = [TempClass alloc];
[p setValue:@"fanxing" forKey:@"name"];
NSLog(@"name == %@", [p valueForKey:name]);
Examples of the method Gets - an object instance - class
Class Method - metaclass