Remove some dead code (#3970)
This commit removes methods that are never used between crates or trait impls like `Clone` which may have been used one day but are no longer used.
This commit is contained in:
@@ -17,7 +17,7 @@ use thiserror::Error;
|
||||
|
||||
/// Information about a function, such as trap information, address map,
|
||||
/// and stack maps.
|
||||
#[derive(Serialize, Deserialize, Clone, Default)]
|
||||
#[derive(Serialize, Deserialize, Default)]
|
||||
#[allow(missing_docs)]
|
||||
pub struct FunctionInfo {
|
||||
pub start_srcloc: FilePos,
|
||||
@@ -31,7 +31,7 @@ pub struct FunctionInfo {
|
||||
|
||||
/// Information about a compiled trampoline which the host can call to enter
|
||||
/// wasm.
|
||||
#[derive(Serialize, Deserialize, Clone)]
|
||||
#[derive(Serialize, Deserialize)]
|
||||
#[allow(missing_docs)]
|
||||
pub struct Trampoline {
|
||||
/// The signature this trampoline is for
|
||||
@@ -45,7 +45,7 @@ pub struct Trampoline {
|
||||
|
||||
/// The offset within a function of a GC safepoint, and its associated stack
|
||||
/// map.
|
||||
#[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Clone)]
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
pub struct StackMapInformation {
|
||||
/// The offset of the GC safepoint within the function's native code. It is
|
||||
/// relative to the beginning of the function.
|
||||
|
||||
@@ -128,7 +128,7 @@ pub struct StaticMemoryInitializer {
|
||||
}
|
||||
|
||||
/// The type of WebAssembly linear memory initialization to use for a module.
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub enum MemoryInitialization {
|
||||
/// Memory initialization is segmented.
|
||||
///
|
||||
@@ -779,7 +779,7 @@ pub struct TableInitializer {
|
||||
}
|
||||
|
||||
/// Table initialization data for all tables in the module.
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub enum TableInitialization {
|
||||
/// "Segment" mode: table initializer segments, possibly with
|
||||
/// dynamic bases, possibly applying to an imported memory.
|
||||
@@ -850,7 +850,7 @@ impl ModuleType {
|
||||
|
||||
/// A translated WebAssembly module, excluding the function bodies and
|
||||
/// memory initializers.
|
||||
#[derive(Default, Debug, Clone, Serialize, Deserialize)]
|
||||
#[derive(Default, Debug, Serialize, Deserialize)]
|
||||
pub struct Module {
|
||||
/// The name of this wasm module, often found in the wasm file.
|
||||
pub name: Option<String>,
|
||||
@@ -916,7 +916,7 @@ pub struct Module {
|
||||
|
||||
/// Initialization routines for creating an instance, encompassing imports,
|
||||
/// modules, instances, aliases, etc.
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub enum Initializer {
|
||||
/// An imported item is required to be provided.
|
||||
Import {
|
||||
@@ -936,12 +936,6 @@ impl Module {
|
||||
Module::default()
|
||||
}
|
||||
|
||||
/// Get the given passive element, if it exists.
|
||||
pub fn get_passive_element(&self, index: ElemIndex) -> Option<&[FuncIndex]> {
|
||||
let index = *self.passive_elements_map.get(&index)?;
|
||||
Some(self.passive_elements[index].as_ref())
|
||||
}
|
||||
|
||||
/// Convert a `DefinedFuncIndex` into a `FuncIndex`.
|
||||
#[inline]
|
||||
pub fn func_index(&self, defined_func: DefinedFuncIndex) -> FuncIndex {
|
||||
@@ -1086,7 +1080,7 @@ impl Module {
|
||||
///
|
||||
/// Note that this is shared amongst all modules coming out of a translation
|
||||
/// in the case of nested modules and the module linking proposal.
|
||||
#[derive(Default, Debug, Clone, Serialize, Deserialize)]
|
||||
#[derive(Default, Debug, Serialize, Deserialize)]
|
||||
#[allow(missing_docs)]
|
||||
pub struct TypeTables {
|
||||
pub(crate) wasm_signatures: PrimaryMap<SignatureIndex, WasmFuncType>,
|
||||
@@ -1109,7 +1103,7 @@ impl Index<SignatureIndex> for TypeTables {
|
||||
}
|
||||
|
||||
/// Type information about functions in a wasm module.
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct FunctionType {
|
||||
/// The type of this function, indexed into the module-wide type tables for
|
||||
/// a module compilation.
|
||||
|
||||
@@ -5,7 +5,7 @@ use serde::{Deserialize, Serialize};
|
||||
/// Note that this is currently primarily documented as cranelift's
|
||||
/// `binemit::StackMap`, so for detailed documentation about this please read
|
||||
/// the docs over there.
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct StackMap {
|
||||
bits: Box<[u32]>,
|
||||
mapped_words: u32,
|
||||
|
||||
@@ -776,22 +776,6 @@ impl<P: PtrSize> VMOffsets<P> {
|
||||
}
|
||||
}
|
||||
|
||||
/// Target specific type for shared signature index.
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
pub struct TargetSharedSignatureIndex(u32);
|
||||
|
||||
impl TargetSharedSignatureIndex {
|
||||
/// Constructs `TargetSharedSignatureIndex`.
|
||||
pub fn new(value: u32) -> Self {
|
||||
Self(value)
|
||||
}
|
||||
|
||||
/// Returns index value.
|
||||
pub fn index(self) -> u32 {
|
||||
self.0
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::vmoffsets::align;
|
||||
|
||||
@@ -518,11 +518,6 @@ impl CompiledModule {
|
||||
&self.module
|
||||
}
|
||||
|
||||
/// Returns the `FunctionInfo` map for all defined functions.
|
||||
pub fn functions(&self) -> &PrimaryMap<DefinedFuncIndex, FunctionInfo> {
|
||||
&self.funcs
|
||||
}
|
||||
|
||||
/// Looks up the `name` section name for the function index `idx`, if one
|
||||
/// was specified in the original wasm module.
|
||||
pub fn func_name(&self, idx: FuncIndex) -> Option<&str> {
|
||||
|
||||
@@ -502,7 +502,7 @@ pub struct VMSharedSignatureIndex(u32);
|
||||
mod test_vmshared_signature_index {
|
||||
use super::VMSharedSignatureIndex;
|
||||
use std::mem::size_of;
|
||||
use wasmtime_environ::{Module, TargetSharedSignatureIndex, VMOffsets};
|
||||
use wasmtime_environ::{Module, VMOffsets};
|
||||
|
||||
#[test]
|
||||
fn check_vmshared_signature_index() {
|
||||
@@ -513,14 +513,6 @@ mod test_vmshared_signature_index {
|
||||
usize::from(offsets.size_of_vmshared_signature_index())
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn check_target_shared_signature_index() {
|
||||
assert_eq!(
|
||||
size_of::<VMSharedSignatureIndex>(),
|
||||
size_of::<TargetSharedSignatureIndex>()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
impl VMSharedSignatureIndex {
|
||||
|
||||
Reference in New Issue
Block a user