[LLVMdev] Segmented Stack Implementation

Sanjoy Das sanjoy at playingwithpointers.com
Fri Nov 14 17:58:31 PST 2014


Hi,

> Does the segmented stack implementation on x86 perform any frame
> copying?

Can you clarify what you mean by frame copying?  Are you talking about
expanding the thread stack in the same way an std::vector expands its
backing storage?  I think you can, in principle, do this by providing
your own _morestack.  However ...

> After skimming some of the code, it appears that it does not. Is the
> possibility of aliasing the stack the only reason why we do not do
> copying?

In general, I don't think we can safely copy around thread stacks or
frames.  Even if your programming language guarantees that stack
locations never escape, there is no reason why llvm can't generate
code to, say, keep around (%rsp + 32) in %r13 across a call that can
expand the stack.

-- Sanjoy



More information about the llvm-dev mailing list