Branch: Tag:

2001-07-09

2001-07-09 14:19:16 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Almost working computed goto mode.

Rev: src/interpret.c:1.218
Rev: src/interpreter.h:1.64
Rev: src/lex.c:1.96
Rev: src/lex.h:1.18
Rev: src/peep.c:1.53
Rev: src/program.h:1.136

5:   \*/   /**/   #include "global.h" - RCSID("$Id: interpret.c,v 1.217 2001/07/09 11:37:20 grubba Exp $"); + RCSID("$Id: interpret.c,v 1.218 2001/07/09 14:19:15 grubba Exp $");   #include "interpret.h"   #include "object.h"   #include "program.h"
66: Inside #if defined(HAVE_COMPUTED_GOTO)
     #ifdef HAVE_COMPUTED_GOTO   PIKE_OPCODE_T *fcode_to_opcode = NULL; + struct op_2_f *opcode_to_fcode = NULL;   #endif /* HAVE_COMPUTED_GOTO */      PMOD_EXPORT const char *Pike_check_stack_errmsg =
691: Inside #if defined(HAVE_COMPUTED_GOTO)
   fprintf(stderr,"%s:%ld: %s",    file,    (long)line, -  low_get_f_name(backlog[e].instruction, backlog[e].program)); +  get_opcode_name(backlog[e].instruction));   #else /* !HAVE_COMPUTED_GOTO */    if(backlog[e].instruction < 0 || backlog[e].instruction+F_OFFSET > F_MAX_OPCODE)    {
741:   #define EVAL_INSTR_RET_CHECK(x)   #endif    + #ifdef HAVE_COMPUTED_GOTO + int lookup_sort_fun(const void *a, const void *b) + { +  return (int)(((ptrdiff_t)((struct op_2_f *)a)->opcode) - +  ((ptrdiff_t)((struct op_2_f *)b)->opcode)); + } + #endif /* HAVE_COMPUTED_GOTO */ +    /* NOTE: Due to the implementation of computed goto,    * interpreter.h may only be included once.    */
1241:    {    int num_args;    int num_locals; -  unsigned char *pc; +  PIKE_OPCODE_T *pc;      #ifdef PIKE_DEBUG    if (Pike_in_gc > GC_PASS_PREPARE && Pike_in_gc < GC_PASS_FREE)
1251:    debug_malloc_touch(Pike_fp);    pc=new_frame->context.prog->program + function->func.offset;    -  num_locals=EXTRACT_UCHAR(pc++); -  num_args=EXTRACT_UCHAR(pc++); + #ifdef HAVE_COMPUTED_GOTO +  num_locals = (int)(ptrdiff_t)((pc++)[0]); +  num_args = (int)(ptrdiff_t)((pc++)[0]); + #else /* !HAVE_COMPUTED_GOTO */ +  num_locals = EXTRACT_UCHAR(pc++); +  num_args = EXTRACT_UCHAR(pc++); + #endif /* HAVE_COMPUTED_GOTO */      #ifdef PIKE_DEBUG    if(num_locals < num_args)
1294:    new_frame->save_mark_sp=Pike_mark_sp;    new_frame->mark_sp_base=Pike_mark_sp;    check_threads_etc(); -  new_frame->pc=pc; +  new_frame->pc = pc;    return 1;    }    }