syscall fixes
This commit is contained in:
parent
9d9d2404a1
commit
52502830a3
@ -1164,9 +1164,10 @@ impl VirtualMachine {
|
|||||||
.imm_u32()
|
.imm_u32()
|
||||||
.map_err(|e| LogicalFrameEndingReason::Panic(format!("{:?}", e)))?
|
.map_err(|e| LogicalFrameEndingReason::Panic(format!("{:?}", e)))?
|
||||||
as usize;
|
as usize;
|
||||||
let val = self.globals.get(idx).cloned().ok_or_else(|| {
|
if idx >= self.globals.len() {
|
||||||
LogicalFrameEndingReason::Panic("Invalid global index".into())
|
self.globals.resize(idx + 1, Value::Int32(0));
|
||||||
})?;
|
}
|
||||||
|
let val = self.globals[idx].clone();
|
||||||
self.push(val);
|
self.push(val);
|
||||||
}
|
}
|
||||||
OpCode::SetGlobal => {
|
OpCode::SetGlobal => {
|
||||||
@ -1176,7 +1177,7 @@ impl VirtualMachine {
|
|||||||
as usize;
|
as usize;
|
||||||
let val = self.pop().map_err(|e| LogicalFrameEndingReason::Panic(e))?;
|
let val = self.pop().map_err(|e| LogicalFrameEndingReason::Panic(e))?;
|
||||||
if idx >= self.globals.len() {
|
if idx >= self.globals.len() {
|
||||||
self.globals.resize(idx + 1, Value::Null);
|
self.globals.resize(idx + 1, Value::Int32(0));
|
||||||
}
|
}
|
||||||
self.globals[idx] = val;
|
self.globals[idx] = val;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user