pike.git / src / interpret.c

version» Context lines:

pike.git/src/interpret.c:1093:    Pike_fatal ("Not in catching eval.\n"); \    if (!cc) \    Pike_fatal ("Catch context dropoff.\n"); \    if (cc->frame != Pike_fp) \    Pike_fatal ("Catch context doesn't belong to this frame.\n"); \    if (Pike_mark_sp != cc->recovery.mark_sp + Pike_interpreter.mark_stack) \    Pike_fatal ("Mark sp diff in catch context pop.\n"); \    ); \    debug_malloc_touch (cc); \    UNSETJMP (cc->recovery); \ -  Pike_fp->expendible = cc->save_expendible; \ +  frame_set_expendible(Pike_fp, cc->save_expendible); \    Pike_interpreter.catch_ctx = cc->prev; \    really_free_catch_context (cc); \    } while (0)      static struct catch_context *free_catch_context;   static int num_catch_ctx, num_free_catch_ctx;      PMOD_EXPORT void really_free_catch_context( struct catch_context *data )   {    if( num_free_catch_ctx > 100 && free_catch_context )
pike.git/src/interpret.c:1220: Inside #if defined(PIKE_USE_MACHINE_CODE) and #if defined(OPCODE_INLINE_RETURN)
   }   #endif    {    struct catch_context *new_catch_ctx = alloc_catch_context();   #ifdef PIKE_DEBUG    new_catch_ctx->frame = Pike_fp;    init_recovery (&new_catch_ctx->recovery, 0, 0, PERR_LOCATION());   #else    init_recovery (&new_catch_ctx->recovery, 0);   #endif -  new_catch_ctx->save_expendible = Pike_fp->expendible; +  new_catch_ctx->save_expendible = frame_get_expendible(Pike_fp);    new_catch_ctx->continue_reladdr = (INT32)get_unaligned32(addr)    /* We need to run the entry prologue... */    - ENTRY_PROLOGUE_SIZE;       new_catch_ctx->next_addr = addr;    new_catch_ctx->prev = Pike_interpreter.catch_ctx;    Pike_interpreter.catch_ctx = new_catch_ctx;    DO_IF_DEBUG({    TRACE((3,"- Pushed catch context %p\n", new_catch_ctx));    });    }    -  Pike_fp->expendible = Pike_fp->locals + Pike_fp->num_locals; +  frame_set_expendible(Pike_fp, Pike_fp->locals + Pike_fp->num_locals);       /* Need to adjust next_addr by sizeof(INT32) to skip past the jump    * address to the continue position after the catch block. */    addr = (PIKE_OPCODE_T *) ((INT32 *) addr + 1);       if (Pike_interpreter.catching_eval_jmpbuf) {    /* There's already a catching_eval_instruction around our    * eval_instruction, so we can just continue. */    debug_malloc_touch_named (Pike_interpreter.catch_ctx, "(1)");    /* Skip past the entry prologue... */
