Fix loading of 128-bit numbers

This commit is contained in:
Brian Carroll 2021-11-21 23:44:42 +00:00
parent bceebc4f8f
commit bd2813f36c

View file

@ -247,22 +247,28 @@ impl<'a> Storage<'a> {
} => {
let (local_id, offset) = location.local_and_offset(self.stack_frame_pointer);
// Load the address of the value
code_builder.get_local(local_id);
if offset != 0 {
code_builder.i32_const(offset as i32);
code_builder.i32_add();
}
let get_addr = |cb: &mut CodeBuilder| {
cb.get_local(local_id);
if offset != 0 {
cb.i32_const(offset as i32);
cb.i32_add();
}
};
if format != StackMemoryFormat::Aggregate {
if format == StackMemoryFormat::Aggregate {
get_addr(code_builder);
code_builder.set_top_symbol(sym);
} else {
// It's one of the 128-bit numbers, all of which we load as two i64's
// Mark the same Symbol twice in the VM value stack! Shouldn't matter except debug.
// (Mark the same Symbol twice. Shouldn't matter except for debugging.)
get_addr(code_builder);
code_builder.i64_load(Align::Bytes8, offset);
code_builder.set_top_symbol(sym);
code_builder.i64_load(Align::Bytes8, offset + 8);
}
code_builder.set_top_symbol(sym);
get_addr(code_builder);
code_builder.i64_load(Align::Bytes8, offset + 8);
code_builder.set_top_symbol(sym);
}
}
}
}