News for hackers. Stuff that matters.
Re:Dissecting objc_msgSend on ARM64 by chrisseaton on Saturday July 01, 2017 @02:15PM (#14678196)
> fptr(self, cmd, args);

But fptr doesn't take a va_list - it takes the actual arguments.

Re:Dissecting objc_msgSend on ARM64 by tom_mellior on Saturday July 01, 2017 @03:15PM (#14678490)
Presumably, as an implementor of an Objective-C compiler, I would choose how to compile methods, and I might just choose to compile methods to functions taking (something memory-compatible with) va_list.
Re:Dissecting objc_msgSend on ARM64 by plorkyeran on Saturday July 01, 2017 @06:09PM (#14679321)
The functions which are called by objc_msgSend do not have to be methods compiled by an obj-c compiler. You can add functions compiled by a compiler with no knowledge of or support for obj-c to an obj-c class at runtime, and then call that method via objc_msgSend.

Obviously you could come up with other ways of passing arguments to obj-c methods which would make it possible to implement your message send function in pure C, but a message send function which passes the arguments as a va_list is not objc_msgSend(), and that says nothing about whether or not objc_msgSend() could be implemented for the design they did go with in pure C.

Re:Dissecting objc_msgSend on ARM64 by icodestuff on Saturday July 01, 2017 @03:58PM (#14678666)
But then you can't call those methods from C yourself (expecting va_list, received arguments). And what about adding methods to classes from plain C functions? Do you duplicate those functions with a va_list version? Seems like that'll add quite a bit of bloat.
Re:Dissecting objc_msgSend on ARM64 by tom_mellior on Saturday July 01, 2017 @05:35PM (#14679163)
<shrug> I corrected a post saying "X is impossible in C". That's a different issue from whether X is as efficient in C as in assembly language.
Re:Dissecting objc_msgSend on ARM64 by chrisseaton on Saturday July 01, 2017 @07:36PM (#14679748)
I think the point was that you cannot implement this particular function in C - a function that forwards arguments to other functions, given a particular standard ABI. You've changed the requirements by saying that now the other functions use a different ABI, so you've missed the point of why it's impossible to implement this function, in these circumstances, in C.
Re:Dissecting objc_msgSend on ARM64 by tom_mellior on Sunday July 02, 2017 @04:55AM (#14681589)
The original question in this thread was whether it was really impossible, under any circumstances, to write this in C, as part of an Objective-C implementation that you fully control. It is possible in C, if you can control the ABI. It's the people who insist on a particular pre-existing ABI who are changing the question.

Anyway, I think I've said all I'm going to say here.