load_object_file is returning an increasingly complex object.

Group the data from compilation of a function into its own struct and return that.
This commit is contained in:
Nick Lewycky
2020-06-18 16:43:43 -07:00
parent 30add15904
commit b527127d0f
4 changed files with 60 additions and 57 deletions

View File

@ -23,7 +23,7 @@ use inkwell::{
use smallvec::SmallVec;
use crate::config::{CompiledFunctionKind, LLVM};
use crate::object_file::load_object_file;
use crate::object_file::{load_object_file, CompiledFunction};
use wasm_common::entity::{PrimaryMap, SecondaryMap};
use wasm_common::{
FunctionIndex, FunctionType, GlobalIndex, LocalFunctionIndex, MemoryIndex, SignatureIndex,
@ -31,9 +31,8 @@ use wasm_common::{
};
use wasmer_compiler::wasmparser::{MemoryImmediate, Operator};
use wasmer_compiler::{
to_wasm_error, wptype_to_type, CompileError, CompiledFunction, CustomSections,
FunctionBodyData, GenerateMiddlewareChain, MiddlewareBinaryReader, ModuleTranslationState,
RelocationTarget, SectionIndex,
to_wasm_error, wptype_to_type, CompileError, FunctionBodyData, GenerateMiddlewareChain,
MiddlewareBinaryReader, ModuleTranslationState, RelocationTarget,
};
use wasmer_runtime::{MemoryPlan, ModuleInfo, TablePlan};
@ -76,7 +75,7 @@ impl FuncTranslator {
memory_plans: &PrimaryMap<MemoryIndex, MemoryPlan>,
_table_plans: &PrimaryMap<TableIndex, TablePlan>,
func_names: &SecondaryMap<FunctionIndex, String>,
) -> Result<(CompiledFunction, CustomSections, Vec<SectionIndex>), CompileError> {
) -> Result<CompiledFunction, CompileError> {
// The function type, used for the callbacks.
let function = CompiledFunctionKind::Local(*local_func_index);
let func_index = wasm_module.func_index(*local_func_index);