Every story and comment from the Hacker News API, in a layout borrowed from 2001.
A comment on Understanding Hardware-Enforced Stack Protection. Parent comment
There may be multiple reasons but a performance reason of which I’m aware is downward stacks are more efficient for allocating aligned memory:
sp = (sp - size) & align;
sp += size; if (sp & (align - 1)) sp += align - (sp & (align - 1));
There are no comments on this comment yet.
There may be multiple reasons but a performance reason of which I’m aware is downward stacks are more efficient for allocating aligned memory:
That’s only two instructions, with a stack that grows upward: Which is a few more instructions. Of course you can alleviate this by requiring an alignment invariant in the ABI, which is usually done anyway.