pike.git/src/interpret.c:1297: Inside #if defined(PIKE_USE_MACHINE_CODE)
      DO_IF_DEBUG ({    TRACE((3,"- Caught exception. catch context: %p\n", cc));    if (!cc) Pike_fatal ("Catch context dropoff.\n");    if (cc->frame != Pike_fp)    Pike_fatal ("Catch context doesn't belong to this frame.\n");    });       debug_malloc_touch_named (cc, "(3)");    UNSETJMP (cc->recovery); -  Pike_fp->expendible = cc->save_expendible; +  frame_set_expendible(Pike_fp, cc->save_expendible);    move_svalue (Pike_sp++, &throw_value);    mark_free_svalue (&throw_value);    low_destruct_objects_to_destruct();       if (cc->continue_reladdr < 0)    FAST_CHECK_THREADS_ON_BRANCH();    addr = cc->next_addr + cc->continue_reladdr;       DO_IF_DEBUG({    TRACE((3,"- Popping catch context %p ==> %p\n",
pike.git/src/interpret.c:2001:    free_pike_scope(X->scope);    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->current_program=0;    X->context=0;    X->scope=0;    X->current_object=0;    X->flags=0; -  X->expendible=0; +     X->locals=0;    );    X->next = free_pike_frame;    PIKE_MEMPOOL_FREE(&free_pike_frame, X, sizeof(struct pike_frame));    free_pike_frame = X;   }      struct pike_frame *alloc_pike_frame(void)   {    struct pike_frame *res;
pike.git/src/interpret.c:2105:    \    Pike_mark_sp=Pike_fp->save_mark_sp; \    \    POP_PIKE_FRAME()         void low_return(void)   {    frame_return_and_unlink(Pike_fp);   #if 0 -  struct svalue *save_sp = Pike_fp->save_sp+1; +  struct svalue *save_sp = frame_get_save_sp(Pike_fp)+1;    struct object *o = Pike_fp->current_object;    int fun = Pike_fp->fun;       if (PIKE_FN_DONE_ENABLED()) {    /* DTrace leave probe    arg0: function name    */    char *fn = "(unknown)";    if (o && o->prog) {    struct identifier *id = ID_FROM_INT(o->prog, fun);
pike.git/src/interpret.c:2188: Inside #if defined(PIKE_DEBUG)
   {    while(rec->frame_pointer == current) rec=rec->previous;    /* FIXME: Wouldn't a simple return be ok? */    if(rec->frame_pointer == current->next)    Pike_fatal("You can't touch this!\n");    }    }   #endif    /* Save various fields from the previous frame.    */ -  current->save_sp=prev->save_sp; +  frame_set_save_sp(current, frame_get_save_sp(prev));    current->save_mark_sp=prev->save_mark_sp;    current->flags = prev->flags;      #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);
pike.git/src/interpret.c:2258:    * practically zero. */    check_c_stack(Pike_interpreter.c_stack_margin ?    Pike_interpreter.c_stack_margin : 100);          switch (type) {    case APPLY_STACK:    frame_setup_from_svalue(frame, Pike_sp-args);    args--;    frame_prepare(frame, args); -  frame->save_sp--; +  frame_inc_save_sp(frame, -1);    frame_execute(frame);    break;    case APPLY_SVALUE:    case APPLY_SVALUE_STRICT:    frame_setup_from_svalue(frame, arg1);    frame_prepare(frame, args);    frame_execute(frame);    break;    case APPLY_LOW:    frame_setup_from_fun(frame, arg1, PTR_TO_INT(arg2));
pike.git/src/interpret.c:2461:    fun = prog->num_identifier_references;    add_to_identifier_references(dummy_ref);    }       /* FIXME: Is this up-to-date with mega_apply? */    new_frame->next = Pike_fp;    add_ref(new_frame->current_object = o);    add_ref(new_frame->current_program = prog);    new_frame->context = prog->inherits;    new_frame->locals = Pike_sp; -  new_frame->expendible=new_frame->locals; +  frame_set_expendible(new_frame, new_frame->locals);    new_frame->args = 0;    new_frame->num_args=0;    new_frame->num_locals=0;    new_frame->fun = fun;    new_frame->current_storage=o->storage;       new_frame->ptr = prog->program + offset;    new_frame->type = FRAME_PIKE_FUNCTION;       new_frame->pc = new_frame->ptr;
pike.git/src/interpret.c:3486:    struct svalue *save_sp = Pike_sp - args;      #ifdef PIKE_DEBUG    frame_check_all(frame);    assert(frame == Pike_fp);   #endif       if (UNLIKELY(Pike_interpreter.trace_level || PIKE_FN_START_ENABLED()))    do_trace_frame_call(frame, args);    -  frame->save_sp = save_sp; -  frame->expendible = save_sp; +     frame->locals = save_sp; -  +  frame_set_save_sp(frame, save_sp); +  frame_set_expendible(frame, save_sp);    frame->args = args;      #ifdef PROFILING    {    struct identifier *function = frame_get_identifier(frame);       if (function) {    frame->children_base = Pike_interpreter.accounted_time;    frame->start_time = get_cpu_time() - Pike_interpreter.unlocked_time;   
pike.git/src/interpret.c:3558:    CASE(FRAME_BUILTIN);    }      #undef CASE       return "<unknown frame type>";   }      /* frame_execute will perform the actual function call. */   void frame_execute(const struct pike_frame * frame) { -  struct svalue *save_sp = frame->save_sp; +  struct svalue *save_sp = frame_get_save_sp(frame);    enum frame_type type = frame->type;      #ifdef PIKE_DEBUG    frame_check_all(frame);    assert(frame == Pike_fp);    assert(frame->type != FRAME_FREE);    assert(frame->type != FRAME_BUILTIN);   #endif       FAST_CHECK_THREADS_ON_CALL();
pike.git/src/interpret.c:3646:    if (type == FRAME_C_FUNCTION) {    if(UNLIKELY(Pike_interpreter.trace_level>1))    do_trace_func_return (1, frame->current_object, frame->fun);    } else if (type == FRAME_CLONE || type == FRAME_PARENT_CLONE) {    if(UNLIKELY(Pike_interpreter.trace_level>1))    do_trace_func_return (1, NULL, 0);    }   }      static void frame_unlink(struct pike_frame *frame) { -  ptrdiff_t num_expendible = frame->expendible - frame->locals; +  ptrdiff_t num_expendible = frame_get_expendible(frame) - frame->locals;      #ifdef PIKE_DEBUG    frame_check_all(frame);    //assert (Pike_fp == frame);    if( (frame->locals + frame->num_locals > Pike_sp) || -  (Pike_sp < frame->expendible) || +  (Pike_sp < frame_get_expendible(frame)) ||    (num_expendible < 0) || (num_expendible > frame->num_locals))    Pike_fatal("Stack failure in unlink_frame %p+%d=%p %p %p!\n",    frame->locals, frame->num_locals,    frame->locals+frame->num_locals,    Pike_sp,frame->expendible);    if (frame->type != FRAME_PIKE_FUNCTION) {    Pike_fatal("Trying to unlink non-pike frame.\n");    }      #endif
pike.git/src/interpret.c:3743: Inside #if defined(PROFILING)
   Pike_interpreter.accounted_time += self_time;    if (!--function->recur_depth)    function->total_time += time_passed;    function->self_time += self_time;    }    }   #endif   }      struct pike_frame * frame_return(struct pike_frame *frame) { -  struct svalue *save_sp = frame->save_sp+1; +  struct svalue *save_sp = frame_get_save_sp(frame)+1;    struct pike_frame *new_frame;      #ifdef PIKE_DEBUG    frame_check_all(Pike_fp);    assert (Pike_fp == frame);    assert (frame->type != FRAME_FREE);    assert (frame->type != FRAME_BUILTIN);   #endif       if (frame->refs > 1) {
