pike.git / src / interpret.c

version» Context lines:

pike.git/src/interpret.c:1:   /*\   ||| This file a part of Pike, and is copyright by Fredrik Hubinette   ||| Pike is distributed as GPL (General Public License)   ||| See the files COPYING and DISCLAIMER for more information.   \*/   /**/   #include "global.h" - RCSID("$Id: interpret.c,v 1.182 2001/01/12 02:09:28 mast Exp $"); + RCSID("$Id: interpret.c,v 1.183 2001/01/24 08:17:27 hubbe Exp $");   #include "interpret.h"   #include "object.h"   #include "program.h"   #include "svalue.h"   #include "array.h"   #include "mapping.h"   #include "pike_error.h"   #include "language.h"   #include "stralloc.h"   #include "constants.h"
pike.git/src/interpret.c:75: Inside #if defined(PIKE_DEBUG)
     #ifdef PIKE_DEBUG   static char trace_buffer[2000];   #endif         /* Pike_sp points to first unused value on stack    * (much simpler than letting it point at the last used value.)    */   PMOD_EXPORT struct Pike_interpreter Pike_interpreter; - PMOD_EXPORT int stack_size = EVALUATOR_STACK_SIZE; + PMOD_EXPORT int Pike_stack_size = EVALUATOR_STACK_SIZE;         /* mark stack, used to store markers into the normal stack */   int mark_stack_malloced = 0;      void push_sp_mark(void)   { -  if(Pike_mark_sp == Pike_interpreter.mark_stack + stack_size) +  if(Pike_mark_sp == Pike_interpreter.mark_stack + Pike_stack_size)    Pike_error("No more mark stack!\n");    *Pike_mark_sp++=Pike_sp;   }   ptrdiff_t pop_sp_mark(void)   {   #ifdef PIKE_DEBUG    if(Pike_mark_sp < Pike_interpreter.mark_stack)    fatal("Mark stack underflow!\n");   #endif    return Pike_sp - *--Pike_mark_sp;
