pike.git / src / interpret.c

version» Context lines:

pike.git/src/interpret.c:1:   /*   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: interpret.c,v 1.385 2008/01/26 22:34:20 mast Exp $ + || $Id: interpret.c,v 1.386 2008/02/27 23:59:12 grubba Exp $   */      #include "global.h"   #include "interpret.h"   #include "object.h"   #include "program.h"   #include "svalue.h"   #include "array.h"   #include "mapping.h"   #include "pike_error.h"
pike.git/src/interpret.c:135:   }         #ifdef PIKE_DEBUG   void gc_mark_stack_external (struct pike_frame *f,    struct svalue *stack_p, struct svalue *stack)   {    for (; f; f = f->next)    GC_ENTER (f, T_PIKE_FRAME) {    if (!debug_gc_check (f, " as frame on stack")) { -  if(f->context.parent) -  gc_mark_external (f->context.parent, " in context.parent in frame on stack"); +     gc_mark_external (f->current_object, " in current_object in frame on stack"); -  gc_mark_external (f->context.prog, " in context.prog in frame on stack"); +  gc_mark_external (f->current_program, " in current_program in frame on stack");    if (f->locals) { /* Check really needed? */    if (f->flags & PIKE_FRAME_MALLOCED_LOCALS) {    gc_mark_external_svalues(f->locals, f->num_locals,    " in malloced locals of trampoline frame on stack");    } else {    if (f->locals > stack_p || (stack_p - f->locals) >= 0x10000) {    fatal("Unreasonable locals: stack:%p locals:%p\n",    stack_p, f->locals);    }    gc_mark_external_svalues (f->locals, stack_p - f->locals, " on svalue stack");
pike.git/src/interpret.c:865:   int backlogp=BACKLOG-1;      static INLINE void low_debug_instr_prologue (PIKE_INSTR_T instr)   {    if(Pike_interpreter.trace_level > 2)    {    char *file = NULL, *f;    struct pike_string *filep;    INT32 linep;    -  filep = get_line(Pike_fp->pc,Pike_fp->context.prog,&linep); +  filep = get_line(Pike_fp->pc,Pike_fp->context->prog,&linep);    if (filep && !filep->size_shift) {    file = filep->str;    while((f=STRCHR(file,'/')))    file=f+1;    }    fprintf(stderr,"- %s:%4ld:(%"PRINTPTRDIFFT"d): "    "%-25s %4"PRINTPTRDIFFT"d %4"PRINTPTRDIFFT"d\n",    file ? file : "-",(long)linep, -  Pike_fp->pc - Pike_fp->context.prog->program, +  Pike_fp->pc - Pike_fp->context->prog->program,    get_opcode_name(instr),    Pike_sp-Pike_interpreter.evaluator_stack,    Pike_mark_sp-Pike_interpreter.mark_stack);    free_string(filep);    }      #ifdef HAVE_COMPUTED_GOTO    if (instr)    ADD_RUNNED(instr);    else
pike.git/src/interpret.c:899:   #endif /* HAVE_COMPUTED_GOTO */       if(d_flag)    {    backlogp++;    if(backlogp >= BACKLOG) backlogp=0;       if(backlog[backlogp].program)    free_program(backlog[backlogp].program);    -  backlog[backlogp].program=Pike_fp->context.prog; -  add_ref(Pike_fp->context.prog); +  backlog[backlogp].program=Pike_fp->context->prog; +  add_ref(Pike_fp->context->prog);    backlog[backlogp].instruction=instr;    backlog[backlogp].pc = Pike_fp->pc;    backlog[backlogp].stack = Pike_sp - Pike_interpreter.evaluator_stack;    backlog[backlogp].mark_stack = Pike_mark_sp - Pike_interpreter.mark_stack;   #ifdef _REENTRANT    backlog[backlogp].thread_state=Pike_interpreter.thread_state;   #endif      #ifdef _REENTRANT    CHECK_INTERPRETER_LOCK();
pike.git/src/interpret.c:963:    debug_malloc_touch(Pike_fp->current_object);    switch(d_flag)    {    default:    case 3:    check_object(Pike_fp->current_object);    /* break; */       case 2:    check_object_context(Pike_fp->current_object, -  Pike_fp->context.prog, +  Pike_fp->context->prog,    Pike_fp->current_object->storage+ -  Pike_fp->context.storage_offset); +  Pike_fp->context->storage_offset);    case 1:    case 0:    break;    }    }   }      #define DEBUG_LOG_ARG(ARG) \    (backlog[backlogp].arg = (ARG), \    (Pike_interpreter.trace_level>3 ? \
pike.git/src/interpret.c:1568:    {    s[TRACE_LEN]=0;    s[TRACE_LEN-1]='.';    s[TRACE_LEN-2]='.';    s[TRACE_LEN-3]='.';    }       if(Pike_fp && Pike_fp->pc)    {    char *f; -  filep = get_line(Pike_fp->pc,Pike_fp->context.prog,&linep); +  filep = get_line(Pike_fp->pc,Pike_fp->context->prog,&linep);    if (filep->size_shift)    file = "...";    else {    file = filep->str;    while((f = STRCHR(file, '/'))   #ifdef __NT__    || (f = STRCHR(file, '\\'))   #endif /* __NT__ */    )    file=f+1;
pike.git/src/interpret.c:1653:    {    s[TRACE_LEN]=0;    s[TRACE_LEN-1]='.';    s[TRACE_LEN-2]='.';    s[TRACE_LEN-3]='.';    }       if(Pike_fp && Pike_fp->pc)    {    char *f; -  filep = get_line(Pike_fp->pc,Pike_fp->context.prog,&linep); +  filep = get_line(Pike_fp->pc,Pike_fp->context->prog,&linep);    if (filep->size_shift)    file = "...";    else {    file = filep->str;    while((f=STRCHR(file,'/')))    file=f+1;    }    }else{    linep=0;    file="-";
pike.git/src/interpret.c:1701:    DO_IF_SECURITY( if(CURRENT_CREDS) { \    add_ref(X->current_creds=CURRENT_CREDS); \    } else { \    X->current_creds = 0; \    }) \   }while(0)      #undef EXIT_BLOCK   #define EXIT_BLOCK(X) do { \    free_object(X->current_object); \ -  if(X->context.prog) free_program(X->context.prog); \ -  if(X->context.parent) free_object(X->context.parent); \ +  if(X->current_program) free_program(X->current_program); \    if(X->scope) free_pike_scope(X->scope); \    DO_IF_SECURITY( if(X->current_creds) { \    free_object(X->current_creds); \    }) \    DO_IF_DEBUG( \    if(X->flags & PIKE_FRAME_MALLOCED_LOCALS) \    Pike_fatal("Pike frame is not supposed to have malloced locals here!\n")); \    \    DO_IF_DMALLOC( \ -  X->context.prog=0; \ -  X->context.parent=0; \ -  X->context.name=0; \ +  X->current_program=0; \ +  X->context=0; \    X->scope=0; \    X->current_object=0; \    X->flags=0; \    X->expendible=0; \    X->locals=0; \    DO_IF_SECURITY( X->current_creds=0; ) \    ) \   }while(0)      BLOCK_ALLOC_FILL_PAGES(pike_frame, 4)
pike.git/src/interpret.c:2104: Inside #if defined(PROFILING)
  #ifdef PROFILING    {    /* We must update the profiling info of the previous frame    * to account for that the current frame has gone away.    */    cpu_time_t total_time =    get_cpu_time() - (Pike_interpreter.unlocked_time + current->start_time);    cpu_time_t child_time =    Pike_interpreter.accounted_time - current->children_base;    struct identifier *function = -  current->context.prog->identifiers + current->ident; +  current->context->prog->identifiers + current->ident;    function->total_time += total_time;    total_time -= child_time;    function->self_time += total_time;    Pike_interpreter.accounted_time += total_time;   #ifdef PROFILING_DEBUG    fprintf(stderr, "%p: Unlinking previous frame.\n"    "Previous: %" PRINT_CPU_TIME " %" PRINT_CPU_TIME "\n"    "Current: %" PRINT_CPU_TIME " %" PRINT_CPU_TIME "\n",    Pike_interpreter.thread_state,    prev->start_time, prev->children_base,
pike.git/src/interpret.c:2340:    struct reference dummy_ref = {    0, 0, ID_HIDDEN,    };    /* check_program() doesn't like our identifier... */    o->prog->flags |= PROGRAM_AVOID_CHECK;    add_to_identifier_references(dummy_ref);    }       /* FIXME: Is this up-to-date with mega_apply? */    new_frame->next = Pike_fp; -  new_frame->current_object = o; -  new_frame->context=o->prog->inherits[0]; +  add_ref(new_frame->current_object = o); +  add_ref(new_frame->current_program = o->prog); +  new_frame->context = o->prog->inherits;    new_frame->locals = Pike_sp;    new_frame->expendible=new_frame->locals;    new_frame->args = 0;    new_frame->num_args=0;    new_frame->num_locals=0;    new_frame->fun = o->prog->num_identifier_references-1;    new_frame->pc = 0;    new_frame->current_storage=o->storage; -  new_frame->context.parent=0; +       #ifdef PIKE_DEBUG    if (Pike_fp && (new_frame->locals < Pike_fp->locals)) {    fatal("New locals below old locals: %p < %p\n",    new_frame->locals, Pike_fp->locals);    }   #endif /* PIKE_DEBUG */       Pike_fp = new_frame;    -  add_ref(new_frame->current_object); -  add_ref(new_frame->context.prog); -  +     saved_jmpbuf = Pike_interpreter.catching_eval_jmpbuf;    Pike_interpreter.catching_eval_jmpbuf = NULL;       if(SETJMP(tmp))    {    ret=1;    }else{    int tmp;    new_frame->mark_sp_base=new_frame->save_mark_sp=Pike_mark_sp;    tmp=eval_instruction(o->prog->program + offset);
pike.git/src/interpret.c:2748:   #else    f = Pike_fp;   #endif       for (of = 0; f; f = (of = f)->next)    if (f->refs) {    int args, i;    char *file = NULL;    INT32 line;    -  if (f->context.prog) { +  if (f->context) {    if (f->pc) -  file = low_get_line_plain (f->pc, f->context.prog, &line, 0); +  file = low_get_line_plain (f->pc, f->context->prog, &line, 0);    else -  file = low_get_program_line_plain (f->context.prog, &line, 0); +  file = low_get_program_line_plain (f->context->prog, &line, 0);    }    if (file)    fprintf (stderr, "%s:%d: ", file, line);    else    fputs ("unknown program: ", stderr);    -  if (f->current_object && f->current_object->prog) { +  if (f->current_program) {    /* FIXME: Wide string identifiers. */ -  fputs (safe_idname_from_int(f->current_object->prog, f->fun), stderr); +  fputs (safe_idname_from_int(f->current_program, f->fun), stderr);    fputc ('(', stderr);    }    else    fputs ("unknown function(", stderr);       if(!f->locals)    {    args=0;    }else{    args=f->num_args;