--- gforth/vmgen-ex/mini.h 2001/04/29 11:28:24 1.1 +++ gforth/vmgen-ex/mini.h 2002/08/07 10:11:18 1.6 @@ -21,8 +21,13 @@ #include +#ifdef __GNUC__ typedef void *Label; typedef void *Inst; /* for direct threading, the same as Label */ +#else +typedef long Label; +typedef long Inst; +#endif typedef long Cell; extern Inst *vm_prim; @@ -35,6 +40,8 @@ extern char *program_name; extern FILE *vm_out; extern Inst *vmcodep; extern Inst *last_compiled; +extern Inst *vmcode_end; +extern int use_super; /* generic vmgen support functions (e.g., wrappers) */ void gen_inst(Inst **vmcodepp, Inst i); @@ -42,6 +49,19 @@ void init_peeptable(void); void vm_disassemble(Inst *ip, Inst *endp, Inst prim[]); void vm_count_block(Inst *ip); struct block_count *block_insert(Inst *ip); +void vm_print_profile(FILE *file); + +/* type change macros; these are specific to the types you use, so you + have to change this part */ +#define vm_Cell2i(_cell,x) ((x)=(long)(_cell)) +#define vm_Cell2target(_cell,x) ((x)=(Inst *)(_cell)) +#define vm_Cell2a(_cell,x) ((x)=(char *)(_cell)) +#define vm_i2Cell(x,_cell) ((_cell)=(Cell)(x)) +#define vm_target2Cell(x,_cell) ((_cell)=(Cell)(x)) +#define vm_a2Cell(x,_cell) ((_cell)=(Cell)(x)) +#define vm_Cell2Cell(_x,_y) ((_y)=(Cell)(_x)) + +#define VM_IS_INST(inst, n) ((inst) == vm_prim[n]) /* mini type-specific support functions */ void genarg_i(Inst **vmcodepp, Cell i); @@ -49,12 +69,12 @@ void printarg_i(Cell i); void genarg_target(Inst **vmcodepp, Inst *target); void printarg_target(Inst *target); void printarg_a(char *a); +void printarg_Cell(Cell i); /* engine functions (type not fixed) */ Cell engine(Inst *ip0, Cell *sp, char *fp); Cell engine_debug(Inst *ip0, Cell *sp, char *fp); - /* other generic functions */ int yyparse(void);