# stage2: fix passing arguments on the stack · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/df6c0067b26ca1b6798612631b26b167e9fe287a)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: df6c0067b26ca1b6798612631b26b167e9fe287a

Requested commit: df6c0067b26ca1b6798612631b26b167e9fe287a

Commit: df6c0067b26ca1b6798612631b26b167e9fe287a

Tree: d91929d74928788a0db8f0626b9772ea3a5edccb

Author: Jakub Konka

Committer: Jakub Konka

## Message

```
stage2: fix passing arguments on the stack

* push the arguments in reverse order
* add logic for pushing args of any abi size to stack - very similar to
  `genSetStack` however, uses `.rsp` as the base register
* increment and decrement `.rsp` if we called a function with args on
  the stack in `airCall`
* add logic for recovering args from the caller's stack in the callee

```

## Parents

- [7c6981e0c0f2412c49457a900e5a6a4db96be2e8](https://git.cafe/gitcafe/zig/commit/7c6981e0c0f2412c49457a900e5a6a4db96be2e8?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/df6c0067b26ca1b6798612631b26b167e9fe287a?format=markdown)
