Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
1076: Use function defined in wasmer-runtime-core instead of llvm-backend's own copy of it. r=nlewycky a=nlewycky



Co-authored-by: Nick Lewycky <[email protected]>
  • Loading branch information
bors[bot] and nlewycky authored Dec 18, 2019
2 parents f9bb579 + 6a0a439 commit ca0cb6a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 20 deletions.
5 changes: 3 additions & 2 deletions lib/llvm-backend/src/code.rs
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -915,7 +916,7 @@ impl<'ctx> FunctionCodeGenerator<CodegenError> 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);
Expand Down
21 changes: 3 additions & 18 deletions lib/llvm-backend/src/read_info.rs
Original file line number Diff line number Diff line change
@@ -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<Type, BinaryReaderError> {
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<Type, BinaryReaderError> {
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:
Expand Down

0 comments on commit ca0cb6a

Please sign in to comment.