Hi,<br><br><div class="gmail_quote">On Tue, Dec 15, 2009 at 9:25 PM, Jeffrey Yasskin <span dir="ltr"><<a href="mailto:jyasskin@google.com">jyasskin@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="im">On Tue, Dec 15, 2009 at 1:05 AM, Zoltan Varga <<a href="mailto:vargaz@gmail.com">vargaz@gmail.com</a>> wrote:<br>
</div><div class="im">> Hi,<br>
><br>
> After this commit:<br>
> <a href="http://llvm.org/viewvc/llvm-project?view=rev&revision=88984" target="_blank">http://llvm.org/viewvc/llvm-project?view=rev&revision=88984</a><br>
><br>
> the X86 JIT no longer emits calls using call <ADDR>, but always uses mov<br>
> REG, <ADDR>, call *REG.<br>
<br>
</div>That should only be the x86-64 JIT. If the x86-32 JIT does that, it's<br>
definitely a bug. For x86-64, it's required unless the<br>
JITMemoryManager can guarantee that it only allocates code within 2GB<br>
of the text segment.<br>
<div class="im"><br></div></blockquote><div><br>Our memory manager allocates memory using the MAP_32BIT flag to mmap, so it<br>can guarantee that it is a 32 bit address.<br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="im">
> This causes problems for the usage of LLVM in JITs<br>
> since the JIT can no longer patch the callsite after the callee have been<br>
> compiled.<br>
<br>
</div>As far as I know, the JIT only tries to patch the callsite when it's<br>
compiling lazily. In that case, it uses X86JITInfo::emitFunctionStub()<br>
to emit a stub with known layout that it can patch. It doesn't try to<br>
patch the call to the stub.<br>
<br>
If you've found a broken case here, could you send a (small!) test<br>
program with its compilation line, or a patch to<br>
<a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ExecutionEngine/JIT/JITTest.cpp" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ExecutionEngine/JIT/JITTest.cpp</a><br>
that exposes it? English descriptions of these problems tend to be too<br>
vague to reproduce.<br>
<div class="im"><br></div></blockquote><div><br>We are using our pre-existing JIT code (mono), and only parts of the LLVM JIT infrastructure,<br>we would prefer patching the calling code instead of patching the stub, to avoid the overhead of going through the stub at every call, also our JIT expects to be able to patch the call sites.<br>
 </div><div> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
someone else was complaining of a bug there too. The CodeModel is<br>
definitely intended to be configurable, specifically so that users can<br>
specify the guarantees their JITMemoryManager provides. Still, it's<br>
supposed to be an optimization. The large code model should always<br>
produce correct code.<br>
<div class="im"><br></div></blockquote><div><br>It does produce current code, its just that our code depends on LLVM generating normal direct calls and we would like a way to force it to do that. Passing CodeModel::Default to createJIT () used to do that, but it doesn't any more, since it is overwritten with Large.<br>
<br>                                                         Zoltan<br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="im">

><br>
> <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetMachine.cpp?r1=86251&r2=88984&pathrev=88984" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetMachine.cpp?r1=86251&r2=88984&pathrev=88984</a><br>

><br>
> Would it be possible to fix this or make it configurable ?<br>
><br>
>                                thanks<br>
><br>
>                                     Zoltan<br>
><br>
</div>> _______________________________________________<br>
> LLVM Developers mailing list<br>
> <a href="mailto:LLVMdev@cs.uiuc.edu">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>
><br>
</blockquote></div><br>