Skip to content

Instantly share code, notes, and snippets.

@yashi
Created April 21, 2012 02:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yashi/2433372 to your computer and use it in GitHub Desktop.
Save yashi/2433372 to your computer and use it in GitHub Desktop.
#define DIRECT_THREADED
#ifndef DIRECT_THREADED
#define INIT_DISPACTH for (;;) { i = *pc; switch (GET_OPCODE(i)) {
#define CASE(op) case op:
#define NEXT mrb->arena_idx = ai; pc++; break
#define JUMP break
#define END_DISPACTH }}
#else
#define INIT_DISPACTH JUMP; return mrb_nil_value();
#define CASE(op) L_ ## op:
#define NEXT mrb->arena_idx = ai; i=*++pc; goto *optable[GET_OPCODE(i)]
#define JUMP i=*pc; goto *optable[GET_OPCODE(i)]
#define END_DISPACTH
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment