Branch: Tag:

1998-08-10

1998-08-10 23:33:31 by Fredrik Hübinette (Hubbe) <hubbe@hubbe.net>

stack checks and -ss<thread stack size> implemented

Rev: src/configure.in:1.230
Rev: src/interpret.c:1.94
Rev: src/interpret.h:1.22
Rev: src/main.c:1.57
Rev: src/testsuite.in:1.120
Rev: src/threads.c:1.80
Rev: src/threads.h:1.48

4:   ||| 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"
61:   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 */
192:    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);      
1893:       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",