Vmgen recognizes the following strings in the C code part of simple instructions:
SET_IP
SUPER_END
SET_IP
.
INST_TAIL;
if (branch_condition) { SET_IP(target); INST_TAIL; } /* implicit tail follows here */
In this example, ‘INST_TAIL;’ is not strictly necessary, because there
is another one implicitly after the if-statement, but using it improves
branch prediction accuracy slightly and allows other optimizations.
SUPER_CONTINUE
SET_IP
in the VM instruction. This enables an optimization that
is not yet implemented in the vmgen-ex code (but in Gforth). The
typical application is in conditional VM branches:
if (branch_condition) { SET_IP(target); INST_TAIL; /* now this INST_TAIL is necessary */ } SUPER_CONTINUE;
Note that Vmgen is not smart about C-level tokenization, comments, strings, or conditional compilation, so it will interpret even a commented-out SUPER_END as ending a basic block (or, e.g., ‘RESET_IP;’ as ‘SET_IP;’). Conversely, Vmgen requires the literal presence of these strings; Vmgen will not see them if they are hiding in a C preprocessor macro.