Re:Mulle-objc: A New Objective-C Compiler and Runtime
by ksherlock on Saturday November 26, 2016 @10:07PM
(#13047469)
the objc_msgSend function doesn't know what it's return type is or how many arguments it has. It needs to lookup the actual function then jump to it without modifying the stack or any of the parameter registers. It simply doesn't follow the calling conventions and C can't handle it.
[ Parent
| on HN ]
Re:Mulle-objc: A New Objective-C Compiler and Runtime
by chrisseaton on Sunday November 27, 2016 @06:40AM
(#13048719)
Right, true. I guess I'm used to working on languages where you can stick everything into a uint64, but that isn't the case with something like returned structs. if you controlled the calling convention you could do it in C.
Re:Mulle-objc: A New Objective-C Compiler and Runtime
by lilyball on Monday November 28, 2016 @03:50PM
(#13058300)
It appears that controlling the calling convention is exactly what Mulle-objc is doing. It's layering a new convention on top of C calling conventions, where objc_msgSend() is given a pointer to a struct containing the arguments. This way the compiler can synthesize the struct for you, and objc_msgSend() itself can be written in vanilla C.