Remove code offsets from Function (#3412)
* Remove code offsets from Function * Remove reloc_jt and fix wasmtime-cranelift
This commit is contained in:
@@ -197,7 +197,6 @@ impl wasmtime_environ::Compiler for Compiler {
|
||||
let length = u32::try_from(code_buf.len()).unwrap();
|
||||
Ok(Box::new(CompiledFunction {
|
||||
body: code_buf,
|
||||
jt_offsets: context.func.jt_offsets,
|
||||
relocations: reloc_sink.func_relocs,
|
||||
value_labels_ranges: ranges.unwrap_or(Default::default()),
|
||||
stack_slots: context.func.stack_slots,
|
||||
@@ -540,7 +539,6 @@ impl Compiler {
|
||||
|
||||
Ok(CompiledFunction {
|
||||
body: code_buf,
|
||||
jt_offsets: context.func.jt_offsets,
|
||||
unwind_info,
|
||||
relocations: reloc_sink.relocs,
|
||||
stack_slots: Default::default(),
|
||||
@@ -655,15 +653,6 @@ impl binemit::RelocSink for RelocSink {
|
||||
// Do nothing for now: cranelift emits constant data after the function code and also emits
|
||||
// function code with correct relative offsets to the constant data.
|
||||
}
|
||||
|
||||
fn reloc_jt(&mut self, offset: binemit::CodeOffset, reloc: binemit::Reloc, jt: ir::JumpTable) {
|
||||
self.func_relocs.push(Relocation {
|
||||
reloc,
|
||||
reloc_target: RelocationTarget::JumpTable(jt),
|
||||
offset,
|
||||
addend: 0,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
impl RelocSink {
|
||||
@@ -783,12 +772,4 @@ impl binemit::RelocSink for TrampolineRelocSink {
|
||||
) {
|
||||
panic!("trampoline compilation should not produce constant relocs");
|
||||
}
|
||||
fn reloc_jt(
|
||||
&mut self,
|
||||
_offset: binemit::CodeOffset,
|
||||
_reloc: binemit::Reloc,
|
||||
_jt: ir::JumpTable,
|
||||
) {
|
||||
panic!("trampoline compilation should not produce jump table relocs");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,9 +114,6 @@ pub struct CompiledFunction {
|
||||
/// The machine code for this function.
|
||||
body: Vec<u8>,
|
||||
|
||||
/// The jump tables offsets (in the body).
|
||||
jt_offsets: ir::JumpTableOffsets,
|
||||
|
||||
/// The unwind information.
|
||||
unwind_info: Option<UnwindInfo>,
|
||||
|
||||
@@ -181,8 +178,6 @@ enum RelocationTarget {
|
||||
UserFunc(FuncIndex),
|
||||
/// A compiler-generated libcall.
|
||||
LibCall(ir::LibCall),
|
||||
/// Jump table index.
|
||||
JumpTable(ir::JumpTable),
|
||||
}
|
||||
|
||||
/// Creates a new cranelift `Signature` with no wasm params/results for the
|
||||
|
||||
@@ -305,7 +305,6 @@ impl<'a> ObjectBuilder<'a> {
|
||||
// seem too common though so aren't necessarily that important
|
||||
// to optimize.
|
||||
RelocationTarget::LibCall(call) => (self.libcalls[&call], 0),
|
||||
RelocationTarget::JumpTable(jt) => (symbol_id, func.jt_offsets[jt]),
|
||||
};
|
||||
let (kind, encoding, size) = match r.reloc {
|
||||
Reloc::Abs4 => (RelocationKind::Absolute, RelocationEncoding::Generic, 32),
|
||||
|
||||
Reference in New Issue
Block a user