pike.git/src/interpret.c:3779:    frame_unlink(frame);       Pike_fp = new_frame;    } else {    // TODO: profiling       new_frame = frame;    }      #ifdef PIKE_DEBUG -  new_frame->locals = new_frame->expendible = new_frame->save_sp = NULL; +  new_frame->locals = = NULL;    new_frame->args = new_frame->num_args = new_frame->num_locals = 0;   #endif       if (frame->type == FRAME_PIKE_FUNCTION) {    Pike_mark_sp = frame->save_mark_sp;    }    // pop all locals    if (save_sp > Pike_sp) {    push_int(0);    } else {
pike.git/src/interpret.c:3817:   #endif    frame->refs --;    Pike_fp = frame->next;    if (frame->refs <= 0)    really_free_pike_frame(frame);    else Pike_fatal("Frame left with references.\n");    // frame_return has been called on this one, already   }      void frame_return_and_unlink(struct pike_frame *frame) { -  struct svalue *save_sp = frame->save_sp+1; +  struct svalue *save_sp = frame_get_save_sp(frame)+1;    struct object *o = frame->current_object;      #ifdef PIKE_DEBUG    frame_check_all(Pike_fp);    assert(frame == Pike_fp);   #endif       if (frame->type == FRAME_PIKE_FUNCTION) {    Pike_mark_sp = frame->save_mark_sp;    }