mirror of
https://github.com/mii443/wasmer.git
synced 2025-12-16 17:18:57 +00:00
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:
@@ -1,5 +1,5 @@
|
||||
use crate::config::{CompiledFunctionKind, LLVM};
|
||||
use crate::object_file::load_object_file;
|
||||
use crate::object_file::{load_object_file, CompiledFunction};
|
||||
use crate::translator::abi::{
|
||||
func_type_to_llvm, get_vmctx_ptr_param, is_sret, pack_values_for_register_return,
|
||||
rets_from_call,
|
||||
@@ -94,7 +94,7 @@ impl FuncTrampoline {
|
||||
}
|
||||
|
||||
let mem_buf_slice = memory_buffer.as_slice();
|
||||
let (function, sections, eh_frame_section_indices) = load_object_file(
|
||||
let CompiledFunction{compiled_function, custom_sections, eh_frame_section_indices} = load_object_file(
|
||||
mem_buf_slice,
|
||||
FUNCTION_SECTION,
|
||||
RelocationTarget::LocalFunc(LocalFunctionIndex::from_u32(0)),
|
||||
@@ -106,7 +106,7 @@ impl FuncTrampoline {
|
||||
},
|
||||
)?;
|
||||
let mut all_sections_are_eh_sections = true;
|
||||
if eh_frame_section_indices.len() != sections.len() {
|
||||
if eh_frame_section_indices.len() != custom_sections.len() {
|
||||
all_sections_are_eh_sections = false;
|
||||
} else {
|
||||
let mut eh_frame_section_indices = eh_frame_section_indices.clone();
|
||||
@@ -123,12 +123,12 @@ impl FuncTrampoline {
|
||||
"trampoline generation produced non-eh custom sections".into(),
|
||||
));
|
||||
}
|
||||
if !function.relocations.is_empty() {
|
||||
if !compiled_function.relocations.is_empty() {
|
||||
return Err(CompileError::Codegen(
|
||||
"trampoline generation produced relocations".into(),
|
||||
));
|
||||
}
|
||||
if !function.jt_offsets.is_empty() {
|
||||
if !compiled_function.jt_offsets.is_empty() {
|
||||
return Err(CompileError::Codegen(
|
||||
"trampoline generation produced jump tables".into(),
|
||||
));
|
||||
@@ -136,8 +136,8 @@ impl FuncTrampoline {
|
||||
// Ignore CompiledFunctionFrameInfo. Extra frame info isn't a problem.
|
||||
|
||||
Ok(FunctionBody {
|
||||
body: function.body.body,
|
||||
unwind_info: function.body.unwind_info,
|
||||
body: compiled_function.body.body,
|
||||
unwind_info: compiled_function.body.unwind_info,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -192,7 +192,7 @@ impl FuncTrampoline {
|
||||
}
|
||||
|
||||
let mem_buf_slice = memory_buffer.as_slice();
|
||||
let (function, sections, eh_frame_section_indices) = load_object_file(
|
||||
let CompiledFunction{compiled_function, custom_sections, eh_frame_section_indices} = load_object_file(
|
||||
mem_buf_slice,
|
||||
FUNCTION_SECTION,
|
||||
RelocationTarget::LocalFunc(LocalFunctionIndex::from_u32(0)),
|
||||
@@ -204,7 +204,7 @@ impl FuncTrampoline {
|
||||
},
|
||||
)?;
|
||||
let mut all_sections_are_eh_sections = true;
|
||||
if eh_frame_section_indices.len() != sections.len() {
|
||||
if eh_frame_section_indices.len() != custom_sections.len() {
|
||||
all_sections_are_eh_sections = false;
|
||||
} else {
|
||||
let mut eh_frame_section_indices = eh_frame_section_indices.clone();
|
||||
@@ -221,12 +221,12 @@ impl FuncTrampoline {
|
||||
"trampoline generation produced non-eh custom sections".into(),
|
||||
));
|
||||
}
|
||||
if !function.relocations.is_empty() {
|
||||
if !compiled_function.relocations.is_empty() {
|
||||
return Err(CompileError::Codegen(
|
||||
"trampoline generation produced relocations".into(),
|
||||
));
|
||||
}
|
||||
if !function.jt_offsets.is_empty() {
|
||||
if !compiled_function.jt_offsets.is_empty() {
|
||||
return Err(CompileError::Codegen(
|
||||
"trampoline generation produced jump tables".into(),
|
||||
));
|
||||
@@ -234,8 +234,8 @@ impl FuncTrampoline {
|
||||
// Ignore CompiledFunctionFrameInfo. Extra frame info isn't a problem.
|
||||
|
||||
Ok(FunctionBody {
|
||||
body: function.body.body,
|
||||
unwind_info: function.body.unwind_info,
|
||||
body: compiled_function.body.body,
|
||||
unwind_info: compiled_function.body.unwind_info,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user