Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 8 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,11 @@ micromath = "2.1.0"
postcard = "1.0.8"
serde = { version = "1.0.203", default-features = false, features = ["derive"] }
tinyqr = "0.14.1"
wasmi = { version = "1.0.9", default-features = false }
wasmi = { version = "2.0.0-beta.1", default-features = false }

[profile.dev.package.wasmi]
opt-level = 2
codegen-units = 1
Comment on lines +23 to +25
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do I need to also set it in all projects that use the crate?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found the answer myself: Yes 🙃

thread 'main' (733177) has overflowed its stack
fatal runtime error: stack overflow, aborting
[1]    733177 IOT instruction (core dumped)  cargo run

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, no, it doesn't help, I still get Stack Overflow in the emulator even with optimizations enabled.

Copy link
Contributor Author

@Robbepop Robbepop Feb 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's an extremely good question. I'd say it is mostly important for the final binary.
For testing you could also use Wasmi's new portable-dispatch crate feature. It executes way slower, but at least it works universally.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you try:

[profile.release]
opt-level = 3
codegen-units = 1

in your emulator?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried that as well, same result.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Last option is to enable Wasmi's portable-dispatch crate feature. Execution performance will likely suffer but at least it is universally applicable.


[profile.release]
codegen-units = 1