version 1.72, 2002/12/07 17:43:35
|
version 1.73, 2002/12/08 09:57:54
|
Line 81 char *progname = "gforth";
|
Line 81 char *progname = "gforth";
|
int optind = 1; |
int optind = 1; |
#endif |
#endif |
|
|
|
#define CODE_BLOCK_SIZE (1024*1024) |
Address code_area=0; |
Address code_area=0; |
|
Cell code_area_size = CODE_BLOCK_SIZE; |
Address code_here=0; /* does for code-area what HERE does for the dictionary */ |
Address code_here=0; /* does for code-area what HERE does for the dictionary */ |
Address start_flush=0; /* start of unflushed code */ |
Address start_flush=0; /* start of unflushed code */ |
|
|
Line 370 void alloc_stacks(ImageHeader * header)
|
Line 372 void alloc_stacks(ImageHeader * header)
|
header->fp_stack_base=my_alloc(fsize); |
header->fp_stack_base=my_alloc(fsize); |
header->return_stack_base=my_alloc(rsize); |
header->return_stack_base=my_alloc(rsize); |
header->locals_stack_base=my_alloc(lsize); |
header->locals_stack_base=my_alloc(lsize); |
code_here = start_flush = code_area = my_alloc(dictsize); |
code_here = start_flush = code_area = my_alloc(code_area_size); |
} |
} |
|
|
#warning You can ignore the warnings about clobbered variables in go_forth |
#warning You can ignore the warnings about clobbered variables in go_forth |
Line 563 struct doesexecinfo {
|
Line 565 struct doesexecinfo {
|
Cell *xt; /* cfa of word whose does-code needs calling */ |
Cell *xt; /* cfa of word whose does-code needs calling */ |
} doesexecinfos[10000]; |
} doesexecinfos[10000]; |
|
|
#define N_EXECUTE 10 |
/* definitions of N_execute etc. */ |
#define N_PERFORM 11 |
#include "prim_num.i" |
#define N_LIT_PERFORM 337 |
|
#define N_CALL 333 |
|
#define N_DOES_EXEC 339 |
|
#define N_LIT 9 |
|
#define N_CALL2 362 |
|
#define N_ABRANCH 341 |
|
#define N_SET_NEXT_CODE 361 |
|
|
|
void set_rel_target(Cell *source, Label target) |
void set_rel_target(Cell *source, Label target) |
{ |
{ |
Line 599 Cell *compile_prim1arg(Cell p)
|
Line 594 Cell *compile_prim1arg(Cell p)
|
Cell *compile_call2(Cell targetptr) |
Cell *compile_call2(Cell targetptr) |
{ |
{ |
Cell *next_code_target; |
Cell *next_code_target; |
PrimInfo *pi = &priminfos[N_CALL2]; |
PrimInfo *pi = &priminfos[N_call2]; |
|
|
memcpy(code_here, pi->start, pi->length); |
memcpy(code_here, pi->start, pi->length); |
next_code_target = (Cell *)(code_here + pi->immargs[0].offset); |
next_code_target = (Cell *)(code_here + pi->immargs[0].offset); |
Line 653 void compile_prim1(Cell *start)
|
Line 648 void compile_prim1(Cell *start)
|
Cell *next_code_target=NULL; |
Cell *next_code_target=NULL; |
|
|
assert(i<npriminfos); |
assert(i<npriminfos); |
if (i==N_EXECUTE||i==N_PERFORM||i==N_LIT_PERFORM) { |
if (i==N_execute||i==N_perform||i==N_lit_perform) { |
next_code_target = compile_prim1arg(N_SET_NEXT_CODE); |
next_code_target = compile_prim1arg(N_set_next_code); |
} |
} |
if (i==N_CALL) { |
if (i==N_call) { |
next_code_target = compile_call2(last_start[1]); |
next_code_target = compile_call2(last_start[1]); |
} else if (i==N_DOES_EXEC) { |
} else if (i==N_does_exec) { |
struct doesexecinfo *dei = &doesexecinfos[ndoesexecinfos++]; |
struct doesexecinfo *dei = &doesexecinfos[ndoesexecinfos++]; |
*compile_prim1arg(N_LIT) = (Cell)PFA(last_start[1]); |
*compile_prim1arg(N_lit) = (Cell)PFA(last_start[1]); |
/* we cannot determine the callee now (last_start[1] may be a |
/* we cannot determine the callee now (last_start[1] may be a |
forward reference), so just register an arbitrary target, and |
forward reference), so just register an arbitrary target, and |
register in dei that we need to fix this before resolving |
register in dei that we need to fix this before resolving |
Line 669 void compile_prim1(Cell *start)
|
Line 664 void compile_prim1(Cell *start)
|
dei->xt = (Cell *)(last_start[1]); |
dei->xt = (Cell *)(last_start[1]); |
next_code_target = compile_call2(NULL); |
next_code_target = compile_call2(NULL); |
} else if (pi->start == NULL) { /* non-reloc */ |
} else if (pi->start == NULL) { /* non-reloc */ |
next_code_target = compile_prim1arg(N_SET_NEXT_CODE); |
next_code_target = compile_prim1arg(N_set_next_code); |
set_rel_target(compile_prim1arg(N_ABRANCH),*(Xt)last_prim); |
set_rel_target(compile_prim1arg(N_abranch),*(Xt)last_prim); |
} else { |
} else { |
unsigned j; |
unsigned j; |
|
|