<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>Jordon,</p>
<p><br>
</p>
<p>I just submitted a change to the docs to hopefully address your
confusion. Can you take a look and let me know if you have
further questions? Start with the revised Stack Map Format
section.</p>
<p><br>
</p>
<p>Philip</p>
<p><br>
</p>
<p>p.s. I just submitted this and it'll take a few minutes to
refresh. In the meantime, you could look at the diff for 346405.<br>
</p>
<p><br>
</p>
<div class="moz-cite-prefix">On 11/2/18 2:52 PM, Jordan Rudd via
llvm-dev wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CY1PR19MB0030090EBD9169C3713C2AA6C7CF0@CY1PR19MB0030.namprd19.prod.outlook.com">
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
<div style="font-family: Calibri, Helvetica, sans-serif;
font-size: 12pt; color: rgb(0, 0, 0);">
Note: These instructions seem to be targeted towards people
creating a JIT. My compiler compiles to native. I suppose I just
need a reference to the stack location of the stack map,
wherever that is.</div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font style="font-size:11pt"
face="Calibri, sans-serif" color="#000000"><b>From:</b>
llvm-dev <a class="moz-txt-link-rfc2396E" href="mailto:llvm-dev-bounces@lists.llvm.org"><llvm-dev-bounces@lists.llvm.org></a> on behalf of
Jordan Rudd via llvm-dev <a class="moz-txt-link-rfc2396E" href="mailto:llvm-dev@lists.llvm.org"><llvm-dev@lists.llvm.org></a><br>
<b>Sent:</b> Thursday, November 1, 2018 2:06 PM<br>
<b>To:</b> <a class="moz-txt-link-abbreviated" href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a><br>
<b>Subject:</b> [llvm-dev] Building GC on statepoint-example</font>
<div> </div>
</div>
<meta content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none">
<!--
p
{margin-top:0;
margin-bottom:0}
-->
</style>
<div dir="ltr">
<div style="font-family:Calibri,Helvetica,sans-serif;
font-size:12pt; color:rgb(0,0,0)">
Hi,</div>
<div style="font-family:Calibri,Helvetica,sans-serif;
font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;
font-size:12pt; color:rgb(0,0,0)">
I'm trying to build a gc using the statepoint-example
strategy. However, after hours of searching, reading
documentation and trying to find code examples online, I
cannot figure out how to access the Stack Map.</div>
<div style="font-family:Calibri,Helvetica,sans-serif;
font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;
font-size:12pt; color:rgb(0,0,0)">
The documentation for statepoint-example says:</div>
<div style="font-family:Calibri,Helvetica,sans-serif;
font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;
font-size:12pt; color:rgb(0,0,0)">
<i><span style="font-family:"Lucida
Grande","Lucida Sans
Unicode",Geneva,Verdana,sans-serif; font-size:14px;
text-align:left; background-color:rgb(255,255,255);
display:inline!important">The stack map format generated
by this GC strategy can be found in the<span> </span></span><a
href="https://nam03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fllvm.org%2Fdocs%2FStackMaps.html%23stackmap-section&data=02%7C01%7C%7Ce9642625652f4a29fc1f08d6403dfa73%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636767032264647521&sdata=2cqSbyrmgxWfRh95yvOnwU6v42J1HRxI7dPwkSLARTY%3D&reserved=0"
originalsrc="https://llvm.org/docs/StackMaps.html#stackmap-section"
shash="VEGTjfCHpcYeYznX8jdBUdLzAI7QOw6YKFpYgAzyx96kYQZjAGC50JFOdpYfGrMHCl8ppZ1/gmJn7y7VXBPQ03pAaxsXlXodGEgbavdDWyifzHwSRgpZ5fgVpTch3aJlgiU8jQ6h3A/Y0cmyByKynLbBpY1fKjW/41sl5E9JjAg="
style="color:rgb(202,121,0); text-decoration:underline;
font-family:"Lucida Grande","Lucida Sans
Unicode",Geneva,Verdana,sans-serif; font-size:14px;
text-align:left; background-color:rgb(255,255,255)"
moz-do-not-send="true"><span>Stack Map Section</span></a><span
style="font-family:"Lucida Grande","Lucida
Sans Unicode",Geneva,Verdana,sans-serif;
font-size:14px; text-align:left;
background-color:rgb(255,255,255);
display:inline!important"><span> </span>using a format
documented<span> </span></span><a
href="https://nam03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fllvm.org%2Fdocs%2FStatepoints.html%23statepoint-stackmap-format&data=02%7C01%7C%7Ce9642625652f4a29fc1f08d6403dfa73%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636767032264647521&sdata=FhoqamuJExS4ZPyk4i2xnHkGS6A13f0v4wIszJ5oBRE%3D&reserved=0"
originalsrc="https://llvm.org/docs/Statepoints.html#statepoint-stackmap-format"
shash="fPdsayL0G00r1X/ig1NNrVkyejjKWBfw1LvIRhzBdrbBYC3fMYoUz0QhztdzjGXtFkT773DEJ1+ppgqqWQVSTOe7kfuvH/9EwT5PMWqqPQi2K3OkAwx/8J+5xl7Lkm0QOUByMsKY88BcnIKAQ9zL+FIRyhzyiUFzxkzUIeKRW88="
style="color:rgb(202,121,0); text-decoration:underline;
font-family:"Lucida Grande","Lucida Sans
Unicode",Geneva,Verdana,sans-serif; font-size:14px;
text-align:left; background-color:rgb(255,255,255)"
moz-do-not-send="true"><span>here</span></a><span
style="font-family:"Lucida Grande","Lucida
Sans Unicode",Geneva,Verdana,sans-serif;
font-size:14px; text-align:left;
background-color:rgb(255,255,255);
display:inline!important">. This format is intended to be
the standard format supported by LLVM going forward.</span></i><br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;
font-size:12pt; color:rgb(0,0,0)">
<span style="font-family:"Lucida
Grande","Lucida Sans
Unicode",Geneva,Verdana,sans-serif; font-size:14px;
text-align:left; background-color:rgb(255,255,255);
display:inline!important"><br>
</span></div>
<div style="font-family:Calibri,Helvetica,sans-serif;
font-size:12pt; color:rgb(0,0,0)">
<span style="font-family:"Lucida
Grande","Lucida Sans
Unicode",Geneva,Verdana,sans-serif; font-size:14px;
text-align:left; background-color:rgb(255,255,255);
display:inline!important">Ok, great, I see the format.
But... how do I access the Stack Map from my runtime? Where
is it? </span></div>
<div style="font-family:Calibri,Helvetica,sans-serif;
font-size:12pt; color:rgb(0,0,0)">
<span style="font-family:"Lucida
Grande","Lucida Sans
Unicode",Geneva,Verdana,sans-serif; font-size:14px;
text-align:left; background-color:rgb(255,255,255);
display:inline!important"><br>
</span></div>
<div style="font-family:Calibri,Helvetica,sans-serif;
font-size:12pt; color:rgb(0,0,0)">
<span style="font-family:"Lucida
Grande","Lucida Sans
Unicode",Geneva,Verdana,sans-serif; font-size:14px;
text-align:left; background-color:rgb(255,255,255);
display:inline!important">The link seems to send me to this
instruction:</span></div>
<div style="font-family:Calibri,Helvetica,sans-serif;
font-size:12pt; color:rgb(0,0,0)">
<span style="font-family:"Lucida
Grande","Lucida Sans
Unicode",Geneva,Verdana,sans-serif; font-size:14px;
text-align:left; background-color:rgb(255,255,255);
display:inline!important"><br>
</span></div>
<div style="font-family:Calibri,Helvetica,sans-serif;
font-size:12pt; color:rgb(0,0,0)">
<span style="font-family:"Lucida
Grande","Lucida Sans
Unicode",Geneva,Verdana,sans-serif; font-size:14px;
text-align:left; background-color:rgb(255,255,255);
display:inline!important"><i><span style="font-size:14px;
background-color:rgb(255,255,255);
display:inline!important">A JIT compiler can easily
access this section by providing its own memory manager
via the LLVM C API</span><code
style="font-family:Consolas,"Deja Vu Sans
Mono","Bitstream Vera Sans
Mono",monospace; font-size:0.95em;
background-color:rgb(255,255,255)"><span style="">LLVMCreateSimpleMCJITMemoryManager()</span></code><span
style="font-size:14px;
background-color:rgb(255,255,255);
display:inline!important">. When creating the memory
manager, the JIT provides a callback:</span><code
style="font-family:Consolas,"Deja Vu Sans
Mono","Bitstream Vera Sans
Mono",monospace; font-size:0.95em;
background-color:rgb(255,255,255)"><span style="">LLVMMemoryManagerAllocateDataSectionCallback()</span></code><span
style="font-size:14px;
background-color:rgb(255,255,255);
display:inline!important">. When LLVM creates this
section, it invokes the callback and passes the section
name.</span></i><br>
</span></div>
<div style="font-family:Calibri,Helvetica,sans-serif;
font-size:12pt; color:rgb(0,0,0)">
<span style="font-family:"Lucida
Grande","Lucida Sans
Unicode",Geneva,Verdana,sans-serif; font-size:14px;
text-align:left; background-color:rgb(255,255,255);
display:inline!important"><span style="font-size:14px;
background-color:rgb(255,255,255);
display:inline!important"><br>
</span></span></div>
<div style="color:rgb(0,0,0)"><font face="Lucida Grande, Lucida
Sans Unicode, Geneva, Verdana, sans-serif"><span
style="font-size:14px">None of these API's are
well-documented, so I'm kind of trying to guess what to do
here. As a proof of concept, I tried building a do-nothing
memory manager that
calls APILLVMCreateSimpleMCJITMemoryManager on static
initialization and passes the callbacks to it. I link the
necessary llvm libs into my runtime and fire it up.<br>
<br>
I can confirm that my safepoint poll code is getting hit.
I can confirm that creating the "memory manager" is called
on runtime boot and that it's succeeding. But the
callbacks never get hit. Even if they were, it's unclear
how I would use the parameters of those callbacks to
locate the stack map.</span></font></div>
<div style="color:rgb(0,0,0)"><font face="Lucida Grande, Lucida
Sans Unicode, Geneva, Verdana, sans-serif"><span
style="font-size:14px"><br>
</span></font></div>
<div style="color:rgb(0,0,0)"><font face="Lucida Grande, Lucida
Sans Unicode, Geneva, Verdana, sans-serif"><span
style="font-size:14px">What am I missing? </span></font></div>
<div style="color:rgb(0,0,0)"><font face="Lucida Grande, Lucida
Sans Unicode, Geneva, Verdana, sans-serif"><span
style="font-size:14px"><br>
</span></font></div>
<div style="color:rgb(0,0,0)"><font face="Lucida Grande, Lucida
Sans Unicode, Geneva, Verdana, sans-serif"><span
style="font-size:14px">Thanks!</span></font></div>
<div style="color:rgb(0,0,0)"><font face="Lucida Grande, Lucida
Sans Unicode, Geneva, Verdana, sans-serif"><span
style="font-size:14px">Jordan</span></font></div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
LLVM Developers mailing list
<a class="moz-txt-link-abbreviated" href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>
<a class="moz-txt-link-freetext" href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a>
</pre>
</blockquote>
</body>
</html>