<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
{mso-style-priority:99;
mso-style-link:"Balloon Text Char";
margin:0in;
margin-bottom:.0001pt;
font-size:8.0pt;
font-family:"Tahoma","sans-serif";}
span.BalloonTextChar
{mso-style-name:"Balloon Text Char";
mso-style-priority:99;
mso-style-link:"Balloon Text";
font-family:"Tahoma","sans-serif";}
span.EmailStyle19
{mso-style-type:personal-reply;
font-family:"Calibri","sans-serif";
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri","sans-serif";}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Hi Yaron,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">I think a lot of what I said in my reply to Gaël also applies to your situation. In particular, I think that it’s probably best for your code to manager the
function stubs and replacement. I talked last week with a developer who works on the Julia language (which shares a lot of features your situation) and it’s my understanding that the Julia runtime handles function stubs and function replacement in a way that
is similar to what I described even though they are currently using the old JIT engine (not coincidental since my discussions with him helped shape my ideas about how to do this).<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Module deletion is clearly a bit of a problem currently. This is on my wish list of things for MCJIT to support. One of the biggest barriers to module deletion
is that MCJIT doesn’t track links between generated objects, so if you want to delete an object that is being called from another generated object that would be a problem. Using client-managed stubs for inter-module linking obviously helps with this problem.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">The other issue is that we aren’t currently telling the memory manager which module any given allocation request is associated with. There are some clues that
a sufficiently motivated memory manager could possibly use to figure it out, but there’s nothing to directly support it.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">I think the module deletion case is worth discussing further. I’d be happy to hear proposals for changes to support it.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Registration of EH frame information as new modules are added should work in MCJIT. If it doesn’t that’s a bug.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">-Andy<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></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""> Yaron Keren [mailto:yaron.keren@gmail.com]
<br>
<b>Sent:</b> Wednesday, November 13, 2013 1:56 PM<br>
<b>To:</b> Kaylor, Andrew<br>
<b>Cc:</b> Gaël Thomas; llvm-commits@cs.uiuc.edu; LLVM Dev<br>
<b>Subject:</b> Re: (Very) small patch for the jit event listener<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal">Hi Andy,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">We had previous discussions about this, I'd like to state more exactly what features would make MCJIT a replacement for the JIT. <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">After putting significant effort trying to move to MCJIT, I'm currently back with the JIT. This is in a REPL environment where functions are added and removed dynamically and response time is important. The issue is the legacy JIT provides
great flexibility for this use case which is currently missing from MCJIT because of their very different design and goals.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">With JIT, you can modify Function(s) in an already-compiled Module, unload the machine code and the JIT will automatically recompile and relink the function next time it is called. To make MCJIT work like that it would need at least :<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">1) Automatic module splitting into function-modules.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">2) Module delete: from module list, from linker namespace, machine code unload, unregister EH and debuginfo.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">3) Stub functions.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">4) Relinking with stub functions so that new modules are relinked without changing already-finalized modules. This is critical to response time as you may change just one function out of 1000.<o:p></o:p></p>
</div>
<div>
<div>
<p class="MsoNormal">5) Module addition should register EH and debuginfo (this is not done with current JIT but while at it...).<o:p></o:p></p>
</div>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">REPL environments using the LLVM JIT would likely encounter great difficulty moving to the current MCJIT without the above. 1) could be done by the programmer but the a helper function should provide this service. 2)-4) could be done only
in the MCJIT. 5) is a bonus.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Until MCJIT has this kind of flexibility, I hope the JIT would be kept alive.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Yaron<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal">2013/11/13 Kaylor, Andrew <<a href="mailto:andrew.kaylor@intel.com" target="_blank">andrew.kaylor@intel.com</a>><o:p></o:p></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<p class="MsoNormal">Hi Gaël,<br>
<br>
I'm not familiar enough with the details of the old JIT engine and its event interface to comment on whether or not your changes are appropriate, but I'm not sure anyone is so the patch is probably OK as is. I don't see any obvious problems with it.<br>
<br>
However, your description of the changes raises a bigger issue in my mind. I'm not sure if you are aware of this, but we're planning to deprecate the old JIT engine in a future release -- possibly as soon as LLVM 3.5. In order to do so we need to make sure
the MCJIT engine is capable of meeting the needs of current JIT users, and I'm not sure we've got your case fully covered yet.<br>
<br>
Can you tell me a little bit more about the details of how you are using the JIT engine? I'm putting together a document describing various models for MCJIT use and if your model isn't covered by one of the cases I've got now I'd like to add it.<br>
<br>
Also, have you looked at the recently added Stackmap and Patchpoint intrinsics. Without knowing a lot about either your case or those intrinsics, I think that there may be a possible match there. The thing that raised a red flag for me in your message was
that MCJIT doesn't maintain mappings between the generated code and the LLVM classes from which it is produced, so we'll probably need a different way to handle your safepoints.<br>
<br>
(BTW, it's probably appropriate to move further discussion to the LLVMDev list rather than llvm-commits.)<br>
<br>
Thanks,<br>
Andy<br>
<br>
<br>
-----Original Message-----<br>
From: <a href="mailto:llvm-commits-bounces@cs.uiuc.edu">llvm-commits-bounces@cs.uiuc.edu</a> [mailto:<a href="mailto:llvm-commits-bounces@cs.uiuc.edu">llvm-commits-bounces@cs.uiuc.edu</a>] On Behalf Of Gaël Thomas<br>
Sent: Wednesday, November 13, 2013 6:09 AM<br>
To: <a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
Subject: (Very) small patch for the jit event listener<br>
<br>
Hi all,<br>
<br>
We have a small problem for vmkit. We rely on the JITEventListener to register the safepoints generated for the garbage collector, and for that purpose, we have to use the JITCodeEmitter (the<br>
MachineCodeEmitter) that was used to generate the MachineFunction in order to find the physical address of the safepoints (aka, the MCSymbols). A long time ago, it was not a problem as the JIT class was in the llvm interface, but today, the header is hidden
inside the lib directory and not installed by llvm. Currently, we directly use this header, but it means that during the compilation of vmkit, we need the sources of llvm. But, as we are currently developing a debian package of vmkit, we would like to avoid
the installation of the llvm sources to compile vmkit.<br>
<br>
So, I made a small patch that just adds a new MachineCodeEmitter field in JITEvent_EmittedFunctionDetails and fill it in JITCodeEmitter. As the patch only adds a new field in the JITEvent_EmittedFunctionDetails, it should not break anything. At least, my llvm
and my vmkit are still running :) (by the way, I had to execute a make clean before recompiling llvm because I think that a dependency is missing)<br>
<br>
As it is my first patch, I hope that I have used the llvm coding style...<br>
<br>
See you,<br>
Gaël<br>
<br>
<br>
<br>
<br>
<br>
<br>
--<br>
-------------------------------------------------------------------<br>
Gaël Thomas, Associate Professor, UPMC<br>
<a href="http://pagesperso-systeme.lip6.fr/Gael.Thomas/" target="_blank">http://pagesperso-systeme.lip6.fr/Gael.Thomas/</a><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" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><o:p></o:p></p>
</blockquote>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
</body>
</html>