Translate from function-body index to function-index-space index.
The wasm function index space consists of the index space of the imported functions concatenated with the index space of the defined functions. When iterating through function definitions, it's necessary to adjust the index when a function-index-space index is needed.
This commit is contained in:
@@ -569,7 +569,8 @@ impl<'data, 'module> ModuleTranslation<'data, 'module> {
|
||||
) -> Result<(Compilation<'module>, Relocations), String> {
|
||||
let mut functions = Vec::new();
|
||||
let mut relocations = Vec::new();
|
||||
for (func_index, input) in self.lazy.function_body_inputs.iter().enumerate() {
|
||||
for (i, input) in self.lazy.function_body_inputs.iter().enumerate() {
|
||||
let func_index = i + self.module.imported_funcs.len();
|
||||
let mut context = cretonne_codegen::Context::new();
|
||||
context.func.name = get_func_name(func_index);
|
||||
context.func.signature = self.module.signatures[self.module.functions[func_index]]
|
||||
|
||||
Reference in New Issue
Block a user