<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br><div><div>On Sep 19, 2013, at 2:04 PM, Filip Pizlo <<a href="mailto:fpizlo@apple.com">fpizlo@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><meta http-equiv="Content-Type" content="text/html charset=windows-1252"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br><div><div>On Sep 19, 2013, at 1:49 PM, Jim Grosbach <<a href="mailto:grosbach@apple.com">grosbach@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div><br class="Apple-interchange-newline">On Sep 19, 2013, at 1:46 PM, Filip Pizlo <<a href="mailto:fpizlo@apple.com">fpizlo@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">How is that different from LLVMGetPointerToGlobal()?</div></blockquote><div><br></div>It’s not. That’s broken, too.</div><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br><blockquote type="cite" dir="auto"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">And I agree that this should work.  It's great that the JIT could be used for remote execution, but some clients will never use the JIT in that fashion.  They will just want a void*.</div></blockquote><div><br></div><div>Then they will use a memory manager that can make additional guarantees such as the opaque uint64_t value is actual just a bitcasted local pointer which can be safely cast back to void* or whatever. That’s a client-process usage, however, and not a guarantee of the JIT API.</div></div></blockquote><div dir="auto"><br></div><div dir="auto">Are you saying that if a LLVM C API client doesn't install a custom memory manager, then the MCJIT is semantically permitted to JIT the code into a remote process?</div></div></div></blockquote><div><br></div><div>No, I’m saying the API has to be semantically rich enough to be agnostic about remote vs. local. That’s a function of the memory manager interface. The default memory manager does indeed to local currently. I have mixed feelings about making that an explicit guarantee.</div><br><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div><div dir="auto">Currently the C API has no facility for asking for code to be JITed into something remote, and it seems like it would be a bug if the JIT did this without the client asking for it.  It makes far more sense to me that the C API continues to have a hard constraint that JITing is local, and that the end result is a function that lives in your address space.</div></div></div></blockquote><div><br></div>I strongly disagree. The C API is about exposing functionality, not imposing additional constraints.<br><div><br></div><div><br></div>-Jim</div><div><blockquote type="cite" dir="auto"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div><blockquote type="cite"><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br><blockquote type="cite" dir="auto"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div><br></div><div><br><div><div>On Sep 19, 2013, at 1:36 PM, Eric Christopher <<a href="mailto:echristo@gmail.com">echristo@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">Hrm. That's a good point and one I hadn't thought about... what's the<br>best way forward here? There's definitely a useful need in getting a<br>void * to a function out of the JIT from the C level.<br><br>-eric<br><br>On Thu, Sep 19, 2013 at 1:30 PM, Jim Grosbach <<a href="mailto:grosbach@apple.com">grosbach@apple.com</a>> wrote:<br><blockquote type="cite">This isn’t going to work when the execution target isn’t local. The pointer to the function is in the executing process address space and this returns a pointer in the compiler’s address space.<br><br>That’s a fundamental problem with the old JIT, and is semi-baked into the ExecutionEngine API, unfortunately, and cleaning that up is going to be painful. We shouldn’t, however, make the problem worse.<br><br>-Jim<br><br>On Sep 19, 2013, at 12:55 PM, Anders Waldenborg <<a href="mailto:anders@0x63.nu">anders@0x63.nu</a>> wrote:<br><br><blockquote type="cite">Author: andersg<br>Date: Thu Sep 19 14:55:06 2013<br>New Revision: 191030<br><br>URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project?rev=191030&view=rev">http://llvm.org/viewvc/llvm-project?rev=191030&view=rev</a><br>Log:<br>llvm-c: Add LLVMGetPointerToFunction<br><br>Differential Revision:<span class="Apple-converted-space"> </span><a href="http://llvm-reviews.chandlerc.com/D1715">http://llvm-reviews.chandlerc.com/D1715</a><br><br><br>Modified:<br>  llvm/trunk/include/llvm-c/ExecutionEngine.h<br>  llvm/trunk/lib/ExecutionEngine/ExecutionEngineBindings.cpp<br><br>Modified: llvm/trunk/include/llvm-c/ExecutionEngine.h<br>URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/ExecutionEngine.h?rev=191030&r1=191029&r2=191030&view=diff">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/ExecutionEngine.h?rev=191030&r1=191029&r2=191030&view=diff</a><br>==============================================================================<br>--- llvm/trunk/include/llvm-c/ExecutionEngine.h (original)<br>+++ llvm/trunk/include/llvm-c/ExecutionEngine.h Thu Sep 19 14:55:06 2013<br>@@ -141,6 +141,8 @@ LLVMGenericValueRef LLVMRunFunction(LLVM<br>                                   unsigned NumArgs,<br>                                   LLVMGenericValueRef *Args);<br><br>+void *LLVMGetPointerToFunction(LLVMExecutionEngineRef EE, LLVMValueRef F);<br>+<br>void LLVMFreeMachineCodeForFunction(LLVMExecutionEngineRef EE, LLVMValueRef F);<br><br>void LLVMAddModule(LLVMExecutionEngineRef EE, LLVMModuleRef M);<br><br>Modified: llvm/trunk/lib/ExecutionEngine/ExecutionEngineBindings.cpp<br>URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/ExecutionEngineBindings.cpp?rev=191030&r1=191029&r2=191030&view=diff">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/ExecutionEngineBindings.cpp?rev=191030&r1=191029&r2=191030&view=diff</a><br>==============================================================================<br>--- llvm/trunk/lib/ExecutionEngine/ExecutionEngineBindings.cpp (original)<br>+++ llvm/trunk/lib/ExecutionEngine/ExecutionEngineBindings.cpp Thu Sep 19 14:55:06 2013<br>@@ -276,6 +276,10 @@ LLVMGenericValueRef LLVMRunFunction(LLVM<br> return wrap(Result);<br>}<br><br>+void *LLVMGetPointerToFunction(LLVMExecutionEngineRef EE, LLVMValueRef F) {<br>+  return unwrap(EE)->getPointerToFunction(unwrap<Function>(F));<br>+}<br>+<br>void LLVMFreeMachineCodeForFunction(LLVMExecutionEngineRef EE, LLVMValueRef F) {<br> unwrap(EE)->freeMachineCodeForFunction(unwrap<Function>(F));<br>}<br><br><br>_______________________________________________<br>llvm-commits mailing list<br><a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br></blockquote><br><br>_______________________________________________<br>llvm-commits mailing list<br><a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br></blockquote><br>_______________________________________________<br>llvm-commits mailing list<br><a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a></div></blockquote></div></div></div></blockquote></div></blockquote></div><br></div></blockquote></div><br></body></html>