Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

common/implement-flagoffreturn: properly implement 00 5C #86

Merged
merged 1 commit into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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(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
Loading