aboutsummaryrefslogtreecommitdiff
path: root/test/behavior/array_llvm.zig
diff options
context:
space:
mode:
authorLuuk de Gram <luuk@degram.dev>2022-02-03 21:31:35 +0100
committerLuuk de Gram <luuk@degram.dev>2022-02-03 21:53:48 +0100
commite35414bf5c356798f201be85303101f59220326c (patch)
tree88e88220419d4f11ed00d02544337974ff99eef4 /test/behavior/array_llvm.zig
parentae1e3c8f9bc86eeefb5a83233884a134f7b974f4 (diff)
downloadzig-e35414bf5c356798f201be85303101f59220326c.tar.gz
zig-e35414bf5c356798f201be85303101f59220326c.zip
wasm: Refactor stack to account for alignment
We now calculate the total stack size required for the current frame. The default alignment of the stack is 16 bytes, and will be overwritten when the alignment of a given type is larger than that. After we have generated all instructions for the body, we calculate the total stack size by forward aligning the stack size while accounting for the max alignment. We then insert a prologue into the body, where we substract this size from the stack pointer and save it inside a bottom stackframe local. We use this local then, to calculate the stack pointer locals of all variables we allocate into the stack. In a future iteration we can improve this further by storing the offsets as a new `stack_offset` `WValue`. This has the benefit of not having to spend runtime cost of storing those offsets, but instead we append those offsets whenever we need the value that lives in the stack.
Diffstat (limited to 'test/behavior/array_llvm.zig')
0 files changed, 0 insertions, 0 deletions