pike.git/src/interpret.c:158:    }    /* Don't keep this fd on exec() */    set_close_on_exec(fd, 1);    }   #endif      #define MMALLOC(X,Y) (Y *)mmap(0,X*sizeof(Y),PROT_READ|PROT_WRITE, MAP_NORESERVE | MAP_PRIVATE | MAP_ANONYMOUS, fd, 0)       Pike_interpreter.evaluator_stack_malloced=0;    mark_stack_malloced=0; -  Pike_interpreter.evaluator_stack=MMALLOC(stack_size,struct svalue); -  Pike_interpreter.mark_stack=MMALLOC(stack_size, struct svalue *); +  Pike_interpreter.evaluator_stack=MMALLOC(Pike_stack_size,struct svalue); +  Pike_interpreter.mark_stack=MMALLOC(Pike_stack_size, struct svalue *);    if((char *)MAP_FAILED == (char *)Pike_interpreter.evaluator_stack) Pike_interpreter.evaluator_stack=0;    if((char *)MAP_FAILED == (char *)Pike_interpreter.mark_stack) Pike_interpreter.mark_stack=0;   #else    Pike_interpreter.evaluator_stack=0;    Pike_interpreter.mark_stack=0;   #endif      use_malloc:    if(!Pike_interpreter.evaluator_stack)    { -  Pike_interpreter.evaluator_stack=(struct svalue *)xalloc(stack_size*sizeof(struct svalue)); +  Pike_interpreter.evaluator_stack=(struct svalue *)xalloc(Pike_stack_size*sizeof(struct svalue));    Pike_interpreter.evaluator_stack_malloced=1;    }       if(!Pike_interpreter.mark_stack)    { -  Pike_interpreter.mark_stack=(struct svalue **)xalloc(stack_size*sizeof(struct svalue *)); +  Pike_interpreter.mark_stack=(struct svalue **)xalloc(Pike_stack_size*sizeof(struct svalue *));    mark_stack_malloced=1;    }       Pike_sp=Pike_interpreter.evaluator_stack;    Pike_mark_sp=Pike_interpreter.mark_stack;    Pike_fp=0;       Pike_interpreter.svalue_stack_margin = SVALUE_STACK_MARGIN;    Pike_interpreter.c_stack_margin = C_STACK_MARGIN;   
pike.git/src/interpret.c:1630:   }      #ifdef PIKE_DEBUG   void slow_check_stack(void)   {    struct svalue *s,**m;    struct pike_frame *f;       debug_check_stack();    -  if(Pike_sp > &(Pike_interpreter.evaluator_stack[stack_size])) +  if(Pike_sp > &(Pike_interpreter.evaluator_stack[Pike_stack_size]))    fatal("Svalue stack overflow. "    "(%ld entries on stack, stack_size is %ld entries)\n",    PTRDIFF_T_TO_LONG(Pike_sp - Pike_interpreter.evaluator_stack), -  PTRDIFF_T_TO_LONG(stack_size)); +  PTRDIFF_T_TO_LONG(Pike_stack_size));    -  if(Pike_mark_sp > &(Pike_interpreter.mark_stack[stack_size])) +  if(Pike_mark_sp > &(Pike_interpreter.mark_stack[Pike_stack_size]))    fatal("Mark stack overflow.\n");       if(Pike_mark_sp < Pike_interpreter.mark_stack)    fatal("Mark stack underflow.\n");       for(s=Pike_interpreter.evaluator_stack;s<Pike_sp;s++) check_svalue(s);       s=Pike_interpreter.evaluator_stack;    for(m=Pike_interpreter.mark_stack;m<Pike_mark_sp;m++)    {    if(*m < s)    fatal("Mark stack failure.\n");       s=*m;    }    -  if(s > &(Pike_interpreter.evaluator_stack[stack_size])) +  if(s > &(Pike_interpreter.evaluator_stack[Pike_stack_size]))    fatal("Mark stack exceeds svalue stack\n");       for(f=Pike_fp;f;f=f->next)    {    if(f->locals)    {    if(f->locals < Pike_interpreter.evaluator_stack || -  f->locals > &(Pike_interpreter.evaluator_stack[stack_size])) +  f->locals > &(Pike_interpreter.evaluator_stack[Pike_stack_size]))    fatal("Local variable pointer points to FinspĂ„ng.\n");    -  if(f->args < 0 || f->args > stack_size) +  if(f->args < 0 || f->args > Pike_stack_size)    fatal("FEL FEL FEL! HELP!! (corrupted pike_frame)\n");    }    }   }   #endif      PMOD_EXPORT void custom_check_stack(ptrdiff_t amount, const char *fmt, ...)   {    if (low_stack_check(amount)) {    va_list args;
pike.git/src/interpret.c:1704: Inside #if defined(PIKE_DEBUG)
   free_program(backlog[e].program);    backlog[e].program=0;    }    }   #endif    reset_evaluator();      #ifdef USE_MMAP_FOR_STACK    if(!Pike_interpreter.evaluator_stack_malloced)    { -  munmap((char *)Pike_interpreter.evaluator_stack, stack_size*sizeof(struct svalue)); +  munmap((char *)Pike_interpreter.evaluator_stack, Pike_stack_size*sizeof(struct svalue));    Pike_interpreter.evaluator_stack=0;    }    if(!mark_stack_malloced)    { -  munmap((char *)Pike_interpreter.mark_stack, stack_size*sizeof(struct svalue *)); +  munmap((char *)Pike_interpreter.mark_stack, Pike_stack_size*sizeof(struct svalue *));    Pike_interpreter.mark_stack=0;    }   #endif       if(Pike_interpreter.evaluator_stack) free((char *)Pike_interpreter.evaluator_stack);    if(Pike_interpreter.mark_stack) free((char *)Pike_interpreter.mark_stack);       Pike_interpreter.mark_stack=0;    Pike_interpreter.evaluator_stack=0;    mark_stack_malloced=0;
pike.git/src/interpret.c:1736: Inside #if defined(DO_PIKE_CLEANUP) and #if 0
  #if 0    struct pike_frame_block *p;    int e;    for(p=pike_frame_blocks;p;p=p->next)    for(e=0;e<128;e++)    debug_malloc_dump_references( p->x + e);   #endif    free_all_pike_frame_blocks();   #endif   } +