syscall fixes

This commit is contained in:
bQUARKz 2026-02-20 23:58:01 +00:00
parent 9d9d2404a1
commit 52502830a3
Signed by: bquarkz
SSH Key Fingerprint: SHA256:Z7dgqoglWwoK6j6u4QC87OveEq74WOhFN+gitsxtkf8

View File

@ -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;
}