mirror of
https://github.com/fluencelabs/wasmer
synced 2025-06-16 10:21:22 +00:00
Update for new wasmparser.rs version.
This commit is contained in:
@ -24,7 +24,7 @@ use wasmparser::{BinaryReaderError, MemoryImmediate, Operator, Type as WpType};
|
||||
|
||||
use crate::backend::LLVMBackend;
|
||||
use crate::intrinsics::{CtxType, GlobalCache, Intrinsics, MemoryCache};
|
||||
use crate::read_info::type_to_type;
|
||||
use crate::read_info::{blocktype_to_type, type_to_type};
|
||||
use crate::state::{ControlFrame, IfElseState, State};
|
||||
use crate::trampolines::generate_trampolines;
|
||||
|
||||
@ -525,7 +525,7 @@ impl FunctionCodeGenerator<CodegenError> for LLVMFunctionCodeGenerator {
|
||||
let end_block = context.append_basic_block(&function, "end");
|
||||
builder.position_at_end(&end_block);
|
||||
|
||||
let phis = if let Ok(wasmer_ty) = type_to_type(ty) {
|
||||
let phis = if let Ok(wasmer_ty) = blocktype_to_type(ty) {
|
||||
let llvm_ty = type_to_llvm(intrinsics, wasmer_ty);
|
||||
[llvm_ty]
|
||||
.iter()
|
||||
@ -545,7 +545,7 @@ impl FunctionCodeGenerator<CodegenError> for LLVMFunctionCodeGenerator {
|
||||
builder.build_unconditional_branch(&loop_body);
|
||||
|
||||
builder.position_at_end(&loop_next);
|
||||
let phis = if let Ok(wasmer_ty) = type_to_type(ty) {
|
||||
let phis = if let Ok(wasmer_ty) = blocktype_to_type(ty) {
|
||||
let llvm_ty = type_to_llvm(intrinsics, wasmer_ty);
|
||||
[llvm_ty]
|
||||
.iter()
|
||||
@ -680,7 +680,7 @@ impl FunctionCodeGenerator<CodegenError> for LLVMFunctionCodeGenerator {
|
||||
let end_phis = {
|
||||
builder.position_at_end(&end_block);
|
||||
|
||||
let phis = if let Ok(wasmer_ty) = type_to_type(ty) {
|
||||
let phis = if let Ok(wasmer_ty) = blocktype_to_type(ty) {
|
||||
let llvm_ty = type_to_llvm(intrinsics, wasmer_ty);
|
||||
[llvm_ty]
|
||||
.iter()
|
||||
|
@ -1,5 +1,5 @@
|
||||
use wasmer_runtime_core::types::Type;
|
||||
use wasmparser::{BinaryReaderError, Type as WpType};
|
||||
use wasmparser::{BinaryReaderError, Type as WpType, TypeOrFuncType as WpTypeOrFuncType};
|
||||
|
||||
pub fn type_to_type(ty: WpType) -> Result<Type, BinaryReaderError> {
|
||||
Ok(match ty {
|
||||
@ -21,3 +21,15 @@ pub fn type_to_type(ty: WpType) -> Result<Type, BinaryReaderError> {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
pub fn blocktype_to_type(ty: WpTypeOrFuncType) -> Result<Type, BinaryReaderError> {
|
||||
match ty {
|
||||
WpTypeOrFuncType::Type(inner_ty) => { type_to_type(inner_ty) }
|
||||
_ => {
|
||||
return Err(BinaryReaderError {
|
||||
message: "the wasmer llvm backend does not yet support the multi-value return extension",
|
||||
offset: -1isize as usize,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user