pike.git / src / interpret_functions.h

version» Context lines:

pike.git/src/interpret_functions.h:1:   /* -  * $Id: interpret_functions.h,v 1.53 2001/05/11 12:21:10 grubba Exp $ +  * $Id: interpret_functions.h,v 1.54 2001/05/14 03:26:21 hubbe 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:1095:    check_threads_etc();   #endif       /* fall through */       CASE(F_DUMB_RETURN);    do_dumb_return:    if(Pike_fp -> flags & PIKE_FRAME_RETURN_INTERNAL)    {    int f=Pike_fp->flags; -  gdb_stop_here(); +     low_return();    if(f & PIKE_FRAME_RETURN_POP)    pop_stack();    pc=Pike_fp->pc;    break;    }    return -1;      OPCODE0(F_NEGATE, "unary minus")    if(Pike_sp[-1].type == PIKE_T_INT)
pike.git/src/interpret_functions.h:1497:      OPCODE1(F_SIZEOF_LOCAL, "sizeof local")    push_int(pike_sizeof(Pike_fp->locals+arg1));   BREAK;      OPCODE1(F_SSCANF, "sscanf")    o_sscanf(arg1);   BREAK;      OPCODE1(F_CALL_LFUN,"call lfun") - #if 0 -  apply_low(Pike_fp->current_object, -  arg1+Pike_fp->context.identifier_level, -  DO_NOT_WARN(Pike_sp - *--Pike_mark_sp)); - #else +     if(low_mega_apply(APPLY_LOW,    DO_NOT_WARN(Pike_sp - *--Pike_mark_sp),    Pike_fp->current_object,    (void *)(arg1+Pike_fp->context.identifier_level)))    {    Pike_fp->next->pc=pc; -  gdb_stop_here(); +     Pike_fp->flags |= PIKE_FRAME_RETURN_INTERNAL;    pc=Pike_fp->pc;    } - #endif +    BREAK;      OPCODE1(F_CALL_LFUN_AND_POP,"call lfun & pop") - #if 1 + #if 0    apply_low(Pike_fp->current_object,    arg1+Pike_fp->context.identifier_level,    DO_NOT_WARN(Pike_sp - *--Pike_mark_sp));    pop_stack();   #else    if(low_mega_apply(APPLY_LOW,    DO_NOT_WARN(Pike_sp - *--Pike_mark_sp),    Pike_fp->current_object,    (void *)(arg1+Pike_fp->context.identifier_level)))    {    Pike_fp->next->pc=pc; -  gdb_stop_here(); +     Pike_fp->flags |= PIKE_FRAME_RETURN_INTERNAL | PIKE_FRAME_RETURN_POP;    pc=Pike_fp->pc;    }else{    pop_stack();    }   #endif   BREAK;      OPCODE1(F_MARK_APPLY,"mark apply")    if(low_mega_apply(APPLY_SVALUE,    0,    &((Pike_fp->context.prog->constants + arg1)->sval),0))    {    Pike_fp->next->pc=pc; -  gdb_stop_here(); +     Pike_fp->flags |= PIKE_FRAME_RETURN_INTERNAL;    pc=Pike_fp->pc;    }   BREAK;      OPCODE1(F_MARK_APPLY_POP,"mark, apply & pop")    if(low_mega_apply(APPLY_SVALUE,    0,    &((Pike_fp->context.prog->constants + arg1)->sval),0))    {    Pike_fp->next->pc=pc; -  gdb_stop_here(); +     Pike_fp->flags |= PIKE_FRAME_RETURN_INTERNAL | PIKE_FRAME_RETURN_POP;    pc=Pike_fp->pc;    }else{    pop_stack();    }   BREAK;      OPCODE1(F_APPLY,"apply")    if(low_mega_apply(APPLY_SVALUE,    DO_NOT_WARN(Pike_sp - *--Pike_mark_sp ),    &((Pike_fp->context.prog->constants + arg1)->sval),0))    {    Pike_fp->next->pc=pc; -  gdb_stop_here(); +     Pike_fp->flags |= PIKE_FRAME_RETURN_INTERNAL;    pc=Pike_fp->pc;    }   BREAK;         OPCODE1(F_APPLY_AND_POP,"apply")    if(low_mega_apply(APPLY_SVALUE,    DO_NOT_WARN(Pike_sp - *--Pike_mark_sp ),    &((Pike_fp->context.prog->constants + arg1)->sval),0))    {    Pike_fp->next->pc=pc; -  gdb_stop_here(); +     Pike_fp->flags |= PIKE_FRAME_RETURN_INTERNAL | PIKE_FRAME_RETURN_POP;    pc=Pike_fp->pc;    }else{    pop_stack();    }   BREAK;         OPCODE0(F_CALL_FUNCTION,"call function")    if(low_mega_apply(APPLY_STACK,    DO_NOT_WARN(Pike_sp - *--Pike_mark_sp ),    0,0))    {    Pike_fp->next->pc=pc; -  gdb_stop_here(); +     Pike_fp->flags |= PIKE_FRAME_RETURN_INTERNAL;    pc=Pike_fp->pc;    }   BREAK;         OPCODE0(F_CALL_FUNCTION_AND_POP,"call function & pop")    if(low_mega_apply(APPLY_STACK,    DO_NOT_WARN(Pike_sp - *--Pike_mark_sp ),    0,0))    {    Pike_fp->next->pc=pc; -  gdb_stop_here(); +     Pike_fp->flags |= PIKE_FRAME_RETURN_INTERNAL | PIKE_FRAME_RETURN_POP;    pc=Pike_fp->pc;    }else{    pop_stack();    }   BREAK;      OPCODE1(F_APPLY_AND_RETURN,"apply & return")   {    if(low_mega_apply(APPLY_SVALUE,
pike.git/src/interpret_functions.h:1645:   OPCODE1(F_CALL_LFUN_AND_RETURN,"call lfun & return")   {    if(low_mega_apply(APPLY_LOW,    DO_NOT_WARN(Pike_sp - *--Pike_mark_sp),    Pike_fp->current_object,    (void *)(arg1+Pike_fp->context.identifier_level)))    {   #ifdef PIKE_DEBUG    Pike_fp->next->pc=0;   #endif -  gdb_stop_here(); +     pc=Pike_fp->pc;    unlink_previous_frame();    }else{    goto do_dumb_return;    }   }   BREAK      OPCODE0(F_CALL_FUNCTION_AND_RETURN, "call function & return")   {    if(low_mega_apply(APPLY_STACK,    DO_NOT_WARN(Pike_sp - *--Pike_mark_sp ),    0,0))    {   #ifdef PIKE_DEBUG    Pike_fp->next->pc=0;   #endif -  gdb_stop_here(); +     pc=Pike_fp->pc;    unlink_previous_frame();    }else{    goto do_dumb_return;    }   }   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)    { -  apply_low(Pike_fp->current_object, -  arg1+Pike_fp->context.identifier_level, -  DO_NOT_WARN(Pike_sp - *--Pike_mark_sp)); +     pc+=sizeof(INT32); -  +  if(low_mega_apply(APPLY_LOW, +  DO_NOT_WARN(Pike_sp - *--Pike_mark_sp), +  Pike_fp->current_object, +  (void *)(arg1+Pike_fp->context.identifier_level))) +  { +  Pike_fp->next->pc=pc; +  Pike_fp->flags |= PIKE_FRAME_RETURN_INTERNAL; +  pc=Pike_fp->pc; +  }    DONE;    }   }   /* FALL THROUGH */      /* Assume that the number of arguments is correct */   /* FIXME: Use new recursion stuff */   OPCODE0_TAILJUMP(F_RECUR,"recur")   OPCODE0_TAILJUMP(F_RECUR_AND_POP,"recur & pop")   { - #if 1 +     int opcode = instr;    unsigned char *addr;    struct pike_frame *new_frame;       fast_check_threads_etc(6);    check_c_stack(8192);    check_stack(256);       new_frame=alloc_pike_frame();    new_frame[0]=Pike_fp[0];
pike.git/src/interpret_functions.h:1743: Inside #if 1
   add_ref(new_frame->current_object);    add_ref(new_frame->context.prog);    if(new_frame->context.parent)    add_ref(new_frame->context.parent);    Pike_fp->pc=pc+sizeof(INT32);    Pike_fp=new_frame;    pc=addr;    new_frame->flags=PIKE_FRAME_RETURN_INTERNAL;    if (opcode == F_RECUR_AND_POP-F_OFFSET)    new_frame->flags|=PIKE_FRAME_RETURN_POP; - #else /* 0 */ -  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; -  info.flags=Pike_fp->flags; -  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+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; -  -  x=eval_instruction(addr); -  EVAL_INSTR_RET_CHECK(x); - #ifdef PIKE_DEBUG -  if(Pike_mark_sp < save_mark_sp) -  fatal("mark Pike_sp underflow in F_RECUR.\n"); - #endif -  Pike_mark_sp=save_mark_sp; -  if(x>=0) mega_apply(APPLY_STACK, x, 0,0); -  pc+=sizeof(INT32); -  if(save_sp+1 < Pike_sp) -  { -  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(); - #endif /* 0 */ - } +    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;    unsigned char *addr;    int args = DO_NOT_WARN(Pike_sp - *--Pike_mark_sp);