3 ms·
I've done a few bytecode interpreters but have mostly used the case of Operator type of driving loop. I was impressed by this static void tbl[] = {&&do_ret, &
by AstroJetson 2y ago
I've done a few bytecode interpreters but have mostly used the case of Operator type of driving loop. I was impressed by this
static void tbl[] = {&&do_ret, &&do_inc, &&do_dec};
#define NEXT goto tbl[*pc++]
NEXT;
for(;;) {
do_ret: return val;
do_inc: val++; NEXT;
do_dec: val--; NEXT;
}