rename PassiveElemIndex to ElemIndex and same for PassiveDataIndex (#1188)
* rename PassiveElemIndex to ElemIndex and same for PassiveDataIndex (#1411) * rename PassiveDataIndex to DataIndex * rename PassiveElemIndex to ElemIndex * Apply renamings to wasmtime as well * Run rustfmt Co-authored-by: csmoe <csmoe@msn.com>
This commit is contained in:
@@ -23,7 +23,7 @@ pub mod entity {
|
||||
pub mod wasm {
|
||||
pub use cranelift_wasm::{
|
||||
get_vmctx_value_label, DefinedFuncIndex, DefinedGlobalIndex, DefinedMemoryIndex,
|
||||
DefinedTableIndex, FuncIndex, Global, GlobalIndex, GlobalInit, Memory, MemoryIndex,
|
||||
PassiveElemIndex, SignatureIndex, Table, TableElementType, TableIndex,
|
||||
DefinedTableIndex, ElemIndex, FuncIndex, Global, GlobalIndex, GlobalInit, Memory,
|
||||
MemoryIndex, SignatureIndex, Table, TableElementType, TableIndex,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -5,8 +5,8 @@ use crate::WASM_MAX_PAGES;
|
||||
use cranelift_codegen::ir;
|
||||
use cranelift_entity::{EntityRef, PrimaryMap};
|
||||
use cranelift_wasm::{
|
||||
DefinedFuncIndex, DefinedGlobalIndex, DefinedMemoryIndex, DefinedTableIndex, FuncIndex, Global,
|
||||
GlobalIndex, Memory, MemoryIndex, PassiveElemIndex, SignatureIndex, Table, TableIndex,
|
||||
DefinedFuncIndex, DefinedGlobalIndex, DefinedMemoryIndex, DefinedTableIndex, ElemIndex,
|
||||
FuncIndex, Global, GlobalIndex, Memory, MemoryIndex, SignatureIndex, Table, TableIndex,
|
||||
};
|
||||
use indexmap::IndexMap;
|
||||
use more_asserts::assert_ge;
|
||||
@@ -166,7 +166,7 @@ pub struct Module {
|
||||
pub table_elements: Vec<TableElements>,
|
||||
|
||||
/// WebAssembly passive elements.
|
||||
pub passive_elements: HashMap<PassiveElemIndex, Box<[FuncIndex]>>,
|
||||
pub passive_elements: HashMap<ElemIndex, Box<[FuncIndex]>>,
|
||||
|
||||
/// WebAssembly table initializers.
|
||||
pub func_names: HashMap<FuncIndex, String>,
|
||||
@@ -239,7 +239,7 @@ impl Module {
|
||||
}
|
||||
|
||||
/// Get the given passive element, if it exists.
|
||||
pub fn get_passive_element(&self, index: PassiveElemIndex) -> Option<&[FuncIndex]> {
|
||||
pub fn get_passive_element(&self, index: ElemIndex) -> Option<&[FuncIndex]> {
|
||||
self.passive_elements.get(&index).map(|es| &**es)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,8 +6,8 @@ use cranelift_codegen::ir::{AbiParam, ArgumentPurpose};
|
||||
use cranelift_codegen::isa::TargetFrontendConfig;
|
||||
use cranelift_entity::PrimaryMap;
|
||||
use cranelift_wasm::{
|
||||
self, translate_module, DefinedFuncIndex, FuncIndex, Global, GlobalIndex, Memory, MemoryIndex,
|
||||
ModuleTranslationState, PassiveDataIndex, PassiveElemIndex, SignatureIndex, Table, TableIndex,
|
||||
self, translate_module, DataIndex, DefinedFuncIndex, ElemIndex, FuncIndex, Global, GlobalIndex,
|
||||
Memory, MemoryIndex, ModuleTranslationState, SignatureIndex, Table, TableIndex,
|
||||
TargetEnvironment, WasmError, WasmResult,
|
||||
};
|
||||
use std::convert::TryFrom;
|
||||
@@ -336,7 +336,7 @@ impl<'data> cranelift_wasm::ModuleEnvironment<'data> for ModuleEnvironment<'data
|
||||
|
||||
fn declare_passive_element(
|
||||
&mut self,
|
||||
elem_index: PassiveElemIndex,
|
||||
elem_index: ElemIndex,
|
||||
segments: Box<[FuncIndex]>,
|
||||
) -> WasmResult<()> {
|
||||
let old = self
|
||||
@@ -397,7 +397,7 @@ impl<'data> cranelift_wasm::ModuleEnvironment<'data> for ModuleEnvironment<'data
|
||||
|
||||
fn declare_passive_data(
|
||||
&mut self,
|
||||
_data_index: PassiveDataIndex,
|
||||
_data_index: DataIndex,
|
||||
_data: &'data [u8],
|
||||
) -> WasmResult<()> {
|
||||
Err(WasmError::Unsupported(
|
||||
|
||||
@@ -29,8 +29,8 @@ use std::{mem, ptr, slice};
|
||||
use thiserror::Error;
|
||||
use wasmtime_environ::entity::{packed_option::ReservedValue, BoxedSlice, EntityRef, PrimaryMap};
|
||||
use wasmtime_environ::wasm::{
|
||||
DefinedFuncIndex, DefinedGlobalIndex, DefinedMemoryIndex, DefinedTableIndex, FuncIndex,
|
||||
GlobalIndex, GlobalInit, MemoryIndex, PassiveElemIndex, SignatureIndex, TableIndex,
|
||||
DefinedFuncIndex, DefinedGlobalIndex, DefinedMemoryIndex, DefinedTableIndex, ElemIndex,
|
||||
FuncIndex, GlobalIndex, GlobalInit, MemoryIndex, SignatureIndex, TableIndex,
|
||||
};
|
||||
use wasmtime_environ::{ir, DataInitializer, Module, TableElements, VMOffsets};
|
||||
|
||||
@@ -90,7 +90,7 @@ pub(crate) struct Instance {
|
||||
/// Passive elements in this instantiation. As `elem.drop`s happen, these
|
||||
/// entries get removed. A missing entry is considered equivalent to an
|
||||
/// empty slice.
|
||||
passive_elements: RefCell<HashMap<PassiveElemIndex, Box<[VMCallerCheckedAnyfunc]>>>,
|
||||
passive_elements: RefCell<HashMap<ElemIndex, Box<[VMCallerCheckedAnyfunc]>>>,
|
||||
|
||||
/// Pointers to functions in executable memory.
|
||||
finished_functions: BoxedSlice<DefinedFuncIndex, *mut [VMFunctionBody]>,
|
||||
@@ -587,7 +587,7 @@ impl Instance {
|
||||
pub(crate) fn table_init(
|
||||
&self,
|
||||
table_index: TableIndex,
|
||||
elem_index: PassiveElemIndex,
|
||||
elem_index: ElemIndex,
|
||||
dst: u32,
|
||||
src: u32,
|
||||
len: u32,
|
||||
@@ -621,7 +621,7 @@ impl Instance {
|
||||
}
|
||||
|
||||
/// Drop an element.
|
||||
pub(crate) fn elem_drop(&self, elem_index: PassiveElemIndex) {
|
||||
pub(crate) fn elem_drop(&self, elem_index: ElemIndex) {
|
||||
// https://webassembly.github.io/reference-types/core/exec/instructions.html#exec-elem-drop
|
||||
|
||||
let mut passive_elements = self.passive_elements.borrow_mut();
|
||||
|
||||
@@ -36,7 +36,7 @@ use crate::table::Table;
|
||||
use crate::traphandlers::raise_lib_trap;
|
||||
use crate::vmcontext::VMContext;
|
||||
use wasmtime_environ::ir;
|
||||
use wasmtime_environ::wasm::{DefinedMemoryIndex, MemoryIndex, PassiveElemIndex, TableIndex};
|
||||
use wasmtime_environ::wasm::{DefinedMemoryIndex, ElemIndex, MemoryIndex, TableIndex};
|
||||
|
||||
/// Implementation of f32.ceil
|
||||
pub extern "C" fn wasmtime_f32_ceil(x: f32) -> f32 {
|
||||
@@ -204,7 +204,7 @@ pub unsafe extern "C" fn wasmtime_table_init(
|
||||
let result = {
|
||||
let table_index = TableIndex::from_u32(table_index);
|
||||
let source_loc = ir::SourceLoc::new(source_loc);
|
||||
let elem_index = PassiveElemIndex::from_u32(elem_index);
|
||||
let elem_index = ElemIndex::from_u32(elem_index);
|
||||
let instance = (&mut *vmctx).instance();
|
||||
instance.table_init(table_index, elem_index, dst, src, len, source_loc)
|
||||
};
|
||||
@@ -215,7 +215,7 @@ pub unsafe extern "C" fn wasmtime_table_init(
|
||||
|
||||
/// Implementation of `elem.drop`.
|
||||
pub unsafe extern "C" fn wasmtime_elem_drop(vmctx: *mut VMContext, elem_index: u32) {
|
||||
let elem_index = PassiveElemIndex::from_u32(elem_index);
|
||||
let elem_index = ElemIndex::from_u32(elem_index);
|
||||
let instance = (&mut *vmctx).instance();
|
||||
instance.elem_drop(elem_index);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user