<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Jun 7, 2014 at 8:51 AM, David Chisnall <span dir="ltr"><<a href="mailto:David.Chisnall@cl.cam.ac.uk" target="_blank">David.Chisnall@cl.cam.ac.uk</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="">On 6 Jun 2014, at 19:10, Sean Silva <<a href="mailto:chisophugis@gmail.com">chisophugis@gmail.com</a>> wrote:<br>

<br>
> Off the top of my head, the changes needed are:<br>
><br>
> - A read-through of StackMaps.rst to remove any mention of it being experimental.<br>
> - Removing mention of it being experimental from <a href="http://llvm.org/docs/LangRef.html#stack-map-intrinsics" target="_blank">http://llvm.org/docs/LangRef.html#stack-map-intrinsics</a><br>
> - Removing the `.experimental` from the name.<br>
><br>
> Anything else?<br>
<br>
</div>Not a blocker, but I'd really like to see someone who understands this code write a simple tutorial for it.</blockquote><div><br></div><div>A tutorial for this feature would mostly overlap with an MCJIT tutorial. I believe it would be better to have a good MCJIT tutorial and then a separate page describing the key places where the plain MCJIT tutorial would need to be modified to utilize the stack map functionality.<br>
</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">  The current documentation expects a lot of prior knowledge.<br></blockquote><div>
<br>Well, making any use of the feature basically requires the user to patch machine-code, and IMO that's the biggest hurdle (teaching machine-code patching certainly isn't germane for a document targeted at a specific LLVM feature).<br>
<br>For someone already familiar at a machine-code level with their architecture of interest, then the feature is conceptually extremely simple: it just gives you some guarantees about the structure of the machine code at particular addresses and also gives you information about where IR-level values are stored at run-time. More precisely:<br>
</div><div>- Both llvm.experimental.stackmap and llvm.experimental.patchpoint can record the run-time location of IR-level values.<br></div><div>- Both can reserve space (a "shadow") in the machine code, but with different guarantees: llvm.experimental.patchpoint makes sure that the reserved region doesn't contain any other code besides a call of your choosing (and nops if needed), while llvm.experimental.stackmap just ensures (with nops if needed) that if you overwrite that space that you will not be writing outside the function itself (this is meant for destructively patching the following machine code).<br>
</div><div>These bullets are basically just a rehashing of: <a href="http://llvm.org/docs/StackMaps.html#intrinsics">http://llvm.org/docs/StackMaps.html#intrinsics</a><br><br>For someone comfortable patching machine code, the only difficulty I can imagine are just janitorial details (such as setting up MCJIT or processing the stack map data structure) to get snagged on, which can be covered in a targeted (not tutorial) way.<br>
<br></div><div>-- Sean Silva<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<span class=""><font color="#888888"><br>
David<br>
<br>
</font></span></blockquote></div><br></div></div>