# wasm: free unused locals · gitcafe/zig

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

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

Visibility: public

Requested revision: b42ba7c3d411cde31ede290b3915150c3e8acfbb

Requested commit: b42ba7c3d411cde31ede290b3915150c3e8acfbb

Commit: b42ba7c3d411cde31ede290b3915150c3e8acfbb

Tree: e30ba3182d14b7936c5245b543799ce64cb10362

Author: Luuk de Gram

Committer: Luuk de Gram

## Message

```
wasm: free unused locals

When a local is no longer referenced or used, free it
so the local can be re-used by another instruction.
This means we generate less locals. Freeing this local
is a manual action and must only be used on temporaries
or where we are sure the local is not referenced by a
different AIR instruction, as that creates UB.

We now also no longer store a `WValue` when its tag is set to `none`
as those may never be referenced by any AIR instruction.
An assertion is done to make sure we never store a reference to a
`stack` value in our resolved instructions.

```

## Parents

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

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