Skip to content

Make initial size of interpreter stacks configurable #43

Open
@FedorSmirnov89

Description

@FedorSmirnov89

Description

Currently, the TinyWasm interpreter pre-allocates a fixed/hardcoded amount of memory for its stacks. While this works well in general-purpose environments, it poses challenges for constrained targets—particularly embedded systems.

Concretely, I had the problem of not being able to run tw on an nrf53 due to OOM panics, until I reduced the initial size of the interpreter stacks.

This issue proposes making the interpreter's value stack size configurable by the user. This would:

  • Allow embedded developers to tune memory usage based on available resources.
  • Enable to address scenarios where the characteristics of the Wasm modules relevant for the target are known ahead of time (e.g., if they use only 32-bit values) by optimizing the pre-allocated stacks to the expected program type.

The proposed change is backward-compatible and would not affect users who rely on the default stack size.

Note that this does not remedy the problem described in #42 : The stacks still grow dynamically and a Wasm module requiring enough memory on the interpreter side can still crash the program via an OOM panic.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions