pike.git / src / interpret_functions.h

version» Context lines:

pike.git/src/interpret_functions.h:1:   /* -  * $Id: interpret_functions.h,v 1.42 2001/01/15 00:21:47 mast Exp $ +  * $Id: interpret_functions.h,v 1.43 2001/01/31 21:50:57 mast Exp $    *    * Opcode definitions for the interpreter.    */      OPCODE0(F_UNDEFINED,"push UNDEFINED")    push_int(0);    Pike_sp[-1].subtype=NUMBER_UNDEFINED;   BREAK;      OPCODE0(F_CONST0, "push 0")
pike.git/src/interpret_functions.h:695:   OPCODE0(F_POP_VALUE, "pop")    pop_stack();   BREAK;      OPCODE1(F_POP_N_ELEMS, "pop_n_elems")    pop_n_elems(arg1);   BREAK;      OPCODE0_TAIL(F_MARK2,"mark mark")    *(Pike_mark_sp++)=Pike_sp; +  + /* This opcode is only used when running with -d. Identical to F_MARK, +  * but with a different name to make the debug printouts more clear. */ + OPCODE0_TAIL(F_SYNCH_MARK,"synch mark") +    OPCODE0(F_MARK,"mark")    *(Pike_mark_sp++)=Pike_sp;   BREAK;      OPCODE1(F_MARK_X, "mark Pike_sp-X")    *(Pike_mark_sp++)=Pike_sp-arg1;   BREAK;      OPCODE0(F_POP_MARK, "pop mark")    --Pike_mark_sp;   BREAK;      OPCODE0(F_POP_TO_MARK, "pop to mark")    pop_n_elems(Pike_sp - *--Pike_mark_sp);   BREAK;    -  + /* These opcodes are only used when running with -d. The reason for +  * the two aliases is mainly to keep the indentation in asm debug +  * output. */ + OPCODE0(F_CLEANUP_SYNCH_MARK, "cleanup synch mark") + OPCODE0_TAIL(F_POP_SYNCH_MARK, "pop synch mark") +  if (*--Pike_mark_sp != Pike_sp && d_flag) { +  ptrdiff_t should = *Pike_mark_sp - Pike_interpreter.evaluator_stack; +  ptrdiff_t is = Pike_sp - Pike_interpreter.evaluator_stack; +  if (Pike_sp - *Pike_mark_sp > 0) /* not always same as Pike_sp > *Pike_mark_sp */ +  /* Some attempt to recover, just to be able to report the backtrace. */ +  pop_n_elems(Pike_sp - *Pike_mark_sp); +  fatal("Stack out of synch - should be %ld, is %ld.\n", +  (long) should, (long) is); +  } + BREAK; +    OPCODE0(F_CLEAR_STRING_SUBTYPE, "clear string subtype")    if(Pike_sp[-1].type==PIKE_T_STRING) Pike_sp[-1].subtype=0;   BREAK;       /* Jumps */   OPCODE0_JUMP(F_BRANCH,"branch")    DOJUMP();   BREAK;      OPCODE2(F_BRANCH_IF_NOT_LOCAL_ARROW,"branch if !local->x")
pike.git/src/interpret_functions.h:853:    break;       CASE(F_CATCH);    switch (o_catch(pc+sizeof(INT32))) {    case 1:    return -1; /* There was a return inside the evaluated code */    case 2:    pc = Pike_fp->pc;    break;    default: -  pc+=EXTRACT_INT(pc); +  pc+=GET_JUMP();    }    break;      OPCODE0(F_ESCAPE_CATCH, "escape catch")   {    Pike_fp->pc = pc;    return -2;   }   BREAK;   
pike.git/src/interpret_functions.h:956:    if(Pike_sp[-4].type != PIKE_T_ARRAY)    PIKE_ERROR("foreach", "Bad argument 1.\n", Pike_sp-3, 1);    if(Pike_sp[-1].u.integer < Pike_sp[-4].u.array->size)    {    fast_check_threads_etc(10);    index_no_free(Pike_sp,Pike_sp-4,Pike_sp-1);    Pike_sp++;    assign_lvalue(Pike_sp-4, Pike_sp-1);    free_svalue(Pike_sp-1);    Pike_sp--; -  pc+=EXTRACT_INT(pc); +  pc+=GET_JUMP();    Pike_sp[-1].u.integer++;    }else{    SKIPJUMP();    }    break;    }       CASE(F_APPLY_AND_RETURN);    {    INT32 args = DO_NOT_WARN(Pike_sp - *--Pike_mark_sp);
pike.git/src/interpret_functions.h:1478:    strict_apply_svalue(&((Pike_fp->context.prog->constants + GET_ARG())->sval),    DO_NOT_WARN(Pike_sp - *--Pike_mark_sp ));    break;       CASE(F_APPLY_AND_POP);    strict_apply_svalue(&((Pike_fp->context.prog->constants + GET_ARG())->sval),    DO_NOT_WARN(Pike_sp - *--Pike_mark_sp ));    pop_stack();    break;    -  CASE(F_CALL_FUNCTION); + OPCODE0(F_CALL_FUNCTION, "call function")    mega_apply(APPLY_STACK,    DO_NOT_WARN(Pike_sp - *--Pike_mark_sp),    0,0); -  break; + BREAK;    -  CASE(F_CALL_FUNCTION_AND_RETURN); + OPCODE0(F_CALL_FUNCTION_AND_POP, "call function & pop") +  mega_apply(APPLY_STACK, +  DO_NOT_WARN(Pike_sp - *--Pike_mark_sp), +  0,0); +  pop_stack(); + BREAK; +  + OPCODE0(F_CALL_FUNCTION_AND_RETURN, "call function & return")   {    INT32 args = DO_NOT_WARN(Pike_sp - *--Pike_mark_sp);    if(!args)    PIKE_ERROR("`()", "Too few arguments (call&return).\n", Pike_sp, 0);    switch(Pike_sp[-args].type)    {    case PIKE_T_INT:    if (!Pike_sp[-args].u.integer) {    PIKE_ERROR("`()", "Attempt to call the NULL-value\n",    Pike_sp, args);    }    case PIKE_T_STRING:    case PIKE_T_FLOAT:    case PIKE_T_MAPPING:    case PIKE_T_MULTISET:    PIKE_ERROR("`()", "Attempt to call a non-function value.\n",    Pike_sp, args);    }    return args;   } -  + BREAK;    -  +    /* Assume that the number of arguments is correct */   OPCODE1_JUMP(F_COND_RECUR,"recur if not overloaded")   {    /* FIXME:    * this test should actually test if this function is    * overloaded or not. Currently it only tests if    * this context is inherited or not.    */    if(Pike_fp->current_object->prog != Pike_fp->context.prog)    {
pike.git/src/interpret_functions.h:1528:    arg1+Pike_fp->context.identifier_level,    DO_NOT_WARN(Pike_sp - *--Pike_mark_sp));    pc+=sizeof(INT32);    DONE;    }   }   /* FALL THROUGH */      /* Assume that the number of arguments is correct */   OPCODE0_TAILJUMP(F_RECUR,"recur") + OPCODE0_TAILJUMP(F_RECUR_AND_POP,"recur & pop")   { -  int x; +  int x, opcode = instr;    INT32 num_locals, args;    char *addr;    struct light_frame_info info;    struct svalue *save_sp, **save_mark_sp;    ONERROR uwp;       fast_check_threads_etc(6);    check_c_stack(8192);    check_stack(256);       info.saved_fp = Pike_fp;    info.expendible = Pike_fp->expendible;    info.locals = Pike_fp->locals;    SET_ONERROR(uwp, restore_light_frame_info, &info);       save_sp = Pike_fp->expendible = Pike_fp->locals = *--Pike_mark_sp;    args = DO_NOT_WARN(Pike_sp - Pike_fp->locals);    save_mark_sp = Pike_mark_sp;    -  addr=pc+EXTRACT_INT(pc); +  addr=pc+GET_JUMP();    num_locals=EXTRACT_UCHAR(addr-2);      #ifdef PIKE_DEBUG    if(args != EXTRACT_UCHAR(addr-1))    fatal("Wrong number of arguments in F_RECUR %d!=%d\n",    args, EXTRACT_UCHAR(addr-1));   #endif       clear_svalues(Pike_sp, num_locals - args);    Pike_sp += num_locals - args;
pike.git/src/interpret_functions.h:1581:    {    assign_svalue(save_sp,Pike_sp-1);    pop_n_elems(Pike_sp-save_sp-1);    }    CALL_AND_UNSET_ONERROR(uwp);    print_return_value();   #ifdef PIKE_DEBUG    if(Pike_sp != save_sp+1)    fatal("Stack whack in F_RECUR Pike_sp=%p, expected=%p\n",Pike_sp,save_sp+1);   #endif +  if (opcode == F_RECUR_AND_POP-F_OFFSET) pop_stack();   }   BREAK      /* Assume that the number of arguments is correct */   /* FIXME: adjust Pike_mark_sp */   OPCODE0_JUMP(F_TAIL_RECUR,"tail recursion")   {    int x;    INT32 num_locals;    char *addr;    int args = DO_NOT_WARN(Pike_sp - *--Pike_mark_sp);       fast_check_threads_etc(6);    -  addr=pc+EXTRACT_INT(pc); +  addr=pc+GET_JUMP();    num_locals=EXTRACT_UCHAR(addr-2);         #ifdef PIKE_DEBUG    if(args != EXTRACT_UCHAR(addr-1))    fatal("Wrong number of arguments in F_TAIL_RECUR %d != %d\n",    args, EXTRACT_UCHAR(addr-1));   #endif       if(Pike_sp-args != Pike_fp->locals)