Add an extra layer of indirection for shared globals

This commit is contained in:
Mark McCaskey
2020-07-02 18:23:19 -07:00
parent c717a25770
commit d4d738d97e
8 changed files with 153 additions and 92 deletions

View File

@@ -1898,7 +1898,13 @@ impl<'a> FuncGen<'a> {
self.module.local_global_index(global_index)
{
let offset = self.vmoffsets.vmctx_vmglobal_definition(local_global_index);
Location::Memory(Machine::get_vmctx_reg(), offset as i32)
self.emit_relaxed_binop(
Assembler::emit_mov,
Size::S64,
Location::Memory(Machine::get_vmctx_reg(), offset as i32),
Location::GPR(tmp),
);
Location::Memory(tmp, 0)
} else {
// Imported globals require one level of indirection.
let offset = self
@@ -1924,7 +1930,13 @@ impl<'a> FuncGen<'a> {
self.module.local_global_index(global_index)
{
let offset = self.vmoffsets.vmctx_vmglobal_definition(local_global_index);
Location::Memory(Machine::get_vmctx_reg(), offset as i32)
self.emit_relaxed_binop(
Assembler::emit_mov,
Size::S64,
Location::Memory(Machine::get_vmctx_reg(), offset as i32),
Location::GPR(tmp),
);
Location::Memory(tmp, 0)
} else {
// Imported globals require one level of indirection.
let offset = self