mirror of
https://github.com/fluencelabs/wasmer
synced 2025-06-24 22:21:32 +00:00
Fix more compiling issues
Specifically: - Don't truncate the list of local parameters. - If the default destination in a br_table instruction is a loop, don't pop any results.
This commit is contained in:
@ -266,7 +266,6 @@ impl FuncResolver for LLVMBackend {
|
|||||||
module: &ModuleInner,
|
module: &ModuleInner,
|
||||||
local_func_index: LocalFuncIndex,
|
local_func_index: LocalFuncIndex,
|
||||||
) -> Option<NonNull<vm::Func>> {
|
) -> Option<NonNull<vm::Func>> {
|
||||||
unimplemented!();
|
|
||||||
self.get_func(&module.info, local_func_index)
|
self.get_func(&module.info, local_func_index)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -290,7 +289,6 @@ impl ProtectedCaller for LLVMProtectedCaller {
|
|||||||
vmctx: *mut vm::Ctx,
|
vmctx: *mut vm::Ctx,
|
||||||
_: Token,
|
_: Token,
|
||||||
) -> RuntimeResult<Vec<Value>> {
|
) -> RuntimeResult<Vec<Value>> {
|
||||||
unimplemented!();
|
|
||||||
let (func_ptr, ctx, signature, sig_index) =
|
let (func_ptr, ctx, signature, sig_index) =
|
||||||
get_func_from_index(&module, import_backing, func_index);
|
get_func_from_index(&module, import_backing, func_index);
|
||||||
|
|
||||||
|
@ -179,14 +179,16 @@ fn parse_function(
|
|||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
for (index, local) in locals_reader.into_iter().enumerate().skip(locals.len()) {
|
let param_len = locals.len();
|
||||||
|
|
||||||
|
for (index, local) in locals_reader.into_iter().enumerate() {
|
||||||
let (_, ty) = local?;
|
let (_, ty) = local?;
|
||||||
|
|
||||||
let wasmer_ty = type_to_type(ty)?;
|
let wasmer_ty = type_to_type(ty)?;
|
||||||
|
|
||||||
let ty = type_to_llvm(intrinsics, wasmer_ty);
|
let ty = type_to_llvm(intrinsics, wasmer_ty);
|
||||||
|
|
||||||
let alloca = builder.build_alloca(ty, &format!("local{}", index));
|
let alloca = builder.build_alloca(ty, &format!("local{}", param_len + index));
|
||||||
|
|
||||||
let default_value = match wasmer_ty {
|
let default_value = match wasmer_ty {
|
||||||
Type::I32 => intrinsics.i32_zero.as_basic_value_enum(),
|
Type::I32 => intrinsics.i32_zero.as_basic_value_enum(),
|
||||||
@ -346,9 +348,12 @@ fn parse_function(
|
|||||||
|
|
||||||
let default_frame = state.frame_at_depth(default_depth)?;
|
let default_frame = state.frame_at_depth(default_depth)?;
|
||||||
|
|
||||||
|
let args = if default_frame.is_loop() {
|
||||||
|
&[]
|
||||||
|
} else {
|
||||||
let res_len = default_frame.phis().len();
|
let res_len = default_frame.phis().len();
|
||||||
|
state.peekn(res_len)?
|
||||||
let args = state.peekn(res_len)?;
|
};
|
||||||
|
|
||||||
for (phi, value) in default_frame.phis().iter().zip(args.iter()) {
|
for (phi, value) in default_frame.phis().iter().zip(args.iter()) {
|
||||||
phi.add_incoming(&[(value, ¤t_block)]);
|
phi.add_incoming(&[(value, ¤t_block)]);
|
||||||
@ -372,7 +377,7 @@ fn parse_function(
|
|||||||
|
|
||||||
builder.build_switch(index.into_int_value(), default_frame.br_dest(), &cases[..]);
|
builder.build_switch(index.into_int_value(), default_frame.br_dest(), &cases[..]);
|
||||||
|
|
||||||
state.popn(res_len)?;
|
state.popn(args.len())?;
|
||||||
state.reachable = false;
|
state.reachable = false;
|
||||||
}
|
}
|
||||||
Operator::If { ty } => {
|
Operator::If { ty } => {
|
||||||
@ -486,7 +491,6 @@ fn parse_function(
|
|||||||
if phi.count_incoming() != 0 {
|
if phi.count_incoming() != 0 {
|
||||||
state.push1(phi.as_basic_value());
|
state.push1(phi.as_basic_value());
|
||||||
} else {
|
} else {
|
||||||
println!("replacing");
|
|
||||||
let basic_ty = phi.as_basic_value().get_type();
|
let basic_ty = phi.as_basic_value().get_type();
|
||||||
let placeholder_value = match basic_ty {
|
let placeholder_value = match basic_ty {
|
||||||
BasicTypeEnum::IntType(int_ty) => {
|
BasicTypeEnum::IntType(int_ty) => {
|
||||||
|
Reference in New Issue
Block a user