-
Notifications
You must be signed in to change notification settings - Fork 274
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Running into wasm error: indirect call type mismatch
when using the compiler backend, but not the interpreter
#2313
Comments
Error: wasm error: indirect call type mismatch
when using the compiler backend, but not the interpreterwasm error: indirect call type mismatch
when using the compiler backend, but not the interpreter
looks like a bug - do you happen to have arm64 machine and being able to check if this happens on arm64 as well or not? |
I can run this on an arm64 mac later this evening and will let you know how it goes |
sg, thank you! |
Just ran it on arm64 macos and got the same result:
|
thanks, that helps - meaning i think this is not really a compiler but seems more of a "compiler engine" bug |
investigating a bit, so func
with type 22 being:
with the offset being 0. (I was suspecting some overflow but I don't think it is the case) I also tested against v1.6.0 (old compiler) and on arm64 the behavior is correct |
curious about old compiler with amd64... |
looks like it's working there as well (still investigating...) EDIT: I injected a UDF around the error, just to inspect the registers, apparently it's comparing 0x1 (r10) to 0x2 (r9)
|
humm, no luck so far, I turned the UDFs into BRKs, it's definitely loading 0x2, but the offsets seem ok to me, so I wonder if the table has been filled incorrectly. EDIT, hey wait a minute!
it is indeed type 2 in the other module. 🤔 maybe something funky here? wazero/internal/engine/wazevo/module_engine.go Lines 264 to 284 in 5848888
I think we should not copy over the typeID from the imported module, and just use the typeID of the import |
ok I should have a proper PR tomorrow with tests etc., the typeIDs would be propagated from the import signature, after verification |
Good |
Describe the bug
I am running a wasm module that uses
call_indirect
- when using the interpreter it runs successfully, but when using the compiler it fails withwasm error: indirect call type mismatch
- it also runs successfully on wasmtime, so I think this could be a compiler bug.To Reproduce
I've uploaded the wasm here: wasm.zip
Then using the extism CLI: https://github.com/extism/cli/ (can be installed by cloning the repo and running
go install ./extism
from the root of the repo)Note: the current CLI uses wazero 1.7, but I've also tested using the latest code on
main
with the same result.Expected behavior
The call should return successfully instead of throwing the type mismatch error
Environment (please complete the relevant information):
58488880a334e8bda5be0d715a24d8ddeb34c725
)Additional context
If I comment out lines 3558-3581 in
internal/engine/wazevo/frontend/lower.go
it works as expected.The text was updated successfully, but these errors were encountered: