# wasm: Implement \`@wasmMemorySize\(\)\` builtin · gitcafe/zig

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

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

Visibility: public

Requested revision: ec4c30ae483e6700a1fd1d5edaadbb042790c52e

Requested commit: ec4c30ae483e6700a1fd1d5edaadbb042790c52e

Commit: ec4c30ae483e6700a1fd1d5edaadbb042790c52e

Tree: 72a0cc5ffcf656a1654cd3adbf7fd3d6f06aa525

Author: Luuk de Gram

Committer: Andrew Kelley

## Message

```
wasm: Implement `@wasmMemorySize()` builtin

This implements the `wasmMemorySize` builtin, in Sema and the Wasm backend.
The Stage2 implementation differs from stage1 in the way that `index` must be a comptime value.
The stage1 variant is incorrect, as the index is part of the instruction encoding, and therefore,
cannot be a runtime value.

```

## Parents

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

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