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: lex.c,v 1.95 2001/07/09 11:37:21 grubba Exp $"); + RCSID("$Id: lex.c,v 1.96 2001/07/09 14:19:16 grubba Exp $");   #include "language.h"   #include "array.h"   #include "lex.h"
85: Inside #if defined(INSTR_PROFILING)
   tmp=tmp[0]->next + last_instruction[e];    last_instruction[e]=last_instruction[e+1];    } + #ifndef HAVE_COMPUTED_GOTO    ((char **)(tmp))[0]++; -  + #endif /* !HAVE_COMPUTED_GOTO */    last_instruction[e]=instr;   }   
323:    }   }    + #ifdef HAVE_COMPUTED_GOTO + char *get_opcode_name(PIKE_OPCODE_T n) + { +  int fcode; +  int low = 0; +  int high = F_MAX_OPCODE - F_OFFSET; +  static char buf[64]; +  +  if (!n) { +  return "<NULL opcode!>"; +  } +  +  while (low < high) { +  int mid = (low+high)/2; +  if (opcode_to_fcode[mid].opcode < n) { +  low = mid + 1; +  } else if (opcode_to_fcode[mid].opcode > n) { +  high = mid; +  } else { +  return get_f_name(opcode_to_fcode[mid].fcode); +  } +  } +  +  sprintf(buf, "<Unknown opcode 0x%p>", n); +  return buf; + } + #endif /* HAVE_COMPUTED_GOTO */ +    char *get_token_name(int n)   {    static char buf[30];