Skip to content

Commit 57986ab

Browse files
committed
VirtualMachine: Do not find OP_HALT in if statements and loops
1 parent 6b1a518 commit 57986ab

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/engine/virtualmachine.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,14 +149,14 @@ unsigned int *VirtualMachine::run(unsigned int *pos, RunningScript *script)
149149

150150
do_if:
151151
if (!READ_LAST_REG()->toBool()) {
152-
while (*pos != OP_ELSE && *pos != OP_ENDIF && *pos != OP_HALT)
152+
while (*pos != OP_ELSE && *pos != OP_ENDIF)
153153
pos += instruction_arg_count[*pos++];
154154
}
155155
FREE_REGS(1);
156156
DISPATCH();
157157

158158
do_else:
159-
while (*pos != OP_ENDIF && *pos != OP_HALT)
159+
while (*pos != OP_ENDIF)
160160
pos += instruction_arg_count[*pos++];
161161

162162
do_endif:
@@ -171,7 +171,7 @@ unsigned int *VirtualMachine::run(unsigned int *pos, RunningScript *script)
171171
FREE_REGS(1);
172172
if (loopCount <= 0) {
173173
loopEnd = pos;
174-
while (*loopEnd != OP_LOOP_END && *loopEnd != OP_HALT)
174+
while (*loopEnd != OP_LOOP_END)
175175
loopEnd += instruction_arg_count[*loopEnd++];
176176
} else {
177177
for (size_t i = 0; i < loopCount; i++)
@@ -191,7 +191,7 @@ unsigned int *VirtualMachine::run(unsigned int *pos, RunningScript *script)
191191
FREE_REGS(1);
192192
} else {
193193
loopEnd = loopStart;
194-
while (*loopEnd != OP_LOOP_END && *loopEnd != OP_HALT)
194+
while (*loopEnd != OP_LOOP_END)
195195
loopEnd += instruction_arg_count[*loopEnd++];
196196
}
197197
pos = loopEnd;

0 commit comments

Comments
 (0)