<div dir="ltr">Hi Hayden,<div><br></div><div>Which aspect are you interested in seeing C bindings for?</div><div><br></div><div>ExecutionEngine already has C bindings. We'd need buy-in from clients before before we considered any change that would affect the C-API, including restricting the interface, and we'd have to provide a transition plan to avoid rev-lock. That's probably doable though: I don't think anyone's particularly enamored of the current interface.</div><div><br></div><div>We could consider exposing MCJIT functionality via the C-API, but we'd have to carefully pin down how the aspects we expose are expected to behave.</div><div><br></div><div>The Orc APIs are tricker. There's two ways we could go:</div><div><br></div><div>(1) Try to expose the full modular JIT components concept. In this case we'd have to add a type-erasing layer (AbstractJITLayer?) that uses virtual methods to call base layers. Then we could have C API for constructing and connecting the layers. This would give C users the closest possible experience to C++ users (with a little runtime overhead for the virtual calls). On the other hand it would be more work, and we'd want to be careful about how and when we expose the layers, since they're still so new.</div><div><br></div><div>(2) Pick some canonical stack* and just expose that. This would be less work, and wouldn't risk constraining the layer implementations at all (provided you could still configure them somehow to provide the canonical stack functionality). On the other hand it'd mean C users wouldn't get the same experience from the APIs as C++ users.</div><div><br></div><div>* If we're only going to expose one stack, it should probably be the The Lot (at least as it stands at the moment):</div><div>4) CompileOnDemandLayer.</div><div>3) LazyEmittingLayer.</div><div>2) IRCompilingLayer.</div><div>1) ObjectLinkingLayer.</div><div><br></div><div>Cheers,</div><div>Lang.</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Mar 14, 2015 at 1:48 PM, Hayden Livingston <span dir="ltr"><<a href="mailto:halivingston@gmail.com" target="_blank">halivingston@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Another question: Lang, when do you think it'll be ok to move it to the C Bindings?</div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Mar 13, 2015 at 6:39 PM, Lang Hames <span dir="ltr"><<a href="mailto:lhames@gmail.com" target="_blank">lhames@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Pawel,<div><br></div><div>I agree. ExecutionEngine, in its current form, is unhelpful. I'd be in favor of cutting the common interface back to something like:</div><div><br></div><div><font face="monospace, monospace">class ExecutionEngine {</font></div><div><font face="monospace, monospace">public:</font></div><div><font face="monospace, monospace">  virtual void addModule(std::unique_ptr<Module> M) = 0;</font></div><div><font face="monospace, monospace">  virtual void* getGlobalValueAddress(const GlobalValue *GV) = 0;</font></div><div><font face="monospace, monospace">  virtual GenericValue runFunction(const Function *F,</font></div><div><font face="monospace, monospace">                                   const std::vector<GenericValue> &Args) = 0;</font></div><div><font face="monospace, monospace">};</font></div><div><br></div><div>That's the obvious common functionality that both the interpreter and MCJIT provide. Beyond that I think things get pretty implementation specific.</div><div><br></div><div>For what it's worth, this is an issue that I'm trying to address with the new Orc JIT APIs. Those expose the internals directly to give you more control. If you don't want to be able to switch the underlying execution-engine, they may be a good fit for your use-case.</div><div><br></div><div>Cheers,</div><div>Lang.</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div>On Sat, Mar 14, 2015 at 4:57 AM, Paweł Bylica <span dir="ltr"><<a href="mailto:chfast@gmail.com" target="_blank">chfast@gmail.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;padding-left:1ex;border-left-color:rgb(204,204,204);border-left-width:1px;border-left-style:solid"><div><div><div dir="ltr">Hi,<div><br></div><div>I think ExecutionEngine as a common interface for both Interpreter and MCJIT is almost useless in the current form. There are separated methods in ExecutionEngine for similar or the same features provided by Interpreter and MCJIT, i.e. to get a pointer to function you should call getPointerToFunction() for Interpreter or getFunctionAddress() for MCJIT. </div><div><br></div><div>Personally, I'm using MCJIT and wish to have access to some methods not available from ExecutionEngine. E.g. I would like to use getSymbolAddress() instead of getFunctionAddress() sometimes as getFunctionAddress() do some additional work what I'm sure has be done already.</div><div><br></div><div>Maybe it's time face the truth that Interpreter and MCJIT based solutions are not so similar and different interfaces are needed. Or maybe some unification is possible?</div><div><br></div><div>My propositions / discussion starting points:</div><div><ol><li>Expose MCJIT header in public API. It will allow users to cast ExecutionEngine instance to MCJIT instance.</li><li>Separate Interpreter and MCJIT interfaces and add them to API. ExecutionEngine can still be a base class for real common part (like module list).</li><li>Try to alter ExecutionEngine interface to unify common Interpreter and MCJIT features. Is it possible to have one getFunction() method?</li></ol><span><font color="#888888"><div>- Paweł</div></font></span></div></div>
<br></div></div>_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
<br></blockquote></div><br></div>
<br>_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
<br></blockquote></div><br></div>
</div></div></blockquote></div><br></div>