2001-07-08
2001-07-08 20:47:07 by Henrik Grubbström (Grubba) <grubba@grubba.org>
-
fe19fda4f17bf2d150c88851d4da59157703cd4f
(30 lines)
(+25/-5)
[
Show
| Annotate
]
Branch: 7.9
Begun implementing generation of computed goto code.
Rev: src/peep.c:1.50
Rev: src/program_areas.h:1.8
17:
#include "builtin_functions.h"
#include "constants.h"
- RCSID("$Id: peep.c,v 1.49 2001/07/02 04:09:49 hubbe Exp $");
+ RCSID("$Id: peep.c,v 1.50 2001/07/08 20:47:07 grubba Exp $");
static void asm_opt(void);
147: Inside #if defined(PIKE_DEBUG)
if(b>255)
Pike_error("Instruction too big %d\n",b);
#endif
+ #ifdef HAVE_COMPUTED_GOTO
+ add_to_program(fcode_to_opcode[b-1]);
+ #else /* !HAVE_COMPUTED_GOTO */
add_to_program((unsigned char)b);
-
+ #endif /* HAVE_COMPUTED_GOTO */
}
static void ins_f_byte_with_arg(unsigned int a,unsigned INT32 b)
{
-
+ #ifndef HAVE_COMPUTED_GOTO
switch(b >> 8)
{
case 0 : break;
175:
add_to_program((unsigned char)(b>>8));
}
}
+ #endif /* !HAVE_COMPUTED_GOTO */
ins_f_byte(a);
- add_to_program((unsigned char)b);
+ add_to_program((PIKE_OPCODE_T)b);
}
static void ins_f_byte_with_2_args(unsigned int a,
unsigned INT32 c,
unsigned INT32 b)
{
-
+ #ifndef HAVE_COMPUTED_GOTO
switch(b >> 8)
{
case 0 : break;
207:
add_to_program((unsigned char)(b>>8));
}
}
+ #endif /* !HAVE_COMPUTED_GOTO */
ins_f_byte_with_arg(a,c);
- add_to_program((unsigned char)b);
+ add_to_program((PIKE_OPCODE_T)b);
}
void assemble(void)
357:
break;
case F_BYTE:
+ #ifdef HAVE_COMPUTED_GOTO
+ add_to_program((void *)(ptrdiff_t)(unsigned char)(c->arg));
+ #else /* !HAVE_COMPUTED_GOTO */
add_to_program((unsigned char)(c->arg));
-
+ #endif /* HAVE_COMPUTED_GOTO */
break;
case F_DATA:
-
+ #ifdef HAVE_COMPUTED_GOTO
+ add_to_program((void *)(ptrdiff_t)c->arg);
+ #else /* !HAVE_COMPUTED_GOTO */
ins_int(c->arg, (void(*)(char))add_to_program);
-
+ #endif /* HAVE_COMPUTED_GOTO */
break;
case F_LABEL:
391:
if(c->arg > max_label || c->arg < 0) fatal("Jump to unknown label?\n");
#endif
tmp = DO_NOT_WARN((INT32)PC);
+ #fidef HAVE_COMPUTED_GOTO
+ add_to_program(jumps[c->arg]);
+ #else /* !HAVE_COMPUTED_GOTO */
ins_int(jumps[c->arg], (void(*)(char))add_to_program);
-
+ #endif /* HAVE_COMPUTED_GOTO */
jumps[c->arg]=tmp;
break;
case I_TWO_ARGS:
- ins_f_byte_with_2_args(c->opcode, c->arg,c->arg2);
+ ins_f_byte_with_2_args(c->opcode, c->arg, c->arg2);
break;
case I_HASARG: