[LLVMdev] Stack maps no longer experimental in 3.5

Sean Silva chisophugis at gmail.com
Sat Jun 7 13:06:28 PDT 2014


On Sat, Jun 7, 2014 at 8:51 AM, David Chisnall <David.Chisnall at cl.cam.ac.uk>
wrote:

> On 6 Jun 2014, at 19:10, Sean Silva <chisophugis at gmail.com> wrote:
>
> > Off the top of my head, the changes needed are:
> >
> > - A read-through of StackMaps.rst to remove any mention of it being
> experimental.
> > - Removing mention of it being experimental from
> http://llvm.org/docs/LangRef.html#stack-map-intrinsics
> > - Removing the `.experimental` from the name.
> >
> > Anything else?
>
> Not a blocker, but I'd really like to see someone who understands this
> code write a simple tutorial for it.


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.


>  The current documentation expects a lot of prior knowledge.
>

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).

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:
- Both llvm.experimental.stackmap and llvm.experimental.patchpoint can
record the run-time location of IR-level values.
- 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).
These bullets are basically just a rehashing of:
http://llvm.org/docs/StackMaps.html#intrinsics

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.

-- Sean Silva


>
> David
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140607/e97a223e/attachment.html>


More information about the llvm-dev mailing list