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.109 2006/09/16 15:55:47 grubba Exp $ + || $Id: peep.c,v 1.110 2006/09/16 16:50:08 grubba Exp $   */      #include "global.h"   #include "stralloc.h"   #include "dynamic_buffer.h"   #include "program.h"   #include "las.h"   #include "docode.h"   #include "pike_embed.h"   #include "pike_error.h"
pike.git/src/peep.c:64:    * /grubba 2006-09-16    */   dynamic_buffer instrstack;   long stack_depth = 0;         void init_bytecode(void)   {    initialize_buf(&instrbuf);    num_instrs = 0; -  initialize_buf(&instrstack); -  stack_depth = 0; +    }      void exit_bytecode(void)   {    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(dmalloc_touch_named(struct pike_string *, c[e].file,    "exit_bytecode"));   #ifdef PIKE_DEBUG    c[e].file = (void *)(ptrdiff_t)~0;   #endif    }       toss_buffer(&instrbuf); - #ifdef PIKE_DEBUG -  if (instrstack.s.len) { -  Pike_fatal("PEEP: %d left over instructions on stack.\n", -  instrstack.s.len / sizeof(p_instr)); +    } - #endif -  toss_buffer(&instrstack); - } +       /* insert_opcode{,0,1,2}() append an opcode to the instrbuf. */      ptrdiff_t insert_opcode(p_instr *opcode)   {    /* Note: Steals references from opcode. */    p_instr *p = (p_instr *)low_make_buf_space(sizeof(p_instr), &instrbuf);    if (!p) Pike_fatal("Out of memory in peep.\n");    *p = *opcode;    num_instrs++;
pike.git/src/peep.c:336: Inside #if undefined(INS_ENTRY)
   /* Replace F_ENTRY with F_NOP if we have no entry prologue. */    for (c = (p_instr *) instrbuf.s.str, e = 0; e < length; e++, c++)    if (c->opcode == F_ENTRY) c->opcode = F_NOP;   #endif       labels=(INT32 *)xalloc(sizeof(INT32) * 4 * (max_label+2));    jumps = labels + max_label + 2;    uses = jumps + max_label + 2;    aliases = uses + max_label + 2;    +  initialize_buf(&instrstack); +  stack_depth = 0; +     while(relabel)    {    /* First do the relabel pass. */    for(e=0;e<=max_label;e++)    {    labels[e]=jumps[e]= aliases[e] = -1;    uses[e]=0;    }       c=(p_instr *)instrbuf.s.str;
pike.git/src/peep.c:470: Inside #if 1 and #if defined(PIKE_DEBUG)
  #if 1   #ifdef PIKE_DEBUG    if (a_flag > 3)    fprintf(stderr, "Rerunning optimizer.\n");   #endif   #else /* !1 */    relabel = 0;   #endif /* 1 */    }    + #ifdef PIKE_DEBUG +  if (instrstack.s.len) { +  Pike_fatal("PEEP: %d left over instructions on stack.\n", +  instrstack.s.len / sizeof(p_instr)); +  } + #endif +  toss_buffer(&instrstack); +  stack_depth = 0; +     /* Time to create the actual bytecode. */       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;      #ifdef ALIGN_PIKE_FUNCTION_BEGINNINGS    while( ( (((INT32) PIKE_PC)+2) & (ALIGN_PIKE_JUMPS-1)))    ins_byte(0);