[PATCH]Segmented-Stack for Android

ilyong cho ily.cho at samsung.com
Tue Mar 19 22:59:50 PDT 2013


Resend this mail because previous mail I'v sent look bad

--------------------
Hi,

Please consider a patch in attachment, and there is also a sample implementation of __morestack()

This patch is to enable llvm to emit segmented-stack prologue for android platform. The main modification is implementation of ARMFrameLowering::adjustForSegmentedStacks() to inject code into function proglogues that calls __morestack() when required stack size is larger than current space.

This implementation is only for arm-linux-android that has CP15 register. The stack limit should be saved in the last TLS slot (64th slot in case of android) before function invocations.
Actually, AFAIK, Android platform does not save stack limits into TLS. so we need special mechanism to do it. In other words, you may need another layer that provides that kind of service(push stack limit into TLS) to enable segmented stack on Android platform.

I think this can be improved in various aspects.
- Improve performace by using less registers and instructions.
- This patch only uses the last TLS slot. but there may be better approaches. (if android platrom becomes manage the stack limits in a particular manner, It'd better to follow that approach)

I think this patch is not a perfect one, but can be a start point.
If you have opinion about this patch, please let me know.

ILYONG CHO.
ilyoan at gmail.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: android_segmented_stack.txt
Type: application/octet-stream
Size: 20172 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130320/97b1c3e2/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: morestack.S
Type: application/octet-stream
Size: 1413 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130320/97b1c3e2/attachment-0001.obj>


More information about the llvm-commits mailing list