Re: Some in-depth Obj-C runtime questions.
Re: Some in-depth Obj-C runtime questions.
- Subject: Re: Some in-depth Obj-C runtime questions.
- From: Christopher Lloyd <email@hidden>
- Date: Mon, 02 Jul 2001 16:00:46 -0400
At 12:42 AM 7/2/2001 -0700, you wrote:
Can I safely assume that the size of any argument can be obtained by just
tallying up the sizes of all the f's, i's, :'s, etc?
Not really, you have to worry about promotion on arguments and alignment in
structures. NSInvocation, NSMethodSignature and NSGetSizeAndAlignment() do
all of the work for you though.
How is [NSMethodSignature description] obtaining the offsets of each of
these elements? Is it pulling them out of the runtime, or relying on the
type encoding?
Pretty sure it uses the type encoding only. There are some numbers floating
around in the type signatures, but I think they are ignored. You can
initialize an NSMethodSignature with just the type encoding and it will do
the right thing. There is a private method +(NSMethodSignature
*)signatureWithObjCTypes:(const char *)types; - this exists on YB/NT,
haven't checked if it's still there on OS X, probably is.
One other question, is why is self's offset 128 bytes from the beginning
of the stack frame? What all is in the stack frame besides the return
address?
Not sure, maybe the register set?
Hope this helps,
Chris