Page MenuHomePhabricator

[WebAssembly] Implement red zone for user stack

Authored by dschuff on Feb 22 2016, 2:59 PM.



Implements a mostly-conventional redzone for the userspace
stack. Because we have unsigned load/store offsets we continue to use a
local SP subtracted from the incoming SP but do not write it back to

Diff Detail

Event Timeline

dschuff updated this revision to Diff 48739.Feb 22 2016, 2:59 PM
dschuff retitled this revision from to [WebAssembly] Implement red zone for user stack.
dschuff updated this object.
dschuff added reviewers: sunfish, jfb.
dschuff added a subscriber: llvm-commits.

The redzone size of 128 matches some real targets, but unlike those we don't yet have to worry about exception handlers (and in any case they could use another stack). Given that, (and the overflow behavior is the same either way), is there any reason not to make the red zone larger? It seems like infinite size might be bad but not sure what a useful limit would be.

sunfish accepted this revision.Feb 23 2016, 6:49 AM
sunfish edited edge metadata.

LGTM. Please add brief description comments for needsSP and needsSPWriteback.

What the size should be is a good question. I think it makes sense to leave it at 128 for now -- big enough to be useful, but not so big that we won't get some test coverage of the non-redzone case in this early phase of development. A TODO comment or so to remind us to go back and revisit this would be good. Perhaps we should start a convention of an "ABI" comment, for things we should re-evaluate before declaring a stable ABI.

This revision is now accepted and ready to land.Feb 23 2016, 6:49 AM
This revision was automatically updated to reflect the committed changes.