<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi Lang, Steven,<div class=""><br class=""></div><div class=""><span class="">At this point it seems that the best next step is for Steven to share his code, right? Or is there some other work that can be done in parallel?</span></div><div class=""><span class=""><br class=""></span></div><div class=""><span class="">Lang? Steven?</span></div><div class=""><span class=""><br class=""></span></div><div class=""><span class=""><span id="result_box" class="short_text" tabindex="-1" lang="en">Here’s small note about my interest here: Alex Denisov and I are working on a tool for mutation testing <a href="https://github.com/AlexDenisov/mutang" class="">https://github.com/AlexDenisov/mutang</a>. Alex has made fascinating progress towards mutation testing of C++ code and we would also like to bring mutation testing to iOS where we are by profession. Currently inability to run Objective-C code via JIT is a critical dependency for our progress on iOS part so </span>I'll be happy to help with this in any way even though my experience with LLVM is very limited.</span></div><div class=""><span class=""><br class=""></span></div><div class=""><span class="">Thanks.</span></div><div class=""><span class=""><br class=""></span></div><div class=""><span class="">Stanislav</span></div><div class=""><br class=""><div class=""><div><blockquote type="cite" class=""><div class="">On 19 Oct 2016, at 01:49, Lang Hames <<a href="mailto:lhames@gmail.com" class="">lhames@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Hi Steven,<div class=""><br class=""></div><div class="">That sounds great. The object file parser would definitely be of interest to JIT clients. Having ObjC 1 support would be nice, but I don't see it as a blocker to committing what you've got: all code produced by the JIT is going to be ObjC-2.</div><div class=""><br class=""></div><div class="">Cheers,</div><div class="">Lang.</div></div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Tue, Oct 18, 2016 at 2:22 PM, Steven Wu <span dir="ltr" class=""><<a href="mailto:stevenwu@apple.com" target="_blank" class="">stevenwu@apple.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class="">Hi Stanislav, Lang<div class=""><br class=""></div><div class="">I have a version of objc metadata parser based on LLVM which can handle objc2 metadata from MachO object and bitcode (bitcode version is even swift compatible). I don't know if there is enough interest for me to upstream it. It probably requires some work to clean up the interface and complete it by adding objc1 support and other object format support.</div><span class="HOEnZb"><font color="#888888" class=""><div class=""><br class=""></div><div class="">Steven</div></font></span><div class=""><div class="h5"><div class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Oct 18, 2016, at 2:10 PM, Lang Hames via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank" class="">llvm-dev@lists.llvm.org</a>> wrote:</div><br class="m_3774682329238735481Apple-interchange-newline"><div class=""><div dir="ltr" class="">Hi Stanislav,<div class=""><br class=""></div><div class="">I actually looked into this recently. It is possible, but takes some non-trivial effort right now: You have to hook into the JIT memory allocator, parse the objective C metadata sections in the object file, then call the objective C runtime to register any newly added classes, protocols and selectors.</div><div class=""><br class=""></div><div class="">I can't release my code as-is: I built it against a hacked up copy of the runtime. The right way to do this would be to write parsers for the objective C metadata, and an Objective-C registration call that uses the parsers and calls the runtime. These should be made available conditionally if the objective C runtime headers are available. This is something that I'd like to get to eventually, but I have a long to-do list. If you or anyone you know is interested in working on it I'd be happy to provide pointers and code review.</div><div class=""><br class=""></div><div class="">Cheers,</div><div class="">Lang.</div></div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Tue, Oct 18, 2016 at 1:33 PM, Stanislav Pankevich via llvm-dev <span dir="ltr" class=""><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank" class="">llvm-dev@lists.llvm.org</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class="">Hello,<div class=""><br class=""></div><div class="">Is it possible to execute Objective-C code using LLVM JIT?</div><div class=""><br class=""></div><div class="">The original point for my research is this topic on StackOverflow: </div><div class=""><br class=""></div><div class="">All selectors unrecognised when invoking Objective-C methods using the LLVM ExecutionEngine <a href="http://stackoverflow.com/questions/10375324/all-selectors-unrecognised-when-invoking-objective-c-methods-using-the-llvm-exec" target="_blank" class="">http://stackov<wbr class="">erflow.com/questions/10375324/<wbr class="">all-selectors-unrecognised-<wbr class="">when-invoking-objective-c-<wbr class="">methods-using-the-llvm-exec</a></div><div class=""><br class=""></div><div class="">Running that example with lli produces the following output:</div><div class=""><br class=""></div><div class=""><div class="">2016-10-18 21:25:58.332 lli[12970:169282] *** NSForwarding: warning: selector (0x10356a38f) for message 'alloc' does not match selector known to Objective C runtime (0x7fff8e93afb5)-- abort</div><div class="">2016-10-18 21:25:58.334 lli[12970:169282] +[NSAutoreleasePool alloc]: unrecognized selector sent to class 0x7fff7a562130</div><div class="">2016-10-18 21:25:58.338 lli[12970:169282] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[NSAutoreleasePool alloc]: unrecognized selector sent to class 0x7fff7a562130'</div></div><div class=""><br class=""></div><div class="">See also additional discussion here: <a href="https://twitter.com/sbpankevich/status/783363161537798144" target="_blank" class="">https://twitter.com/sbpa<wbr class="">nkevich/status/783363161537798<wbr class="">144</a>.</div><div class=""><br class=""></div><div class="">Thanks.</div><span class="m_3774682329238735481HOEnZb"><font color="#888888" class=""><div class=""><br class=""></div><div class="">Stanislav Pankevich</div><div class=""><br class=""></div></font></span></div><br class="">______________________________<wbr class="">_________________<br class="">
LLVM Developers mailing list<br class="">
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank" class="">llvm-dev@lists.llvm.org</a><br class="">
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank" class="">http://lists.llvm.org/cgi-bin/<wbr class="">mailman/listinfo/llvm-dev</a><br class="">
<br class=""></blockquote></div><br class=""></div>
______________________________<wbr class="">_________________<br class="">LLVM Developers mailing list<br class=""><a href="mailto:llvm-dev@lists.llvm.org" target="_blank" class="">llvm-dev@lists.llvm.org</a><br class=""><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" target="_blank" class="">http://lists.llvm.org/cgi-bin/<wbr class="">mailman/listinfo/llvm-dev</a><br class=""></div></blockquote></div><br class=""></div></div></div></div></blockquote></div><br class=""></div>
</div></blockquote></div><br class=""></div></div></body></html>