From 9e601c42f9c29cdf3d245e3a22edace694f963d2 Mon Sep 17 00:00:00 2001 From: Mark McCaskey Date: Thu, 4 Apr 2019 09:29:30 -0700 Subject: [PATCH] change func_index offset by number of imported funcs --- lib/clif-backend/src/module_env.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/clif-backend/src/module_env.rs b/lib/clif-backend/src/module_env.rs index 7c6cd6731ad..f8806f46082 100644 --- a/lib/clif-backend/src/module_env.rs +++ b/lib/clif-backend/src/module_env.rs @@ -530,7 +530,10 @@ impl<'module, 'isa, 'data> ModuleEnvironment<'data> for ModuleEnv<'module, 'isa> .special_param(ir::ArgumentPurpose::VMContext) .expect("missing vmctx parameter"); - let func_index = pos.ins().iconst(ir::types::I32, func_index.index() as i64); + let func_index = pos.ins().iconst( + ir::types::I32, + func_index.index() as i64 + self.module.info.imported_functions.len() as i64, + ); pos.ins().call(start_debug, &[vmctx, func_index]);