mirror of
https://github.com/mii443/wasmer.git
synced 2025-12-09 14:18:20 +00:00
Update Cranelift to 0.82
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
use crate::lib::std::vec::Vec;
|
||||
use crate::section::{CustomSection, SectionIndex};
|
||||
use crate::trap::TrapInformation;
|
||||
use crate::{CompiledFunctionUnwindInfo, FunctionAddressMap, JumpTableOffsets, Relocation};
|
||||
use crate::{CompiledFunctionUnwindInfo, FunctionAddressMap, Relocation};
|
||||
use loupe::MemoryUsage;
|
||||
#[cfg(feature = "enable-rkyv")]
|
||||
use rkyv::{Archive, Deserialize as RkyvDeserialize, Serialize as RkyvSerialize};
|
||||
@@ -70,9 +70,6 @@ pub struct CompiledFunction {
|
||||
/// The relocations (in the body)
|
||||
pub relocations: Vec<Relocation>,
|
||||
|
||||
/// The jump tables offsets (in the body).
|
||||
pub jt_offsets: JumpTableOffsets,
|
||||
|
||||
/// The frame information.
|
||||
pub frame_info: CompiledFunctionFrameInfo,
|
||||
}
|
||||
@@ -206,14 +203,6 @@ impl Compilation {
|
||||
.collect::<PrimaryMap<LocalFunctionIndex, _>>()
|
||||
}
|
||||
|
||||
/// Gets functions jump table offsets.
|
||||
pub fn get_jt_offsets(&self) -> PrimaryMap<LocalFunctionIndex, JumpTableOffsets> {
|
||||
self.functions
|
||||
.iter()
|
||||
.map(|(_, func)| func.jt_offsets.clone())
|
||||
.collect::<PrimaryMap<LocalFunctionIndex, _>>()
|
||||
}
|
||||
|
||||
/// Gets functions frame info.
|
||||
pub fn get_frame_info(&self) -> PrimaryMap<LocalFunctionIndex, CompiledFunctionFrameInfo> {
|
||||
self.functions
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
//! A jump table is a method of transferring program control (branching)
|
||||
//! to another part of a program (or a different program that may have
|
||||
//! been dynamically loaded) using a table of branch or jump instructions.
|
||||
//!
|
||||
//! [Learn more](https://en.wikipedia.org/wiki/Branch_table).
|
||||
|
||||
use super::CodeOffset;
|
||||
use loupe::MemoryUsage;
|
||||
#[cfg(feature = "enable-rkyv")]
|
||||
use rkyv::{Archive, Deserialize as RkyvDeserialize, Serialize as RkyvSerialize};
|
||||
#[cfg(feature = "enable-serde")]
|
||||
use serde::{Deserialize, Serialize};
|
||||
use wasmer_types::entity::{entity_impl, SecondaryMap};
|
||||
|
||||
/// An opaque reference to a [jump table](https://en.wikipedia.org/wiki/Branch_table).
|
||||
///
|
||||
/// `JumpTable`s are used for indirect branching and are specialized for dense,
|
||||
/// 0-based jump offsets.
|
||||
#[cfg_attr(feature = "enable-serde", derive(Serialize, Deserialize))]
|
||||
#[cfg_attr(
|
||||
feature = "enable-rkyv",
|
||||
derive(RkyvSerialize, RkyvDeserialize, Archive)
|
||||
)]
|
||||
#[derive(Copy, Clone, PartialEq, Eq, Hash, PartialOrd, Ord, MemoryUsage)]
|
||||
pub struct JumpTable(u32);
|
||||
|
||||
entity_impl!(JumpTable, "jt");
|
||||
|
||||
impl JumpTable {
|
||||
/// Create a new jump table reference from its number.
|
||||
///
|
||||
/// This method is for use by the parser.
|
||||
pub fn with_number(n: u32) -> Option<Self> {
|
||||
if n < u32::max_value() {
|
||||
Some(Self(n))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Code offsets for Jump Tables.
|
||||
pub type JumpTableOffsets = SecondaryMap<JumpTable, CodeOffset>;
|
||||
@@ -54,7 +54,6 @@ mod address_map;
|
||||
mod compiler;
|
||||
mod error;
|
||||
mod function;
|
||||
mod jump_table;
|
||||
mod module;
|
||||
mod relocation;
|
||||
mod target;
|
||||
@@ -76,7 +75,6 @@ pub use crate::function::{
|
||||
Compilation, CompiledFunction, CompiledFunctionFrameInfo, CustomSections, Dwarf, FunctionBody,
|
||||
Functions,
|
||||
};
|
||||
pub use crate::jump_table::{JumpTable, JumpTableOffsets};
|
||||
pub use crate::module::CompileModuleInfo;
|
||||
pub use crate::relocation::{Relocation, RelocationKind, RelocationTarget, Relocations};
|
||||
pub use crate::section::{CustomSection, CustomSectionProtection, SectionBody, SectionIndex};
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
use crate::lib::std::fmt;
|
||||
use crate::lib::std::vec::Vec;
|
||||
use crate::section::SectionIndex;
|
||||
use crate::{Addend, CodeOffset, JumpTable};
|
||||
use crate::{Addend, CodeOffset};
|
||||
use loupe::MemoryUsage;
|
||||
#[cfg(feature = "enable-rkyv")]
|
||||
use rkyv::{Archive, Deserialize as RkyvDeserialize, Serialize as RkyvSerialize};
|
||||
@@ -38,8 +38,6 @@ pub enum RelocationKind {
|
||||
X86PCRel4,
|
||||
/// x86 PC-relative 8-byte
|
||||
X86PCRel8,
|
||||
/// x86 PC-relative 4-byte offset to trailing rodata
|
||||
X86PCRelRodata4,
|
||||
/// x86 call to PC-relative 4-byte
|
||||
X86CallPCRel4,
|
||||
/// x86 call to PLT-relative 4-byte
|
||||
@@ -67,7 +65,6 @@ impl fmt::Display for RelocationKind {
|
||||
Self::Abs8 => write!(f, "Abs8"),
|
||||
Self::X86PCRel4 => write!(f, "PCRel4"),
|
||||
Self::X86PCRel8 => write!(f, "PCRel8"),
|
||||
Self::X86PCRelRodata4 => write!(f, "PCRelRodata4"),
|
||||
Self::X86CallPCRel4 => write!(f, "CallPCRel4"),
|
||||
Self::X86CallPLTRel4 => write!(f, "CallPLTRel4"),
|
||||
Self::X86GOTPCRel4 => write!(f, "GOTPCRel4"),
|
||||
@@ -108,8 +105,6 @@ pub enum RelocationTarget {
|
||||
LocalFunc(LocalFunctionIndex),
|
||||
/// A compiler-generated libcall.
|
||||
LibCall(LibCall),
|
||||
/// Jump table index.
|
||||
JumpTable(LocalFunctionIndex, JumpTable),
|
||||
/// Custom sections generated by the compiler
|
||||
CustomSection(SectionIndex),
|
||||
}
|
||||
@@ -163,9 +158,6 @@ impl Relocation {
|
||||
.wrapping_add(reloc_addend as u64);
|
||||
(reloc_address, reloc_delta_u32)
|
||||
}
|
||||
// RelocationKind::X86PCRelRodata4 => {
|
||||
// (start, target_func_address)
|
||||
// }
|
||||
_ => panic!("Relocation kind unsupported"),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user