pike.git / src / peep.c

version» Context lines:

pike.git/src/peep.c:8:   #include "main.h"   #include "error.h"   #include "lex.h"   #include "pike_memory.h"   #include "peep.h"   #include "dmalloc.h"   #include "stuff.h"   #include "bignum.h"   #include "opcodes.h"    - RCSID("$Id: peep.c,v 1.33 2000/05/11 14:09:46 grubba Exp $"); + RCSID("$Id: peep.c,v 1.34 2000/08/14 17:18:06 grubba Exp $");      struct p_instr_s   {    short opcode;    short line;    struct pike_string *file;    INT32 arg;    INT32 arg2;   };   
pike.git/src/peep.c:58:            void init_bytecode(void)   {    low_reinit_buf(&instrbuf);   }      void exit_bytecode(void)   { -  INT32 e,length; +  ptrdiff_t e, length;    p_instr *c;       c=(p_instr *)instrbuf.s.str;    length=instrbuf.s.len / sizeof(p_instr);       for(e=0;e<length;e++) free_string(c->file);       toss_buffer(&instrbuf);   }    - int insert_opcode2(unsigned int f, + ptrdiff_t insert_opcode2(unsigned int f,    INT32 b,    INT32 c,    INT32 current_line,    struct pike_string *current_file)   {    p_instr *p;      #ifdef PIKE_DEBUG    if(!hasarg2(f) && c)    fatal("hasarg2(%d) is wrong!\n",f);
pike.git/src/peep.c:99:       p->opcode=f;    p->line=current_line;    copy_shared_string(p->file, current_file);    p->arg=b;    p->arg2=c;       return p - (p_instr *)instrbuf.s.str;   }    - int insert_opcode1(unsigned int f, + ptrdiff_t insert_opcode1(unsigned int f,    INT32 b,    INT32 current_line,    struct pike_string *current_file)   {   #ifdef PIKE_DEBUG    if(!hasarg(f) && b)    fatal("hasarg(%d) is wrong!\n",f);   #endif       return insert_opcode2(f,b,0,current_line,current_file);   }    - int insert_opcode0(int f,int current_line, struct pike_string *current_file) + ptrdiff_t insert_opcode0(int f,int current_line, struct pike_string *current_file)   {   #ifdef PIKE_DEBUG    if(hasarg(f))    fatal("hasarg(%d) is wrong!\n",f);   #endif    return insert_opcode1(f,0,current_line, current_file);   }         void update_arg(int instr,INT32 arg)
pike.git/src/peep.c:214:    add_to_program(b>>16);    add_to_program(b>>8);    }    }    ins_f_byte_with_arg(a,c);    add_to_program(b);   }      void assemble(void)   { -  INT32 e,d,length,max_label,tmp; +  INT32 d,max_label,tmp;    INT32 *labels, *jumps, *uses; -  +  ptrdiff_t e, length;    p_instr *c;       c=(p_instr *)instrbuf.s.str;    length=instrbuf.s.len / sizeof(p_instr);       max_label=-1;    for(e=0;e<length;e++,c++)    if(c->opcode == F_LABEL)    if(c->arg > max_label)    max_label = c->arg;
pike.git/src/peep.c:241:       for(e=0;e<=max_label;e++)    {    labels[e]=jumps[e]=-1;    uses[e]=0;    }       c=(p_instr *)instrbuf.s.str;    for(e=0;e<length;e++)    if(c[e].opcode == F_LABEL && c[e].arg>=0) -  labels[c[e].arg]=e; +  labels[c[e].arg]=DO_NOT_WARN((INT32)e);       for(e=0;e<length;e++)    {    if(instrs[c[e].opcode-F_OFFSET].flags & I_POINTER)    {    while(1)    {    int tmp,tmp2;    tmp=labels[c[e].arg];   
pike.git/src/peep.c:405:    free((char *)jumps);    free((char *)uses);          exit_bytecode();   }      /**** Peephole optimizer ****/      int remove_clear_locals=0x7fffffff; - static int fifo_len, eye,len; + static int fifo_len; + static ptrdiff_t eye, len;   static p_instr *instructions;    - int insopt2(int f, INT32 a, INT32 b, int cl, struct pike_string *cf) + ptrdiff_t insopt2(int f, INT32 a, INT32 b, int cl, struct pike_string *cf)   {    p_instr *p;      #ifdef PIKE_DEBUG    if(!hasarg2(f) && b)    fatal("hasarg(%d) is wrong!\n",f);   #endif       p=(p_instr *)low_make_buf_space(sizeof(p_instr), &instrbuf);   
pike.git/src/peep.c:439:       p->opcode=f;    p->line=cl;    copy_shared_string(p->file, lex.current_file);    p->arg=a;    p->arg2=b;       return p - (p_instr *)instrbuf.s.str;   }    - int insopt1(int f, INT32 a, int cl, struct pike_string *cf) + ptrdiff_t insopt1(int f, INT32 a, int cl, struct pike_string *cf)   {   #ifdef PIKE_DEBUG    if(!hasarg(f) && a)    fatal("hasarg(%d) is wrong!\n",f);   #endif       return insopt2(f,a,0,cl, cf);   }    - int insopt0(int f, int cl, struct pike_string *cf) + ptrdiff_t insopt0(int f, int cl, struct pike_string *cf)   {   #ifdef PIKE_DEBUG    if(hasarg(f))    fatal("hasarg(%d) is wrong!\n",f);   #endif    return insopt2(f,0,0,cl, cf);   }      static void debug(void)   {
pike.git/src/peep.c:647:    fifo_len+=q + 3;   }         static void asm_opt(void)   {   #ifdef PIKE_DEBUG    if(a_flag > 3)    {    p_instr *c; -  INT32 e,length; +  ptrdiff_t e, length; +     c=(p_instr *)instrbuf.s.str;    length=instrbuf.s.len / sizeof(p_instr);       fprintf(stderr,"Optimization begins: \n");    for(e=0;e<length;e++,c++)    {    fprintf(stderr,"---%3d: ",c->line);    dump_instr(c);    fprintf(stderr,"\n");    }
pike.git/src/peep.c:669:   #endif      #ifndef IN_TPIKE   #include "peep_engine.c"   #endif /* IN_TPIKE */      #ifdef PIKE_DEBUG    if(a_flag > 4)    {    p_instr *c; -  INT32 e,length; +  ptrdiff_t e, length; +     c=(p_instr *)instrbuf.s.str;    length=instrbuf.s.len / sizeof(p_instr);       fprintf(stderr,"Optimization begins: \n");    for(e=0;e<length;e++,c++)    {    fprintf(stderr,">>>%3d: ",c->line);    dump_instr(c);    fprintf(stderr,"\n");    }    }   #endif   }