2009-04-14 20:12:01 -04:00
|
|
|
#ifndef __OPCODES_H_
|
|
|
|
#define __OPCODES_H_
|
|
|
|
|
|
|
|
enum {
|
|
|
|
OP_NOP=0, OP_DUP, OP_POP, OP_CALL, OP_TCALL, OP_JMP, OP_BRF, OP_BRT,
|
2009-04-24 16:43:56 -04:00
|
|
|
OP_JMPL, OP_BRFL, OP_BRTL, OP_RET,
|
2009-04-14 20:12:01 -04:00
|
|
|
|
|
|
|
OP_EQ, OP_EQV, OP_EQUAL, OP_ATOMP, OP_NOT, OP_NULLP, OP_BOOLEANP,
|
|
|
|
OP_SYMBOLP, OP_NUMBERP, OP_BOUNDP, OP_PAIRP, OP_BUILTINP, OP_VECTORP,
|
2009-04-24 16:43:56 -04:00
|
|
|
OP_FIXNUMP, OP_FUNCTIONP,
|
2009-04-14 20:12:01 -04:00
|
|
|
|
|
|
|
OP_CONS, OP_LIST, OP_CAR, OP_CDR, OP_SETCAR, OP_SETCDR,
|
2009-04-20 20:56:05 -04:00
|
|
|
OP_APPLY,
|
2009-04-14 20:12:01 -04:00
|
|
|
|
2009-05-13 21:30:25 -04:00
|
|
|
OP_ADD, OP_SUB, OP_MUL, OP_DIV, OP_IDIV, OP_NUMEQ, OP_LT, OP_COMPARE,
|
2009-04-14 20:12:01 -04:00
|
|
|
|
2009-04-15 23:05:38 -04:00
|
|
|
OP_VECTOR, OP_AREF, OP_ASET,
|
2009-04-14 20:12:01 -04:00
|
|
|
|
2009-04-15 23:05:38 -04:00
|
|
|
OP_LOADT, OP_LOADF, OP_LOADNIL, OP_LOAD0, OP_LOAD1, OP_LOADI8,
|
2009-06-06 17:15:54 -04:00
|
|
|
OP_LOADV, OP_LOADVL,
|
|
|
|
OP_LOADG, OP_LOADGL,
|
|
|
|
OP_LOADA, OP_LOADAL, OP_LOADC, OP_LOADCL,
|
|
|
|
OP_SETG, OP_SETGL,
|
|
|
|
OP_SETA, OP_SETAL, OP_SETC, OP_SETCL,
|
2009-04-14 20:12:01 -04:00
|
|
|
|
2009-05-13 21:30:25 -04:00
|
|
|
OP_CLOSURE, OP_ARGC, OP_VARGC, OP_TRYCATCH, OP_COPYENV, OP_LET, OP_FOR,
|
2009-06-06 17:15:54 -04:00
|
|
|
OP_TAPPLY, OP_ADD2, OP_SUB2, OP_NEG, OP_LARGC, OP_LVARGC,
|
2009-06-07 23:22:32 -04:00
|
|
|
OP_LOADA0, OP_LOADA1, OP_LOADC00, OP_LOADC01,
|
2009-04-24 16:43:56 -04:00
|
|
|
|
|
|
|
OP_BOOL_CONST_T, OP_BOOL_CONST_F, OP_THE_EMPTY_LIST,
|
2009-04-21 11:35:46 -04:00
|
|
|
|
|
|
|
N_OPCODES
|
2009-04-14 20:12:01 -04:00
|
|
|
};
|
|
|
|
|
2009-06-28 15:47:11 -04:00
|
|
|
#ifdef USE_COMPUTED_GOTO
|
|
|
|
#define VM_LABELS \
|
|
|
|
static void *vm_labels[] = { \
|
|
|
|
&&L_OP_NOP, &&L_OP_DUP, &&L_OP_POP, &&L_OP_CALL, &&L_OP_TCALL, &&L_OP_JMP, \
|
|
|
|
&&L_OP_BRF, &&L_OP_BRT, \
|
|
|
|
&&L_OP_JMPL, &&L_OP_BRFL, &&L_OP_BRTL, &&L_OP_RET, \
|
|
|
|
\
|
|
|
|
&&L_OP_EQ, &&L_OP_EQV, &&L_OP_EQUAL, &&L_OP_ATOMP, &&L_OP_NOT, \
|
|
|
|
&&L_OP_NULLP, &&L_OP_BOOLEANP, \
|
|
|
|
&&L_OP_SYMBOLP, &&L_OP_NUMBERP, &&L_OP_BOUNDP, &&L_OP_PAIRP, \
|
|
|
|
&&L_OP_BUILTINP, &&L_OP_VECTORP, \
|
|
|
|
&&L_OP_FIXNUMP, &&L_OP_FUNCTIONP, \
|
|
|
|
\
|
|
|
|
&&L_OP_CONS, &&L_OP_LIST, &&L_OP_CAR, &&L_OP_CDR, &&L_OP_SETCAR, \
|
|
|
|
&&L_OP_SETCDR, &&L_OP_APPLY, \
|
|
|
|
\
|
|
|
|
&&L_OP_ADD, &&L_OP_SUB, &&L_OP_MUL, &&L_OP_DIV, &&L_OP_IDIV, &&L_OP_NUMEQ, \
|
|
|
|
&&L_OP_LT, &&L_OP_COMPARE, \
|
|
|
|
\
|
|
|
|
&&L_OP_VECTOR, &&L_OP_AREF, &&L_OP_ASET, \
|
|
|
|
\
|
|
|
|
&&L_OP_LOADT, &&L_OP_LOADF, &&L_OP_LOADNIL, &&L_OP_LOAD0, &&L_OP_LOAD1, \
|
|
|
|
&&L_OP_LOADI8, \
|
|
|
|
&&L_OP_LOADV, &&L_OP_LOADVL, \
|
|
|
|
&&L_OP_LOADG, &&L_OP_LOADGL, \
|
|
|
|
&&L_OP_LOADA, &&L_OP_LOADAL, &&L_OP_LOADC, &&L_OP_LOADCL, \
|
|
|
|
&&L_OP_SETG, &&L_OP_SETGL, \
|
|
|
|
&&L_OP_SETA, &&L_OP_SETAL, &&L_OP_SETC, &&L_OP_SETCL, \
|
|
|
|
\
|
|
|
|
&&L_OP_CLOSURE, &&L_OP_ARGC, &&L_OP_VARGC, &&L_OP_TRYCATCH, \
|
|
|
|
&&L_OP_COPYENV, \
|
|
|
|
&&L_OP_LET, &&L_OP_FOR, \
|
|
|
|
&&L_OP_TAPPLY, &&L_OP_ADD2, &&L_OP_SUB2, &&L_OP_NEG, &&L_OP_LARGC, \
|
|
|
|
&&L_OP_LVARGC, \
|
|
|
|
&&L_OP_LOADA0, &&L_OP_LOADA1, &&L_OP_LOADC00, &&L_OP_LOADC01 \
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
#define VM_LABELS
|
|
|
|
#endif
|
|
|
|
|
2009-04-14 20:12:01 -04:00
|
|
|
#endif
|