<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 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"><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;">How is that different from LLVMGetPointerToGlobal()?</div></blockquote><div><br></div>It’s not. That’s broken, too.</div><div><br><blockquote type="cite" dir="auto"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div>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></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><br></div><div>-Jim</div><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: <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: <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: <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: <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><br></div></div></blockquote></div><br></body></html>