Minor code simplification. NFC.
This commit is contained in:
@@ -1,4 +1,3 @@
|
|||||||
use cretonne::ir;
|
|
||||||
use cretonne::settings;
|
use cretonne::settings;
|
||||||
use cretonne::settings::Configurable;
|
use cretonne::settings::Configurable;
|
||||||
use faerie::Artifact;
|
use faerie::Artifact;
|
||||||
@@ -25,16 +24,7 @@ pub fn emit_module<'module>(
|
|||||||
for (i, function_relocs) in relocations.iter().enumerate() {
|
for (i, function_relocs) in relocations.iter().enumerate() {
|
||||||
assert!(function_relocs.is_empty(), "relocations not supported yet");
|
assert!(function_relocs.is_empty(), "relocations not supported yet");
|
||||||
let body = &compilation.functions[i];
|
let body = &compilation.functions[i];
|
||||||
let external_name =
|
let func_index = compilation.module.imported_funcs.len() + i;
|
||||||
wasmstandalone_runtime::get_func_name(compilation.module.imported_funcs.len() + i);
|
|
||||||
let func_index = match external_name {
|
|
||||||
ir::ExternalName::User { namespace, index } => {
|
|
||||||
debug_assert!(namespace == 0);
|
|
||||||
index
|
|
||||||
}
|
|
||||||
_ => panic!(),
|
|
||||||
};
|
|
||||||
|
|
||||||
let string_name = format!("wasm_function[{}]", func_index);
|
let string_name = format!("wasm_function[{}]", func_index);
|
||||||
|
|
||||||
obj.define(string_name, body.clone()).map_err(|err| {
|
obj.define(string_name, body.clone()).map_err(|err| {
|
||||||
|
|||||||
Reference in New Issue
Block a user