bytecodealliance / bytecodealliance/wit-bindgen
too many locals: locals exceed maximum when running component new
- Dominant language
- Rust
- Stars
- 1.5k
- Forks
- 286
- Avg merge
- 6h 32m
- Merged PRs (30d)
- 19
Description
I'm trying to convert a component but I run into an error when running the following command:
```sh
wasm-tools component new target/wasm32-wasi/debug/fundamental_analyzer_template.wasm -o fundament-component.wasm --adapt wasi_snapshot_preview1.reactor.wasm
```
The error is as follows:
```
error: failed to encode a component from module
Caused by:
0: failed to validate component output
1: too many locals: locals exceed maximum (at offset 0x764c)
```
The error is caused thrown at this line https://github.com/bytecodealliance/wasm-tools/blob/188de0fd412dd01dd41bf91c897935934282c13d/crates/wasmparser/src/validator/operators.rs#L287 and is caused by the `MAX_WASM_FUNCTION_LOCALS` which is set to `50000`.
When I increase the `MAX_WASM_FUNCTION_LOCALS` constant the problem goes away, but it doesn't seem right that I have more than `50000` local functions.
The wasm file is generated based on this wit definition: https://github.com/jeroenvervaeke/wit-issue-reproducer/blob/master/wit/fundaments_analyzer.wit
The full reproducer can be found here: https://github.com/jeroenvervaeke/wit-issue-reproducer
These are the commands to run to if you want to reproduce the issue locally: https://github.com/jeroenvervaeke/wit-issue-reproducer/blob/master/build-component.sh
Do you think this is an issue with the generated WIT code, or is it expected that this many local functions are generated?
If it's expected that so many local functions are generated, should `MAX_WASM_FUNCTION_LOCALS` be increased?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.