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.   */      #include "global.h"   #include "stralloc.h" - #include "dynamic_buffer.h" + #include "buffer.h"   #include "program.h"   #include "las.h"   #include "docode.h"   #include "pike_embed.h"   #include "pike_error.h"   #include "lex.h"   #include "pike_memory.h"   #include "peep.h"   #include "stuff.h"   #include "bignum.h"
pike.git/src/peep.c:46: Inside #if defined(PIKE_DEBUG)
   fprintf(stderr,",%d",p->arg2);    fprintf(stderr,")");    }   }   #endif         static int asm_opt(void);      /* Output buffer. The optimization eye is at the end of the buffer. */ - dynamic_buffer instrbuf; + struct byte_buffer instrbuf;   long num_instrs = 0;         void init_bytecode(void)   {    buffer_init(&instrbuf);    buffer_ensure_space(&instrbuf, 512);    num_instrs = 0;   }   
pike.git/src/peep.c:73:    length=buffer_content_length(&instrbuf) / 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); +  buffer_free(&instrbuf);   }      /* 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); +  p_instr *p = (p_instr *)buffer_alloc(&instrbuf, sizeof(p_instr));    if (!p) Pike_fatal("Out of memory in peep.\n");    *p = *opcode;    num_instrs++;    return p - (p_instr *)buffer_ptr(&instrbuf);   }      ptrdiff_t insert_opcode2(unsigned int f,    INT32 b,    INT32 c,    INT_TYPE current_line,    struct pike_string *current_file)   {    p_instr *p;      #ifdef PIKE_DEBUG    if(!hasarg2(f) && c)    Pike_fatal("hasarg2(%d) is wrong!\n",f);   #endif    -  p=(p_instr *)low_make_buf_space(sizeof(p_instr), &instrbuf); +  p=(p_instr *)buffer_alloc(&instrbuf, sizeof(p_instr));         #ifdef PIKE_DEBUG    if(!buffer_content_length(&instrbuf))    Pike_fatal("Low make buf space failed!!!!!!\n");   #endif       p->opcode=f;    p->line=current_line;    copy_shared_string(p->file, dmalloc_touch_named(struct pike_string *,
pike.git/src/peep.c:951: Inside #if defined(PIKE_DEBUG)
   if (n > num_instrs)    Pike_fatal("Popping out of instructions.\n");   #endif       p = ((p_instr *)buffer_dst(&instrbuf)) - n;    for (e = 0; e < n; e++) {    free_string(dmalloc_touch_named(struct pike_string *, p[e].file,    "pop_n_opcodes"));    }    num_instrs -= n; -  low_make_buf_space(-((INT32)sizeof(p_instr))*n, &instrbuf); +  buffer_remove(&instrbuf, sizeof(p_instr)*n);   }         /* NOTE: Called with opcodes in reverse order! */   static void do_optimization(int topop, int topush, ...)   {    va_list arglist;    int q=0;    int oplen;    struct pike_string *cf;