News for hackers. Stuff that matters.
Re:Mulle-objc: A New Objective-C Compiler and Runtime by groovy2shoes on Saturday November 26, 2016 @05:46PM (#13046398)
I don't see anything w.r.t. objc_msgSend() that obviously prevents it from being written in C, as opposed to objc_msg_lookup(). I mean, worst case scenario, could it not just be:

    id objc_msgSend(id object, id selector, ...) {
        IMP tmp = objc_msg_lookup(object, selector);
        return tmp(object, selector, ...);
    }
(forgive me for any mistyping here, as I'm not an Obj-C programmer, and for the varargs shorthand, to keep things simple)? Especially given that GCC supports some extensions to C that could reduce the overhead a bit (tail-recursion elimination, for example), I don't see why such a function couldn't be implementable in (GCC) C.

Would you be willing to enlighten me?

Re:Mulle-objc: A New Objective-C Compiler and Runtime by ksherlock on Sunday November 27, 2016 @12:39PM (#13050280)
Conceptually, it is:

    IMP tmp = objc_msg_lookup(object, selector);
    goto *tmp;
but C can't handle that (and even with gcc computed gotos you need to preserve any argument registers and not screw up the stack).

objc_msgSend has a variable number of arguments and no way to determine how many there are.

Re:Mulle-objc: A New Objective-C Compiler and Runtime by DHowett on Saturday November 26, 2016 @05:49PM (#13046419)
It's the ... that's the hard part; I've explained a little more here: https://news.ycombinator.com/item?id=13046391.