diff options
Diffstat (limited to 'src/wasm-interpreter.h')
-rw-r--r-- | src/wasm-interpreter.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/wasm-interpreter.h b/src/wasm-interpreter.h index 107f38f09..65ffdbade 100644 --- a/src/wasm-interpreter.h +++ b/src/wasm-interpreter.h @@ -28,6 +28,7 @@ #include <sstream> #include <variant> +#include "ir/intrinsics.h" #include "ir/module-utils.h" #include "support/bits.h" #include "support/safe_integer.h" @@ -2757,7 +2758,14 @@ public: } auto* func = wasm.getFunction(curr->target); Flow ret; - if (func->imported()) { + if (Intrinsics(*self()->getModule()).isCallWithoutEffects(func)) { + // The call.without.effects intrinsic is a call to an import that actually + // calls the given function reference that is the final argument. + auto newArguments = arguments; + auto target = newArguments.back(); + newArguments.pop_back(); + ret.values = callFunctionInternal(target.getFunc(), newArguments); + } else if (func->imported()) { ret.values = externalInterface->callImport(func, arguments); } else { ret.values = callFunctionInternal(curr->target, arguments); |