| |
|
| void check_prims(Label symbols1[]) |
void check_prims(Label symbols1[]) |
| { |
{ |
| #ifndef DOUBLY_INDIRECT |
#if defined(IS_NEXT_JUMP) && !defined(DOUBLY_INDIRECT) |
| int i; |
int i; |
| Label *symbols2=engine2(0,0,0,0,0); |
Label *symbols2=engine2(0,0,0,0,0); |
| static char superend[]={ |
static char superend[]={ |
| PrimInfo *pi=&priminfos[i]; |
PrimInfo *pi=&priminfos[i]; |
| int j; |
int j; |
| pi->super_end = superend[i-DOESJUMP-1]; |
pi->super_end = superend[i-DOESJUMP-1]; |
| for (j=prim_len-3; ; j--) { |
for (j=prim_len-IND_JUMP_LENGTH; ; j--) { |
| if (((*(Cell *)(symbols1[i]+j)) & 0xfff8ff) == 0xfc60ff) { |
if (IS_NEXT_JUMP(symbols1[i]+j)) { |
| /* jmp -4(reg), i.e., the NEXT jump */ |
|
| prim_len = j; |
prim_len = j; |
| if (pi->super_end) |
if (pi->super_end) |
| prim_len += 3; /* include the jump */ |
prim_len += IND_JUMP_LENGTH; /* include the jump */ |
| break; |
break; |
| } |
} |
| if (j==0) { /* NEXT jump not found, e.g., execute */ |
if (j==0) { /* NEXT jump not found, e.g., execute */ |
| |
|
| Label compile_prim(Label prim) |
Label compile_prim(Label prim) |
| { |
{ |
| |
#ifdef IND_JUMP_LENGTH |
| int i; |
int i; |
| Address old_code_here=code_here; |
Address old_code_here=code_here; |
| static Address last_jump=0; |
static Address last_jump=0; |
| for (i=0; ; i++) { |
for (i=0; ; i++) { |
| if (i>=npriminfos) { /* not a relocatable prim */ |
if (i>=npriminfos) { /* not a relocatable prim */ |
| if (last_jump) { /* make sure the last sequence is complete */ |
if (last_jump) { /* make sure the last sequence is complete */ |
| memcpy(code_here, last_jump, 3); |
memcpy(code_here, last_jump, IND_JUMP_LENGTH); |
| code_here += 3; |
code_here += IND_JUMP_LENGTH; |
| last_jump = 0; |
last_jump = 0; |
| } |
} |
| return prim; |
return prim; |
| if (priminfos[i].start==prim) |
if (priminfos[i].start==prim) |
| break; |
break; |
| } |
} |
| |
#ifdef ALIGN_CODE |
| |
ALIGN_CODE; |
| |
#endif |
| memcpy(code_here, (Address)prim, priminfos[i].length); |
memcpy(code_here, (Address)prim, priminfos[i].length); |
| code_here += priminfos[i].length; |
code_here += priminfos[i].length; |
| last_jump = (priminfos[i].super_end) ? 0 : (prim+priminfos[i].length); |
last_jump = (priminfos[i].super_end) ? 0 : (prim+priminfos[i].length); |
| return (Label)old_code_here; |
return (Label)old_code_here; |
| |
#else |
| |
return prim; |
| |
#endif |
| } |
} |
| |
|
| Address loader(FILE *imagefile, char* filename) |
Address loader(FILE *imagefile, char* filename) |