I want to know how objective C runtime handle arguments when I call a objective C method like
[NSString stringWithFomat:@"%@, %@", @"Hello", @"World"]
There are three arguments for this objective C call, how does it work compared to typical way on a ARM system. I have known register r0, r1, r2, r3 will hold first 4 arguments, how about there are additional arguments? How does it put them on a stack and pop them later?
For functions that returns a simple type:
then the rest is placed on the stack:
Of course, “argument” here means a 4-byte object. If the argument has >4 bytes then it will be split out, e.g.
The returned value (up to 16 bytes) will be placed in r0, r1, r2, r3.
For functions that returns a struct:
r0is used to store the pointer of the return value.