<div dir="ltr">Hi Andy,<div><br></div><div>I believe this is now implemented by the RTDyldMemoryManager::reserveAllocationSpace method. This would actually be perfect for the LLI use case. Thanks for reminding me of it. :)</div><div><br></div><div>Cheers,</div><div>Lang.</div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Nov 26, 2014 at 2:19 PM, Kaylor, Andrew <span dir="ltr"><<a href="mailto:andrew.kaylor@intel.com" target="_blank">andrew.kaylor@intel.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">





<div lang="EN-US" link="blue" vlink="purple">
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">There was a suggestion back in January  (and even a patch) that we add an option to have RuntimeDyld scan the image before it does any allocation and give the
 memory manager enough information to pre-allocate all the blocks that would be necessary.  Here’s a link to the discussion:<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><a href="http://lists.cs.uiuc.edu/pipermail/llvmdev/2014-January/069267.html" target="_blank">http://lists.cs.uiuc.edu/pipermail/llvmdev/2014-January/069267.html</a><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">One of my colleagues actually wrote a memory manager that worked this way back when we were first implementing RuntimeDyld for ELF on x86-64 platforms, but
 after some discussion we decided that it was more complicated than we wanted -- at least for a default implementation of the memory manager.  That said, this issue has come up regularly so I definitely think it is worth addressing.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">-Andy<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> <a href="mailto:llvm-commits-bounces@cs.uiuc.edu" target="_blank">llvm-commits-bounces@cs.uiuc.edu</a> [mailto:<a href="mailto:llvm-commits-bounces@cs.uiuc.edu" target="_blank">llvm-commits-bounces@cs.uiuc.edu</a>]
<b>On Behalf Of </b>Lang Hames<br>
<b>Sent:</b> Wednesday, November 26, 2014 11:52 AM<br>
<b>To:</b> Commit Messages and Patches for LLVM<br>
<b>Subject:</b> Re: [llvm] r222767 - Small model and JIT generally don't go well with each other.<u></u><u></u></span></p><div><div class="h5">
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal">> The default implementation does *not* do that.<u></u><u></u></p>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">That's why I suggested that we add a new mode with a memory manager that does do that. ;)<u></u><u></u></p>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">> The necessary mmap flags are not portable either.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">I don't think we'd need mmap. I'm imagining that this mode would be for regression tests only. It would use a trivial RTDyldMemoryManager subclass that wraps a bump-ptr allocator and reserves some small amount of memory (~16Mb seems like
 it should be fine) up front. <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">Another item for the JIT to-do list. :)<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">Cheers,<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Lang.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<div>
<p class="MsoNormal">On Wed, Nov 26, 2014 at 2:25 AM, Joerg Sonnenberger <<a href="mailto:joerg@britannica.bec.de" target="_blank">joerg@britannica.bec.de</a>> wrote:<u></u><u></u></p>
<p class="MsoNormal">On Tue, Nov 25, 2014 at 11:07:16PM -0800, Lang Hames wrote:<br>
> It may be worth filing a bug for this, since we still want small-code-model<br>
> to be supported in the JIT. To make this testable we'd need to add a mode<br>
> to LLI that guarantees allocations compatible with small code model.<br>
<br>
As discussed with echristo on IRC, small code model for JIT does work IF<br>
the memory manager ensures that the constraints are implemented. The<br>
default implementation does *not* do that. The necessary mmap flags are<br>
not portable either.<br>
<span style="color:#888888"><br>
Joerg</span><u></u><u></u></p>
<div>
<div>
<p class="MsoNormal">_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu" target="_blank">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><u></u><u></u></p>
</div>
</div>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</div>
</div>
</div></div></div>
</div>

</blockquote></div><br></div>