[LLVMdev] [Segmented Stacks] Week 1
Sanjoy Das
sanjoy at playingwithpointers.com
Tue May 31 23:54:53 PDT 2011
On Wednesday 01 June 2011 02:25 AM, Rafael Avila de Espindola wrote:
> On 11-05-30 07:20 AM, Sanjoy Das wrote:
>> Hi!
>>
>> I've attached my first week of work as a patchset for review. This is
>> also available on Github [1].
>>
>> By next Monday I intend to (more or less) finish up the preliminary
>> parts concerning the codegen; and start working on the runtime (so that
>> I can do a basic sanity check).
>
> Thanks!. Some quick notes
>
> *) Maybe you could add the description you used for the GSoC to the
> segmented-stacks document too? Maybe at the end and under a "not yet
> implemented" section, but having it all in one place is probably useful.
Okay, will do.
>
> *) You use "stack block" in some places and stacklets in others.
Will fix.
>
> *) You mention that variable sized alloca's are handled by using the
> heap. This is an interesting idea, but you have to be careful to avoid
> leaks if exceptions are enabled.
>
> *) If I remember correctly, you wanted to fold the red zone in the "do I
> need more stack" check, but I seed that you have a
> !EnableSegmentedStacks in the Red Zone check. Have you decided not to do
> it?
>
I want to get an rough version working ASAP (hopefully by next Monday);
after which I'll go on to implement support for the red zone.
About heap allocating allocas: I guessed we could just have the stacklet
cleanup function free all the alloca blocks associated with the stacklet
it is freeing (the stacklet will have a list of heap-allocated alloca
blocks). While this would not ensure that all such allocas are freed as
soon as possible; it will ensure that they are freed eventually so we
don't have a leak. Perhaps, at a later stage, code can be added that
frees the relevant alloca-heap blocks as the function returns; and only
if an exception was thrown will the "backup" mechanism of the cleanup
function freeing the blocks will be used.
> *) You intend for the runtime to be compatible with the gcc one? Their
> stack allocating function is called __morestack...
I'm not sure. Does it make sense to have a initial version that
generates calls the libgcc rather than compiler-rt?
--
Sanjoy Das
http://playingwithpointers.com
More information about the llvm-dev
mailing list