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.159 2000/08/02 20:31:51 hubbe Exp $"); + RCSID("$Id: interpret.c,v 1.160 2000/08/08 19:40:41 grubba 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:68:      /* 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)    error("No more mark stack!\n");    *Pike_mark_sp++=Pike_sp;   } - int pop_sp_mark(void) + 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;   }         #ifdef PIKE_DEBUG   static void gc_check_stack_callback(struct callback *foo, void *bar, void *gazonk)   {    struct pike_frame *f; -  debug_gc_xmark_svalues(Pike_interpreter.evaluator_stack,Pike_sp-Pike_interpreter.evaluator_stack-1," on current interpreter stack"); +  debug_gc_xmark_svalues(Pike_interpreter.evaluator_stack, +  Pike_sp-Pike_interpreter.evaluator_stack-1, +  " on current interpreter stack");       for(f=Pike_fp;f;f=f->next)    {    if(f->context.parent)    gc_external_mark2(f->context.parent,0," in Pike_fp->context.parent on current stack");    gc_external_mark2(f->current_object,0," in Pike_fp->current_object on current stack");    gc_external_mark2(f->context.prog,0," in Pike_fp->context.prog on current stack");    }      }
pike.git/src/interpret.c:372: Inside #if defined(PIKE_DEBUG)
  #ifdef PIKE_DEBUG   void print_return_value(void)   {    if(t_flag>3)    {    char *s;       init_buf();    describe_svalue(Pike_sp-1,0,0);    s=simple_free_buf(); -  if((long)strlen(s) > (long)TRACE_LEN) +  if((size_t)strlen(s) > (size_t)TRACE_LEN)    {    s[TRACE_LEN]=0;    s[TRACE_LEN-1]='.';    s[TRACE_LEN-2]='.';    s[TRACE_LEN-3]='.';    }    fprintf(stderr,"- value: %s\n",s);    free(s);    }   }
pike.git/src/interpret.c:475:   #define BACKLOG 1024   struct backlog   {    INT32 instruction;    INT32 arg,arg2;    struct program *program;    unsigned char *pc;   #ifdef _REENTRANT    struct object *thread_id;   #endif -  int stack; -  int mark_stack; +  ptrdiff_t stack; +  ptrdiff_t mark_stack;   };      struct backlog backlog[BACKLOG];   int backlogp=BACKLOG-1;      void dump_backlog(void)   {   #ifdef _REENTRANT    struct object *thread=0;   #endif
pike.git/src/interpret.c:578:   #endif      static void trace_return_value(void)   {    char *s;       init_buf();    my_strcat("Return: ");    describe_svalue(Pike_sp-1,0,0);    s=simple_free_buf(); -  if((long)strlen(s) > (long)TRACE_LEN) +  if((size_t)strlen(s) > (size_t)TRACE_LEN)    {    s[TRACE_LEN]=0;    s[TRACE_LEN-1]='.';    s[TRACE_LEN-2]='.';    s[TRACE_LEN-2]='.';    }    fprintf(stderr,"%-*s%s\n",4,"-",s);    free(s);   }   
pike.git/src/interpret.c:601:    char *file,*s;    INT32 linep,e;    my_strcat("(");    for(e=0;e<args;e++)    {    if(e) my_strcat(",");    describe_svalue(Pike_sp-args+e,0,0);    }    my_strcat(")");    s=simple_free_buf(); -  if((long)strlen(s) > (long)TRACE_LEN) +  if((size_t)strlen(s) > (size_t)TRACE_LEN)    {    s[TRACE_LEN]=0;    s[TRACE_LEN-1]='.';    s[TRACE_LEN-2]='.';    s[TRACE_LEN-2]='.';    }    if(Pike_fp && Pike_fp->pc)    {    char *f;    file=get_line(Pike_fp->pc,Pike_fp->context.prog,&linep);
pike.git/src/interpret.c:673:    struct object *o;    struct pike_frame *scope=0;    int fun, tailrecurse=-1;    struct svalue *save_sp=Pike_sp-args;      #ifdef PROFILING   #ifdef HAVE_GETHRTIME    long long children_base = Pike_interpreter.accounted_time;    long long start_time = gethrtime() - Pike_interpreter.time_base;    unsigned INT32 self_time_base; + #if 0 + #ifdef PIKE_DEBUG    if(start_time < 0)    {    fatal("gethrtime() shrunk\n start_time=%ld\n gethrtime()=%ld\n Pike_interpreter.time_base=%ld\n",    (long)(start_time/100000),    (long)(gethrtime()/100000),    (long)(Pike_interpreter.time_base/100000));    }   #endif   #endif -  + #endif + #endif      #if defined(PIKE_DEBUG) && defined(_REENTRANT)    if(d_flag)    {    THREAD_T self = th_self();       CHECK_INTERPRETER_LOCK();       if( Pike_interpreter.thread_id && !th_equal( OBJ2THREAD(Pike_interpreter.thread_id)->id, self) )    fatal("Current thread is wrong.\n");
pike.git/src/interpret.c:953:    add_ref(new_frame->current_object);    add_ref(new_frame->context.prog);    if(new_frame->context.parent) add_ref(new_frame->context.parent);    if(new_frame->scope) add_ref(new_frame->scope);       if(t_flag)    {    char buf[50];       init_buf(); -  sprintf(buf,"%lx->",(long)o); +  sprintf(buf, "%lx->", +  DO_NOT_WARN((long)o));    my_strcat(buf);    my_strcat(function->name->str);    do_trace_call(args);    }       Pike_fp = new_frame;      #ifdef PROFILING    function->num_calls++;   #endif
pike.git/src/interpret.c:1103:       }   #ifdef PROFILING   #ifdef HAVE_GETHRTIME    {    long long time_passed, time_in_children, self_time;    time_in_children= Pike_interpreter.accounted_time - children_base;    time_passed = gethrtime() - Pike_interpreter.time_base - start_time;    self_time=time_passed - time_in_children;    Pike_interpreter.accounted_time+=self_time; + #if 0   #ifdef PIKE_DEBUG    if(self_time < 0 || children_base <0 || Pike_interpreter.accounted_time <0)    fatal("Time is negative\n self_time=%ld\n time_passed=%ld\n time_in_children=%ld\n children_base=%ld\n Pike_interpreter.accounted_time=%ld!\n Pike_interpreter.time_base=%ld\n start_time=%ld\n",    (long)(self_time/100000),    (long)(time_passed/100000),    (long)(time_in_children/100000),    (long)(children_base/100000),    (long)(Pike_interpreter.accounted_time/100000),    (long)(Pike_interpreter.time_base/100000),    (long)(start_time/100000)    );   #endif -  + #endif    function->total_time=self_time_base + (INT32)(time_passed /1000);    function->self_time+=(INT32)( self_time /1000);    }   #endif   #endif      #if 0    if(Pike_sp - new_frame->locals > 1)    {    pop_n_elems(Pike_sp - new_frame->locals -1);
pike.git/src/interpret.c:1305:    UNSET_ONERROR(tmp);    inside=0;    }    }       Pike_sp->u.integer = 0;    Pike_sp->subtype=NUMBER_NUMBER;    Pike_sp->type = T_INT;    Pike_sp++;    }else{ -  INT32 expected_stack = Pike_sp - Pike_interpreter.evaluator_stack + 1; +  ptrdiff_t expected_stack = Pike_sp - Pike_interpreter.evaluator_stack + 1;    Pike_sp+=args;    apply_low(o,fun,args);    if(Pike_sp - Pike_interpreter.evaluator_stack > expected_stack)    pop_n_elems(Pike_sp - Pike_interpreter.evaluator_stack - expected_stack);    if(Pike_sp - Pike_interpreter.evaluator_stack < expected_stack)    {    Pike_sp->u.integer = 0;    Pike_sp->subtype=NUMBER_NUMBER;    Pike_sp->type = T_INT;    Pike_sp++;
pike.git/src/interpret.c:1362:   }         PMOD_EXPORT void apply_svalue(struct svalue *s, INT32 args)   {    if(s->type==T_INT)    {    pop_n_elems(args);    push_int(0);    }else{ -  INT32 expected_stack=Pike_sp-args+1 - Pike_interpreter.evaluator_stack; +  ptrdiff_t expected_stack=Pike_sp-args+1 - Pike_interpreter.evaluator_stack;       strict_apply_svalue(s,args);    if(Pike_sp > (expected_stack + Pike_interpreter.evaluator_stack))    {    pop_n_elems(Pike_sp-(expected_stack + Pike_interpreter.evaluator_stack));    }    else if(Pike_sp < (expected_stack + Pike_interpreter.evaluator_stack))    {    push_int(0);    }