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.189 2003/01/30 13:43:56 grubba Exp $"); + RCSID("$Id: interpret.c,v 1.190 2003/03/23 12:35:29 jonasw 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:78:   #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 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 + 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)
pike.git/src/interpret.c:157:    }    }    /* 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.mark_stack_malloced=0;    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(Pike_stack_size*sizeof(struct svalue));    Pike_interpreter.evaluator_stack_malloced=1;    }       if(!Pike_interpreter.mark_stack)    {    Pike_interpreter.mark_stack=(struct svalue **)xalloc(Pike_stack_size*sizeof(struct svalue *)); -  mark_stack_malloced=1; +  Pike_interpreter.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;      #ifdef PIKE_DEBUG
pike.git/src/interpret.c:1741:    }   #endif    reset_evaluator();      #ifdef USE_MMAP_FOR_STACK    if(!Pike_interpreter.evaluator_stack_malloced)    {    munmap((char *)Pike_interpreter.evaluator_stack, Pike_stack_size*sizeof(struct svalue));    Pike_interpreter.evaluator_stack=0;    } -  if(!mark_stack_malloced) +  if(!Pike_interpreter.mark_stack_malloced)    {    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_interpreter.mark_stack_malloced=0;    Pike_interpreter.evaluator_stack_malloced=0;   }      void really_clean_up_interpret(void)   {   #ifdef DO_PIKE_CLEANUP   #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   }