Skip to content

Commit

Permalink
Merge pull request #86 from CommitteeOfZero/common/implement-flagoffr…
Browse files Browse the repository at this point in the history
…eturn

common/implement-flagoffreturn: properly implement 00 5C
  • Loading branch information
Enorovan authored Nov 1, 2024
2 parents 1b896a5 + bf95ee6 commit 5716437
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 7 deletions.
25 changes: 20 additions & 5 deletions src/vm/inst_controlflow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -288,12 +288,27 @@ VmInstruction(InstCase) {
}
}

VmInstruction(InstFlagWait) {
VmInstruction(InstFlagOffReturn) {
StartInstruction;
PopUint8(type);
PopExpression(arg1);
ImpLogSlow(LL_Warning, LC_VMStub,
"STUB instruction SomethingOff(type: %i, arg1: %i)\n", type, arg1);
PopUint8(arg1);
PopExpression(arg2);
if (arg1 == GetFlag(arg2)) {

Check warning on line 295 in src/vm/inst_controlflow.cpp

View workflow job for this annotation

GitHub Actions / windows

'==': unsafe mix of type 'uint8_t' and type 'bool' in operation
if (thread->CallStackDepth) {
thread->CallStackDepth--;
uint32_t retBufferId =
thread->ReturnScriptBufferIds[thread->CallStackDepth];
if (Profile::Vm::UseReturnIds) {
thread->Ip =
ScriptGetRetAddress(ScriptBuffers[retBufferId],
thread->ReturnIds[thread->CallStackDepth]);
} else {
thread->Ip = thread->ReturnAddresses[thread->CallStackDepth];
}
thread->ScriptBufferId = retBufferId;
} else {
ImpLog(LL_Error, LC_VM, "Return error, call stack empty.\n");
}
}
}

} // namespace Vm
Expand Down
2 changes: 1 addition & 1 deletion src/vm/inst_controlflow.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ VmInstruction(InstPackFileAddBind);
VmInstruction(InstLoadJump);
VmInstruction(InstSwitch);
VmInstruction(InstCase);
VmInstruction(InstFlagWait);
VmInstruction(InstFlagOffReturn);

} // namespace Vm

Expand Down
2 changes: 1 addition & 1 deletion src/vm/opcodetables_cc.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ InstructionProc static OpcodeTableSystem_CC[256] = {
InstDummy, // 00 59
InstDummy, // 00 5A
InstDummy, // 00 5B
InstFlagWait, // 00 5C
InstFlagOffReturn, // 00 5C
InstDummy, // 00 5D
InstDummy, // 00 5E
InstPackFileAddBind, // 00 5F
Expand Down

0 comments on commit 5716437

Please sign in to comment.