|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef VM_LABEL |
|
#define VM_LABEL(tag) l_##tag |
|
#define VM_OPCODE(tag) scm_op_##tag |
|
|
|
#ifdef HAVE_LABELS_AS_VALUES |
|
#define VM_TAG(tag) VM_LABEL(tag): |
|
#define VM_ADDR(tag) &&VM_LABEL(tag) |
|
#else |
|
#define VM_TAG(tag) case VM_OPCODE(tag): |
|
#define VM_ADDR(tag) NULL |
|
#endif |
|
#endif |
|
|
|
#undef VM_DEFINE_FUNCTION |
|
#undef VM_DEFINE_LOADER |
|
#define VM_DEFINE_FUNCTION(code,tag,name,nargs) \ |
|
VM_DEFINE_INSTRUCTION(code,tag,name,0,nargs,1) |
|
#define VM_DEFINE_LOADER(code,tag,name) \ |
|
VM_DEFINE_INSTRUCTION(code,tag,name,-1,0,1) |
|
|
|
#undef VM_DEFINE_INSTRUCTION |
|
|
|
|
|
|
|
#ifdef VM_INSTRUCTION_TO_TABLE |
|
#define VM_DEFINE_INSTRUCTION(code_,tag_,name_,len_,npop_,npush_) \ |
|
table[VM_OPCODE (tag_)].opcode = code_; \ |
|
table[VM_OPCODE (tag_)].name = name_; \ |
|
table[VM_OPCODE (tag_)].len = len_; \ |
|
table[VM_OPCODE (tag_)].npop = npop_; \ |
|
table[VM_OPCODE (tag_)].npush = npush_; |
|
|
|
#else |
|
#ifdef VM_INSTRUCTION_TO_LABEL |
|
|
|
|
|
|
|
#define VM_DEFINE_INSTRUCTION(code,tag,name,len,npop,npush) jump_table[code] = VM_ADDR (tag); |
|
|
|
#else |
|
#ifdef VM_INSTRUCTION_TO_OPCODE |
|
|
|
|
|
|
|
#define VM_DEFINE_INSTRUCTION(code,tag,name,len,npop,npush) VM_OPCODE (tag) = code, |
|
|
|
#else |
|
|
|
|
|
|
|
#define VM_DEFINE_INSTRUCTION(code,tag,name,len,npop,npush) VM_TAG (tag) |
|
|
|
#endif |
|
#endif |
|
#endif |
|
|