Simplify
This commit is contained in:
@@ -517,8 +517,9 @@ where
|
|||||||
ctx: &mut Context,
|
ctx: &mut Context,
|
||||||
peek_compiled: impl FnOnce(u32, &Context, &isa::TargetIsa) -> T,
|
peek_compiled: impl FnOnce(u32, &Context, &isa::TargetIsa) -> T,
|
||||||
) -> ModuleResult<T> {
|
) -> ModuleResult<T> {
|
||||||
let (compiled, peek_res) = {
|
let code_size;
|
||||||
let code_size = ctx.compile(self.backend.isa()).map_err(|e| {
|
let compiled = {
|
||||||
|
code_size = ctx.compile(self.backend.isa()).map_err(|e| {
|
||||||
info!(
|
info!(
|
||||||
"defining function {}: {}",
|
"defining function {}: {}",
|
||||||
func,
|
func,
|
||||||
@@ -535,23 +536,18 @@ where
|
|||||||
return Err(ModuleError::InvalidImportDefinition(info.decl.name.clone()));
|
return Err(ModuleError::InvalidImportDefinition(info.decl.name.clone()));
|
||||||
}
|
}
|
||||||
|
|
||||||
let peek_res = peek_compiled(code_size, &ctx, self.backend.isa());
|
Some(self.backend.define_function(
|
||||||
|
&info.decl.name,
|
||||||
(
|
ctx,
|
||||||
self.backend.define_function(
|
&ModuleNamespace::<B> {
|
||||||
&info.decl.name,
|
contents: &self.contents,
|
||||||
ctx,
|
},
|
||||||
&ModuleNamespace::<B> {
|
code_size,
|
||||||
contents: &self.contents,
|
)?)
|
||||||
},
|
|
||||||
code_size,
|
|
||||||
)?,
|
|
||||||
peek_res,
|
|
||||||
)
|
|
||||||
};
|
};
|
||||||
self.contents.functions[func].compiled = Some(compiled);
|
self.contents.functions[func].compiled = compiled;
|
||||||
self.functions_to_finalize.push(func);
|
self.functions_to_finalize.push(func);
|
||||||
Ok(peek_res)
|
Ok(peek_compiled(code_size, &ctx, self.backend.isa()))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Define a function, producing the data contents from the given `DataContext`.
|
/// Define a function, producing the data contents from the given `DataContext`.
|
||||||
|
|||||||
Reference in New Issue
Block a user