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