Skip to content

Commit

Permalink
fix(zscript): handle rare COMPAREV2 for x64 jit
Browse files Browse the repository at this point in the history
  • Loading branch information
connorjclark committed Dec 20, 2023
1 parent bd084e2 commit 0fc3edd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion src/zc/jit_x64.cpp
Expand Up @@ -360,6 +360,7 @@ static bool command_is_compiled(int command)
// These commands are critical to control flow.
case COMPARER:
case COMPAREV:
case COMPAREV2:
case GOTO:
case GOTOR:
case QUIT:
Expand Down Expand Up @@ -466,7 +467,7 @@ JittedFunction jit_compile_script(script_data *script)
{
int command = script->zasm[i].command;

if (command == COMPARER || command == COMPAREV)
if (command == COMPARER || command == COMPAREV || command == COMPAREV2)
{
comparing_state = true;
}
Expand Down Expand Up @@ -1174,6 +1175,13 @@ JittedFunction jit_compile_script(script_data *script)
cc.cmp(val2, val);
}
break;
case COMPAREV2:
{
int val = arg1;
x86::Gp val2 = get_z_register(state, cc, vStackIndex, arg2);
cc.cmp(val2, val);
}
break;
case COMPARER:
{
x86::Gp val = get_z_register(state, cc, vStackIndex, arg2);
Expand Down
2 changes: 1 addition & 1 deletion src/zc/script_debug.cpp
Expand Up @@ -223,7 +223,7 @@ void ScriptDebugHandle::pre_command()

print_command(ri->pc);

if (command == COMPAREV || command == COMPARER)
if (command == COMPARER || command == COMPAREV || command == COMPAREV2)
{
supress_output = true;
for (int j = ri->pc + 1; script->zasm[j].command != 0xFFFF; j++)
Expand Down

0 comments on commit 0fc3edd

Please sign in to comment.