rose: move END instruction to start of enum

Stop overloading END as the last Rose interpreter instruction, use new
sentinel LAST_ROSE_INSTRUCTION for that.

This change will also make it easier to add new instructions without
renumbering END and thus changing all generated bytecodes.
This commit is contained in:
Justin Viiret
2016-09-13 10:55:26 +10:00
committed by Matthew Barr
parent 997787bd4b
commit 6e533589bb
3 changed files with 17 additions and 16 deletions

View File

@@ -1389,9 +1389,15 @@ hwlmcb_rv_t roseRunProgram_i(const struct RoseEngine *t,
assert(pc >= pc_base);
assert((size_t)(pc - pc_base) < t->size);
const u8 code = *(const u8 *)pc;
assert(code <= ROSE_INSTR_END);
assert(code <= LAST_ROSE_INSTRUCTION);
switch ((enum RoseInstructionCode)code) {
PROGRAM_CASE(END) {
DEBUG_PRINTF("finished\n");
return HWLM_CONTINUE_MATCHING;
}
PROGRAM_NEXT_INSTRUCTION
PROGRAM_CASE(ANCHORED_DELAY) {
if (in_anchored && end > t->floatingMinLiteralMatchOffset) {
DEBUG_PRINTF("delay until playback\n");
@@ -1971,12 +1977,6 @@ hwlmcb_rv_t roseRunProgram_i(const struct RoseEngine *t,
}
}
PROGRAM_NEXT_INSTRUCTION
PROGRAM_CASE(END) {
DEBUG_PRINTF("finished\n");
return HWLM_CONTINUE_MATCHING;
}
PROGRAM_NEXT_INSTRUCTION
}
}