mirror of
https://github.com/mii443/wasmer.git
synced 2025-08-24 17:29:26 +00:00
Add the correct number of locals when the same type is repeated.
This commit is contained in:
@ -174,15 +174,17 @@ impl FuncTranslator {
|
||||
let num_locals = reader.read_local_count().map_err(to_wasm_error)?;
|
||||
for _ in 0..num_locals {
|
||||
let mut counter = 0;
|
||||
let (_count, ty) = reader
|
||||
let (count, ty) = reader
|
||||
.read_local_decl(&mut counter)
|
||||
.map_err(to_wasm_error)?;
|
||||
let ty = wptype_to_type(ty)?;
|
||||
let ty = type_to_llvm(&intrinsics, ty);
|
||||
// TODO: don't interleave allocas and stores.
|
||||
let alloca = cache_builder.build_alloca(ty, "local");
|
||||
cache_builder.build_store(alloca, const_zero(ty));
|
||||
locals.push(alloca);
|
||||
for _ in 0..count {
|
||||
let alloca = cache_builder.build_alloca(ty, "local");
|
||||
cache_builder.build_store(alloca, const_zero(ty));
|
||||
locals.push(alloca);
|
||||
}
|
||||
}
|
||||
|
||||
let mut params_locals = params.clone();
|
||||
|
Reference in New Issue
Block a user