[llvm-dev] Is it possible to execute Objective-C code via LLVM JIT?
David Chisnall via llvm-dev
llvm-dev at lists.llvm.org
Tue Feb 13 03:18:39 PST 2018
On 12 Feb 2018, at 22:31, Stanislav Pankevich via llvm-dev <llvm-dev at lists.llvm.org> wrote:
>
> Specifically I explored the latest objc4-723
> from Apple Open Source and it looks like all of the APIs that allow
> the registration of Objective-C classes, selectors, etc. are all very
> private.
The Objective-C runtime provides public APIs for doing all of this. They’re even documented. They are also more or less standard and so work with all runtime implementations, not just the Apple one. I was using them for JIT’d code on macOS and FreeBSD 10 years ago.
> One year ago you said you could help anyone interested in working on
> this. Let me check here again as a volunteer (if this work can ever be
> accomplished by someone outside Apple).
As I said in the earlier thread, the best way of doing this is to add a new subclass of CGObjCRuntime that generates the code using the public APIs. If you’re running in the same process as the JIT, you could register the selectors in the host environment and just inject the values as symbols (this is what I did). I’d be happy to help out someone who wants to do this.
David
More information about the llvm-dev
mailing list