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.93 1998/07/28 23:02:42 hubbe Exp $"); + RCSID("$Id: interpret.c,v 1.94 1998/08/10 23:33:29 hubbe Exp $");   #include "interpret.h"   #include "object.h"   #include "program.h"   #include "svalue.h"   #include "array.h"   #include "mapping.h"   #include "error.h"   #include "language.h"   #include "stralloc.h"   #include "constants.h"
pike.git/src/interpret.c:54:   #define TRACE_LEN (100 + t_flag * 10)         /* sp points to first unused value on stack    * (much simpler than letting it point at the last used value.)    */   struct svalue *sp; /* Current position */   struct svalue *evaluator_stack; /* Start of stack */   int stack_size = EVALUATOR_STACK_SIZE;   int evaluator_stack_malloced = 0; + char *stack_top;      /* mark stack, used to store markers into the normal stack */   struct svalue **mark_sp; /* Current position */   struct svalue **mark_stack; /* Start of stack */   int mark_stack_malloced = 0;      void push_sp_mark(void)   {    if(mark_sp == mark_stack + stack_size)    error("No more mark stack!\n");
pike.git/src/interpret.c:185:    if(sp - evaluator_stack + size >= stack_size)    error("Stack overflow.\n");   }      void check_mark_stack(INT32 size)   {    if(mark_sp - mark_stack + size >= stack_size)    error("Stack overflow.\n");   }    + void check_c_stack(INT32 size) + { +  long x=((char *)&size) + STACK_DIRECTION * size - stack_top ; +  x*=STACK_DIRECTION; +  if(x>0) +  error("Stack overflow.\n"); + }    -  +    static int eval_instruction(unsigned char *pc);         /*    * lvalues are stored in two svalues in one of these formats:    * array[index] : { array, index }    * mapping[index] : { mapping, index }    * multiset[index] : { multiset, index }    * object[index] : { object, index }    * local variable : { svalue_pointer, nothing }
pike.git/src/interpret.c:1886:       if(fun<0)    {    pop_n_elems(sp-save_sp);    push_int(0);    return;    }       check_stack(256);    check_mark_stack(256); +  check_c_stack(8192);      #ifdef DEBUG    if(d_flag>2) do_debug();   #endif    -  /* If we are really unlucky, o hasn't just been destructed, it has -  * also been freed! -  */ -  +     p=o->prog;    if(!p)    PIKE_ERROR("destructed object->function",    "Cannot call functions in destructed objects.\n", sp, args);   #ifdef DEBUG    if(fun>=(int)p->num_identifier_references)    {    fprintf(stderr,"Function index out of range. %d >= %d\n",fun,(int)p->num_identifier_references);    fprintf(stderr,"########Program is:\n");    describe(p);