diff --git a/lib/llvm-backend/src/code.rs b/lib/llvm-backend/src/code.rs index 57a626d27..bfce8351f 100644 --- a/lib/llvm-backend/src/code.rs +++ b/lib/llvm-backend/src/code.rs @@ -1,7 +1,7 @@ use crate::{ backend::LLVMBackend, intrinsics::{tbaa_label, CtxType, GlobalCache, Intrinsics, MemoryCache}, - read_info::{blocktype_to_type, type_to_type}, + read_info::blocktype_to_type, stackmap::{StackmapEntry, StackmapEntryKind, StackmapRegistry, ValueSemantic}, state::{ControlFrame, ExtraInfo, IfElseState, State}, trampolines::generate_trampolines, @@ -34,6 +34,7 @@ use wasmer_runtime_core::{ codegen::*, memory::MemoryType, module::{ModuleInfo, ModuleInner}, + parse::wp_type_to_type, structures::{Map, TypedIndex}, types::{ FuncIndex, FuncSig, GlobalIndex, LocalOrImport, MemoryIndex, SigIndex, TableIndex, Type, @@ -915,7 +916,7 @@ impl<'ctx> FunctionCodeGenerator for LLVMFunctionCodeGenerator<'ct fn feed_local(&mut self, ty: WpType, count: usize) -> Result<(), CodegenError> { let param_len = self.num_params; - let wasmer_ty = type_to_type(ty)?; + let wasmer_ty = wp_type_to_type(ty)?; let intrinsics = self.intrinsics.as_ref().unwrap(); let ty = type_to_llvm(intrinsics, wasmer_ty); diff --git a/lib/llvm-backend/src/read_info.rs b/lib/llvm-backend/src/read_info.rs index 946c74d52..6f7fbca5e 100644 --- a/lib/llvm-backend/src/read_info.rs +++ b/lib/llvm-backend/src/read_info.rs @@ -1,25 +1,10 @@ +use wasmer_runtime_core::parse::wp_type_to_type; use wasmer_runtime_core::types::Type; -use wasmparser::{BinaryReaderError, Type as WpType, TypeOrFuncType as WpTypeOrFuncType}; - -pub fn type_to_type(ty: WpType) -> Result { - Ok(match ty { - WpType::I32 => Type::I32, - WpType::I64 => Type::I64, - WpType::F32 => Type::F32, - WpType::F64 => Type::F64, - WpType::V128 => Type::V128, - _ => { - return Err(BinaryReaderError { - message: "that type is not supported as a wasmer type", - offset: -1isize as usize, - }); - } - }) -} +use wasmparser::{BinaryReaderError, TypeOrFuncType as WpTypeOrFuncType}; pub fn blocktype_to_type(ty: WpTypeOrFuncType) -> Result { match ty { - WpTypeOrFuncType::Type(inner_ty) => type_to_type(inner_ty), + WpTypeOrFuncType::Type(inner_ty) => wp_type_to_type(inner_ty), _ => { return Err(BinaryReaderError { message: