saving stack space on ppc64le

113 views
Skip to first unread message

Michael Hudson-Doyle

unread,
Aug 24, 2016, 7:33:46 PM8/24/16
to David Chase, golang-dev
Hi,

The reason that ppc64le uses more stack space that other platforms is (mostly) that the smallest possible stack frame is 32 bytes. The reason for that is that, when dynamically linking, the platform ABI (as encoded in the PLT stubs the host linker generates) assumes that the TOC pointer (r2) can be saved at 24(SP). So currently the stack frame looks like

 ...  |   ...    |
SP+32 |  locals  |
SP+24 | saved r2 | 
SP+16 |  nothing |
SP+8  |  nothing |
SP    | saved LR | 

If we want to use the stack more efficiently, we could use [SP+8, SP+24) for locals. (The platform ABI has opinions about what [SP, SP+24) is used for but they don't matter for Go to Go calls, and in fact we're already saving the LR in the "wrong" place).

I don't know how much of a pain this would be to implement. Fiddly, probably, but maybe not too bad. I doubt I can make time for it, but I thought I should mention it!

Cheers,
mwh

Reply all
Reply to author
Forward
0 new messages