[LLVMdev] Correlating stack map with call frames.

Philip Reames listmail at philipreames.com
Fri Aug 1 14:27:13 PDT 2014


Pawel,

Sorry for taking so long to reply.  I just stumbled across your email 
again and realized I'd never gotten around to responding.

I would suggest that you not attempt to use the existing gc_root 
mechanism provided by LLVM today.  It's buggy, not well supported, and 
essentially no one uses it.  I am actively hoping to kill it within the 
near future.

I'd recommend taking a look at the work we've been doing on safepoint 
placement here: 
https://github.com/AzulSystems/llvm-late-safepoint-placement.  The 
actual late safepoint placement pass is still under active development 
and isn't necessarily ready for general use (though feedback is 
appreciated!), but the supporting infrastructure is fairly mature at 
this point.

If you're willing to do eager safepoint insertion in your IR generator, 
everything should work fairly reliably.  In particular, the data your 
original question asked would be available in the StackMap section which 
is fairly well documented.  All you'd need to do would be write a 
parser.  (Well, and fix/report any bugs you might encounter..)

Philip

On 06/02/2014 03:24 PM, Paweł Batko wrote:
> Hi all,
>
> I'm writing a GC plugin, targeting x86_64. I'm stuck on handling stack 
> maps. I generate assembly for them like in the documentation: 
> http://llvm.org/docs/GarbageCollection.html#emitting-assembly-code-gcmetadataprinter 
> and now I'm trying to figure out the best way to correlate stack maps 
> with call frames.
> I have an idea to put a label before every stack map entry and then 
> put the address of this label within well known offset from the 
> function. Then, while walking the call stack and having function 
> address I could retrieve relevant stack map entry..
> My current approach to generating the label for stack map entries 
> looks like this:
> MCSymbol *ala = AP.OutContext.GetOrCreateSymbol(StringRef("ala"));
> OS.EmitLabel(ala);
> But then, I don't know how to emit the address of the label near the 
> function. I mean, I think I'd use something like this 
> 'OS.EmitSymbolValue(ala, 4)', but I'm not sure where I should hook 
> into to achieve this.
>
> Note that I'm fairly new to LLVM and the approach I described above 
> does not necessarily make much sense. I'd pleased to hear the proper 
> way to handle stack maps.
>
> Regards,
> Paweł
>
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

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


More information about the llvm-dev mailing list