pike.git / src / peep.c

version» Context lines:

pike.git/src/peep.c:10:   #include "lex.h"   #include "pike_memory.h"   #include "peep.h"   #include "dmalloc.h"   #include "stuff.h"   #include "bignum.h"   #include "opcodes.h"   #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);      dynamic_buffer instrbuf;      static int hasarg(int opcode)   {    return instrs[opcode-F_OFFSET].flags & I_HASARG;   }   
pike.git/src/peep.c:140: Inside #if defined(PIKE_DEBUG)
  #ifdef PIKE_DEBUG    if(store_linenumbers && b<F_MAX_OPCODE)    ADD_COMPILED(b);   #endif /* PIKE_DEBUG */       b-=F_OFFSET;   #ifdef 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;    case 1 : ins_f_byte(F_PREFIX_256); break;    case 2 : ins_f_byte(F_PREFIX_512); break;    case 3 : ins_f_byte(F_PREFIX_768); break;    case 4 : ins_f_byte(F_PREFIX_1024); break;    default:    if( b < 256*256)    {
pike.git/src/peep.c:168:    ins_f_byte(F_PREFIX_WORDX256);    add_to_program((unsigned char)(b>>16));    add_to_program((unsigned char)(b>>8));    }else{    ins_f_byte(F_PREFIX_24BITX256);    add_to_program((unsigned char)(b>>24));    add_to_program((unsigned char)(b>>16));    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;    case 1 : ins_f_byte(F_PREFIX2_256); break;    case 2 : ins_f_byte(F_PREFIX2_512); break;    case 3 : ins_f_byte(F_PREFIX2_768); break;    case 4 : ins_f_byte(F_PREFIX2_1024); break;    default:    if( b < 256*256)    {
pike.git/src/peep.c:200:    ins_f_byte(F_PREFIX2_WORDX256);    add_to_program((unsigned char)(b>>16));    add_to_program((unsigned char)(b>>8));    }else{    ins_f_byte(F_PREFIX2_24BITX256);    add_to_program((unsigned char)(b>>24));    add_to_program((unsigned char)(b>>16));    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)   {    INT32 d,max_label,tmp;    INT32 *labels, *jumps, *uses;    ptrdiff_t e, length;    p_instr *c;    int reoptimize=!(debug_options & NO_PEEP_OPTIMIZING);   #ifdef PIKE_DEBUG
pike.git/src/peep.c:350:    {    case F_NOP:    case F_NOTREACHED:    case F_START_FUNCTION:    break;    case F_ALIGN:    while(PC % c->arg) add_to_program(0);    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:    if(c->arg == -1) break;   #ifdef PIKE_DEBUG    if(c->arg > max_label || c->arg < 0)    fatal("max_label calculation failed!\n");       if(labels[c->arg] != -1)    fatal("Duplicate label!\n");
pike.git/src/peep.c:384:    switch(instrs[c->opcode - F_OFFSET].flags)    {    case I_ISJUMP:    ins_f_byte(c->opcode);       case I_ISPOINTER:   #ifdef PIKE_DEBUG    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:    ins_f_byte_with_arg(c->opcode, c->arg);    break;       case 0:    ins_f_byte(c->opcode);    break;