pike.git / src / peep.c

version» Context lines:

pike.git/src/peep.c:1:   /*   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: peep.c,v 1.89 2003/09/26 13:20:49 grubba Exp $ + || $Id: peep.c,v 1.90 2003/10/10 01:18:25 mast Exp $   */      #include "global.h"   #include "language.h"   #include "stralloc.h"   #include "dynamic_buffer.h"   #include "program.h"   #include "las.h"   #include "docode.h"   #include "main.h"
pike.git/src/peep.c:19:   #include "peep.h"   #include "dmalloc.h"   #include "stuff.h"   #include "bignum.h"   #include "opcodes.h"   #include "builtin_functions.h"   #include "constants.h"   #include "interpret.h"   #include "pikecode.h"    - RCSID("$Id: peep.c,v 1.89 2003/09/26 13:20:49 grubba Exp $"); + RCSID("$Id: peep.c,v 1.90 2003/10/10 01:18:25 mast Exp $");      static void asm_opt(void);      dynamic_buffer instrbuf;      #ifdef PIKE_DEBUG   static int hasarg(int opcode)   {    return instrs[opcode-F_OFFSET].flags & I_HASARG;   }
pike.git/src/peep.c:271:    continue;       case TWOO(F_LAND,F_BRANCH_WHEN_ZERO):    c[e].opcode=F_BRANCH_WHEN_ZERO;    case TWOO(F_LAND,F_LAND):    c[e].arg=c[tmp].arg;    continue;       case TWOO(F_LOR, F_RETURN):    c[e].opcode=F_RETURN_IF_TRUE; -  break; +  goto pointer_opcode_done;       case TWOO(F_BRANCH, F_RETURN):    case TWOO(F_BRANCH, F_RETURN_0):    case TWOO(F_BRANCH, F_RETURN_1):    case TWOO(F_BRANCH, F_RETURN_LOCAL):    if(c[e].file) free_string(c[e].file);    c[e]=c[tmp];    if(c[e].file) add_ref(c[e].file); -  break; +  goto pointer_opcode_done;    }    break;    } -  + #ifdef PIKE_DEBUG +  if (c[e].arg < 0 || c[e].arg > max_label) +  Pike_fatal ("Invalid index into uses: %d\n", c[e].arg); + #endif    uses[c[e].arg]++;    } -  +  pointer_opcode_done:;    }       for(e=0;e<=max_label;e++)    {    if(!uses[e] && labels[e]>=0)    {    c[labels[e]].opcode=F_NOP;    reoptimize++;    }    }    if(!reoptimize) break;       asm_opt();   #if 1 -  /* fprintf(stderr, "Rerunning optimizer.\n"); */ + #ifdef PIKE_DEBUG +  if (a_flag > 3) +  fprintf(stderr, "Rerunning optimizer.\n"); + #endif   #else /* !1 */    reoptimize=0;   #endif /* 1 */    }       c=(p_instr *)instrbuf.s.str;    length=instrbuf.s.len / sizeof(p_instr);       for(e=0;e<=max_label;e++) labels[e]=jumps[e]=-1;   
pike.git/src/peep.c:880: Inside #if defined(PIKE_DEBUG)
  #ifdef PIKE_DEBUG    if(a_flag > 3)    {    p_instr *c;    ptrdiff_t e, length;    int synch_depth = 0;       c=(p_instr *)instrbuf.s.str;    length=instrbuf.s.len / sizeof(p_instr);    -  fprintf(stderr,"Optimization begins: \n"); +  fprintf(stderr,"Before peep optimization:\n");    for(e=0;e<length;e++,c++)    {    if (c->opcode == F_POP_SYNCH_MARK) synch_depth--; -  fprintf(stderr,"---%4d: %*s",c->line,synch_depth,""); +  fprintf(stderr,"<<<%4d: %*s",c->line,synch_depth,"");    dump_instr(c);    fprintf(stderr,"\n");    if (c->opcode == F_SYNCH_MARK) synch_depth++;    }    }   #endif      #include "peep_engine.c"      #ifdef PIKE_DEBUG    if(a_flag > 4)    {    p_instr *c;    ptrdiff_t e, length; -  +  int synch_depth = 0;       c=(p_instr *)instrbuf.s.str;    length=instrbuf.s.len / sizeof(p_instr);    -  fprintf(stderr,"Optimization begins: \n"); +  fprintf(stderr,"After peep optimization:\n");    for(e=0;e<length;e++,c++)    { -  fprintf(stderr,">>>%3d: ",c->line); +  if (c->opcode == F_POP_SYNCH_MARK) synch_depth--; +  fprintf(stderr,">>>%4d: %*s",c->line,synch_depth,"");    dump_instr(c);    fprintf(stderr,"\n"); -  +  if (c->opcode == F_SYNCH_MARK) synch_depth++;    }    }   #endif   }