Skip to content

Fix cross-module call_indirects in the interpreter#7964

Merged
kripken merged 3 commits into
WebAssembly:mainfrom
kripken:call_indirect.cross.module
Oct 9, 2025
Merged

Fix cross-module call_indirects in the interpreter#7964
kripken merged 3 commits into
WebAssembly:mainfrom
kripken:call_indirect.cross.module

Conversation

@kripken
Copy link
Copy Markdown
Member

@kripken kripken commented Oct 9, 2025

It was using the name of the function to look up the funcref in the current
module. Instead, use doCall so we can call another module's function.

@kripken kripken requested a review from tlively October 9, 2025 20:33
Comment thread src/wasm-interpreter.h

auto* func = self()->getModule()->getFunction(funcref.getFunc());
if (!HeapType::isSubType(func->type, curr->heapType)) {
if (!HeapType::isSubType(funcref.type.getHeapType(), curr->heapType)) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Let's add a TODO about throwing a non-constant exception here if the reference is to an imported function that has a supertype of the expected type.

@kripken kripken merged commit a76b8ad into WebAssembly:main Oct 9, 2025
16 checks passed
@kripken kripken deleted the call_indirect.cross.module branch October 9, 2025 23:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants