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.73 1998/04/01 00:47:46 hubbe Exp $"); + RCSID("$Id: interpret.c,v 1.74 1998/04/06 04:17:25 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:80:    fatal("Mark stack underflow!\n");   #endif    return sp - *--mark_sp;   }      struct frame *fp; /* frame pointer */      #ifdef DEBUG   static void gc_check_stack_callback(struct callback *foo, void *bar, void *gazonk)   { +  struct frame *f;    debug_gc_xmark_svalues(evaluator_stack,sp-evaluator_stack-1,"interpreter stack"); -  +  +  for(f=fp;f;f=f->parent_frame) +  { +  if(f->context.parent) +  gc_external_mark(f->context.parent); +  gc_external_mark(f->current_object); +  gc_external_mark(f->context.prog);    } -  +  + }   #endif      void init_interpreter(void)   {   #ifdef USE_MMAP_FOR_STACK    static int fd = -1;    - #ifdef DEBUG -  static struct callback *spcb; -  if(!spcb) -  { -  spcb=add_gc_callback(gc_check_stack_callback,0,0); -  } - #endif +       #ifndef MAP_VARIABLE   #define MAP_VARIABLE 0   #endif      #ifndef MAP_PRIVATE   #define MAP_PRIVATE 0   #endif      #ifndef MAP_FAILED
pike.git/src/interpret.c:158:       if(!mark_stack)    {    mark_stack=(struct svalue **)xalloc(stack_size*sizeof(struct svalue *));    mark_stack_malloced=1;    }       sp=evaluator_stack;    mark_sp=mark_stack;    fp=0; +  + #ifdef DEBUG +  { +  static struct callback *spcb; +  if(!spcb) +  { +  spcb=add_gc_callback(gc_check_stack_callback,0,0);    } -  +  } + #endif + }      void check_stack(INT32 size)   {    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)
pike.git/src/interpret.c:1407:       CASE(F_ADD_INT); push_int(GET_ARG()); f_add(2); break;    CASE(F_ADD_NEG_INT); push_int(-GET_ARG()); f_add(2); break;       CASE(F_PUSH_ARRAY);    if(sp[-1].type!=T_ARRAY) error("Bad argument to @\n");    sp--;    push_array_items(sp->u.array);    break;    -  CASE(F_STRICT_ARROW); -  if(sp[-1].type != T_OBJECT) -  error("Expected object for first argument to `->\n"); -  if(!sp[-1].u.object->prog) -  error("`-> on destructed object.\n"); -  sp[-1].subtype=GET_ARG(); -  if(sp[-1].u.object->prog->id != EXTRACT_INT(pc)) -  error("`->: Object not of specified type.\n"); -  sp[-1].type=T_FUNCTION; -  pc+=sizeof(INT32); -  break; -  -  CASE(F_STRICT_ARROW_VARIABLE); -  if(sp[-1].type != T_OBJECT) -  error("Expected object for first argument to `->\n"); -  if(!sp[-1].u.object->prog) -  error("`-> on destructed object.\n"); -  instr=GET_ARG(); -  if(sp[-1].u.object->prog->id != EXTRACT_INT(pc)) -  error("`->: Object not of specified type.\n"); -  pc+=sizeof(INT32); -  low_object_index_no_free(sp,sp[-1].u.object,instr); -  free_object(sp[-1].u.object); -  sp[-1]=*sp; -  break; -  +     CASE(F_LOCAL_LOCAL_INDEX);    {    struct svalue *s=fp->locals+GET_ARG();    if(s->type == T_STRING) s->subtype=0;    sp++->type=T_INT;    index_no_free(sp-1,fp->locals+GET_ARG(),s);    break;    }       CASE(F_LOCAL_INDEX);