pike.git / src / interpret_functions.h

version» Context lines:

pike.git/src/interpret_functions.h: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_functions.h,v 1.156 2003/09/05 15:19:20 mast Exp $ + || $Id: interpret_functions.h,v 1.157 2003/09/23 17:36:36 grubba Exp $   */      /*    * Opcode definitions for the interpreter.    */      #include "global.h"      #undef CJUMP   #undef AUTO_BIGNUM_LOOP_TEST
pike.git/src/interpret_functions.h:962:      OPCODE2(F_APPLY_ASSIGN_LOCAL_AND_POP, "apply, assign local and pop", I_UPDATE_SP|I_UPDATE_M_SP, {    apply_svalue(&((Pike_fp->context.prog->constants + arg1)->sval),    DO_NOT_WARN((INT32)(Pike_sp - *--Pike_mark_sp)));    free_svalue(Pike_fp->locals+arg2);    Pike_fp->locals[arg2]=Pike_sp[-1];    dmalloc_touch_svalue(Pike_sp-1);    Pike_sp--;   });    - OPCODE2(F_APPLY_ASSIGN_LOCAL, "apply, assign local", I_UPDATE_SP|I_UPDATE_M_SP, { + OPCODE2(F_APPLY_ASSIGN_LOCAL, "apply, assign local", I_UPDATE_ALL, {    apply_svalue(&((Pike_fp->context.prog->constants + arg1)->sval),    DO_NOT_WARN((INT32)(Pike_sp - *--Pike_mark_sp)));    assign_svalue(Pike_fp->locals+arg2, Pike_sp-1);   });      OPCODE0(F_ASSIGN_AND_POP, "assign and pop", I_UPDATE_SP, {    assign_lvalue(Pike_sp-3, Pike_sp-1);    pop_n_elems(3);   });   
pike.git/src/interpret_functions.h:1234:    }else{    DO_BRANCH();    pop_2_elems();    push_int(0);    }   });      /* This instruction can't currently be a branch, since    * it has more than two continuation paths.    */ - OPCODE0_PTRJUMP(F_CATCH, "catch", I_UPDATE_FP, { + OPCODE0_PTRJUMP(F_CATCH, "catch", I_UPDATE_ALL, {    PIKE_OPCODE_T *next_addr;    JUMP_SET_TO_PC_AT_NEXT (next_addr);    check_c_stack(8192);    switch (o_catch((PIKE_OPCODE_T *)(((INT32 *)next_addr)+1)))    {    case 1:    /* There was a return inside the evaluated code */    DO_DUMB_RETURN;    case 2:    /* Escape catch, continue after the escape instruction. */
pike.git/src/interpret_functions.h:1264:    JUMP_SET_TO_PC_AT_NEXT (Pike_fp->pc);    INTER_ESCAPE_CATCH;   });      OPCODE0_RETURN(F_EXIT_CATCH, "exit catch", I_PC_AT_NEXT|I_UPDATE_SP, {    push_undefined();    JUMP_SET_TO_PC_AT_NEXT (Pike_fp->pc);    INTER_ESCAPE_CATCH;   });    - OPCODE1_JUMP(F_SWITCH, "switch", I_UPDATE_SP, { + OPCODE1_JUMP(F_SWITCH, "switch", I_UPDATE_ALL, {    INT32 tmp;    PIKE_OPCODE_T *addr;    JUMP_SET_TO_PC_AT_NEXT (addr);    tmp=switch_lookup(Pike_fp->context.prog->    constants[arg1].sval.u.array,Pike_sp-1);    addr = DO_IF_ELSE_COMPUTED_GOTO(addr, (PIKE_OPCODE_T *)    DO_ALIGN(PTR_TO_INT(addr),    ((ptrdiff_t)sizeof(INT32))));    addr = (PIKE_OPCODE_T *)(((INT32 *)addr) + (tmp>=0 ? 1+tmp*2 : 2*~tmp));    if(*(INT32*)addr < 0) fast_check_threads_etc(7);    pop_stack();    DO_JUMP_TO(addr + *(INT32*)addr);   });    - OPCODE1_JUMP(F_SWITCH_ON_INDEX, "switch on index", I_UPDATE_SP, { + OPCODE1_JUMP(F_SWITCH_ON_INDEX, "switch on index", I_UPDATE_ALL, {    INT32 tmp;    struct svalue s;    PIKE_OPCODE_T *addr;    JUMP_SET_TO_PC_AT_NEXT (addr);    index_no_free(&s,Pike_sp-2,Pike_sp-1);    Pike_sp++[0]=s;       tmp=switch_lookup(Pike_fp->context.prog->    constants[arg1].sval.u.array,Pike_sp-1);    pop_n_elems(3);
pike.git/src/interpret_functions.h:1801:    pop_stack();   });      OPCODE0_ALIAS(F_RANGE, "range", I_UPDATE_SP, o_range);      OPCODE0(F_COPY_VALUE, "copy_value", 0, {    struct svalue tmp;    copy_svalues_recursively_no_free(&tmp,Pike_sp-1,1,0);    free_svalue(Pike_sp-1);    Pike_sp[-1]=tmp; +  print_return_value();   });      OPCODE0(F_INDIRECT, "indirect", I_UPDATE_SP, {    struct svalue s;    lvalue_to_svalue_no_free(&s,Pike_sp-2);    if(s.type != PIKE_T_STRING)    {    pop_2_elems();    *Pike_sp=s;    Pike_sp++;
pike.git/src/interpret_functions.h:1837:   });      OPCODE1(F_SIZEOF_LOCAL, "sizeof local", I_UPDATE_SP, {    push_int(pike_sizeof(Pike_fp->locals+arg1));   });      OPCODE1_ALIAS(F_SSCANF, "sscanf", I_UPDATE_SP, o_sscanf);      #define MKAPPLY(OP,OPCODE,NAME,TYPE, ARG2, ARG3) \    PIKE_CONCAT(OP,_JUMP)(PIKE_CONCAT(F_,OPCODE),NAME, \ -  I_PC_AT_NEXT|I_UPDATE_FP|I_UPDATE_SP|I_UPDATE_M_SP, { \ +  I_PC_AT_NEXT|I_UPDATE_ALL, { \   JUMP_SET_TO_PC_AT_NEXT (Pike_fp->pc); \   if(low_mega_apply(TYPE,DO_NOT_WARN((INT32)(Pike_sp - *--Pike_mark_sp)), \    ARG2, ARG3)) \   { \    Pike_fp->flags |= PIKE_FRAME_RETURN_INTERNAL; \    DO_JUMP_TO(Pike_fp->pc); \   } \   else { \    DO_JUMP_TO_NEXT; \   } \   }); \    \    PIKE_CONCAT(OP,_JUMP)(PIKE_CONCAT3(F_,OPCODE,_AND_POP),NAME " & pop", \ -  I_PC_AT_NEXT|I_UPDATE_FP|I_UPDATE_SP|I_UPDATE_M_SP, { \ +  I_PC_AT_NEXT|I_UPDATE_ALL, { \    JUMP_SET_TO_PC_AT_NEXT (Pike_fp->pc); \    if(low_mega_apply(TYPE, DO_NOT_WARN((INT32)(Pike_sp - *--Pike_mark_sp)), \    ARG2, ARG3)) \    { \    Pike_fp->flags |= PIKE_FRAME_RETURN_INTERNAL | PIKE_FRAME_RETURN_POP; \    DO_JUMP_TO(Pike_fp->pc); \    }else{ \    pop_stack(); \    DO_JUMP_TO_NEXT; \    } \   }); \    \   PIKE_CONCAT(OP,_RETURN)(PIKE_CONCAT3(F_,OPCODE,_AND_RETURN), \    NAME " & return", \ -  I_UPDATE_FP|I_UPDATE_SP|I_UPDATE_M_SP, { \ +  I_UPDATE_ALL, { \    if(low_mega_apply(TYPE,DO_NOT_WARN((INT32)(Pike_sp - *--Pike_mark_sp)), \    ARG2,ARG3)) \    { \    PIKE_OPCODE_T *addr = Pike_fp->pc; \    DO_IF_DEBUG(Pike_fp->next->pc=0); \    unlink_previous_frame(); \    DO_JUMP_TO(addr); \    }else{ \    DO_DUMB_RETURN; \    } \   }); \         #define MKAPPLY2(OP,OPCODE,NAME,TYPE, ARG2, ARG3) \    \   MKAPPLY(OP,OPCODE,NAME,TYPE, ARG2, ARG3) \    \   PIKE_CONCAT(OP,_JUMP)(PIKE_CONCAT(F_MARK_,OPCODE),"mark, " NAME, \ -  I_PC_AT_NEXT|I_UPDATE_SP|I_UPDATE_FP, { \ +  I_PC_AT_NEXT|I_UPDATE_ALL, { \    JUMP_SET_TO_PC_AT_NEXT (Pike_fp->pc); \    if(low_mega_apply(TYPE, 0, \    ARG2, ARG3)) \    { \    Pike_fp->flags |= PIKE_FRAME_RETURN_INTERNAL; \    DO_JUMP_TO(Pike_fp->pc); \    } \    else { \    DO_JUMP_TO_NEXT; \    } \   }); \    \   PIKE_CONCAT(OP,_JUMP)(PIKE_CONCAT3(F_MARK_,OPCODE,_AND_POP), \    "mark, " NAME " & pop", \ -  I_PC_AT_NEXT|I_UPDATE_SP|I_UPDATE_FP, { \ +  I_PC_AT_NEXT|I_UPDATE_ALL, { \    JUMP_SET_TO_PC_AT_NEXT (Pike_fp->pc); \    if(low_mega_apply(TYPE, 0, \    ARG2, ARG3)) \    { \    Pike_fp->flags |= PIKE_FRAME_RETURN_INTERNAL | PIKE_FRAME_RETURN_POP; \    DO_JUMP_TO(Pike_fp->pc); \    }else{ \    pop_stack(); \    DO_JUMP_TO_NEXT; \    } \   }); \    \   PIKE_CONCAT(OP,_RETURN)(PIKE_CONCAT3(F_MARK_,OPCODE,_AND_RETURN), \    "mark, " NAME " & return", \ -  I_UPDATE_SP|I_UPDATE_FP, { \ +  I_UPDATE_ALL, { \    if(low_mega_apply(TYPE, 0, \    ARG2,ARG3)) \    { \    PIKE_OPCODE_T *addr = Pike_fp->pc; \    DO_IF_DEBUG(Pike_fp->next->pc=0); \    unlink_previous_frame(); \    DO_JUMP_TO(addr); \    }else{ \    DO_DUMB_RETURN; \    } \
pike.git/src/interpret_functions.h:1938:      MKAPPLY2(OPCODE1,CALL_LFUN,"call lfun",APPLY_LOW,    Pike_fp->current_object,    (void *)(ptrdiff_t)(arg1+Pike_fp->context.identifier_level));      MKAPPLY2(OPCODE1,APPLY,"apply",APPLY_SVALUE_STRICT,    &((Pike_fp->context.prog->constants + arg1)->sval),0);      MKAPPLY(OPCODE0,CALL_FUNCTION,"call function",APPLY_STACK, 0,0);    - OPCODE1_JUMP(F_CALL_OTHER,"call other", I_PC_AT_NEXT|I_UPDATE_FP|I_UPDATE_SP|I_UPDATE_M_SP, { + OPCODE1_JUMP(F_CALL_OTHER,"call other", I_PC_AT_NEXT|I_UPDATE_ALL, {    INT32 args=DO_NOT_WARN((INT32)(Pike_sp - *--Pike_mark_sp));    struct svalue *s=Pike_sp-args;    JUMP_SET_TO_PC_AT_NEXT (Pike_fp->pc);    if(s->type == T_OBJECT)    {    struct object *o=s->u.object;    struct program *p;    if((p=o->prog))    {    if(FIND_LFUN(p, LFUN_ARROW) == -1)
pike.git/src/interpret_functions.h:1992:    {    Pike_fp->flags |= PIKE_FRAME_RETURN_INTERNAL;    DO_JUMP_TO(Pike_fp->pc);    }    else {    DO_JUMP_TO_NEXT;    }    }   });    - OPCODE1_JUMP(F_CALL_OTHER_AND_POP,"call other & pop", I_PC_AT_NEXT|I_UPDATE_FP|I_UPDATE_SP|I_UPDATE_M_SP, { + OPCODE1_JUMP(F_CALL_OTHER_AND_POP,"call other & pop", I_PC_AT_NEXT|I_UPDATE_ALL, {    INT32 args=DO_NOT_WARN((INT32)(Pike_sp - *--Pike_mark_sp));    struct svalue *s=Pike_sp-args;    JUMP_SET_TO_PC_AT_NEXT (Pike_fp->pc);    if(s->type == T_OBJECT)    {    struct object *o=s->u.object;    struct program *p;    if((p=o->prog))    {    if(FIND_LFUN(p, LFUN_ARROW) == -1)
pike.git/src/interpret_functions.h:2049:    Pike_fp->flags |= PIKE_FRAME_RETURN_INTERNAL | PIKE_FRAME_RETURN_POP;    DO_JUMP_TO(Pike_fp->pc);    }    else {    pop_stack();    DO_JUMP_TO_NEXT;    }    }   });    - OPCODE1_JUMP(F_CALL_OTHER_AND_RETURN,"call other & return", I_UPDATE_FP|I_UPDATE_SP|I_UPDATE_M_SP, { + OPCODE1_JUMP(F_CALL_OTHER_AND_RETURN,"call other & return", I_UPDATE_ALL, {    INT32 args=DO_NOT_WARN((INT32)(Pike_sp - *--Pike_mark_sp));    struct svalue *s=Pike_sp-args;    if(s->type == T_OBJECT)    {    struct object *o=s->u.object;    struct program *p;    if((p=o->prog))    {    if(FIND_LFUN(p, LFUN_ARROW) == -1)    {
pike.git/src/interpret_functions.h:2143:    s->u.efun->name->str, s->u.efun->may_return_void); \    } \    if(Pike_interpreter.trace_level>1 && Pike_sp>expected_stack) \    trace_return_value(); \   }while(0)   #else   #define DO_CALL_BUILTIN(ARGS) \   (*(Pike_fp->context.prog->constants[arg1].sval.u.efun->function))(ARGS)   #endif    - OPCODE1(F_CALL_BUILTIN, "call builtin", I_UPDATE_SP|I_UPDATE_M_SP, { + OPCODE1(F_CALL_BUILTIN, "call builtin", I_UPDATE_ALL, {    DO_CALL_BUILTIN(DO_NOT_WARN((INT32)(Pike_sp - *--Pike_mark_sp)));   });    - OPCODE1(F_CALL_BUILTIN_AND_POP,"call builtin & pop", I_UPDATE_SP|I_UPDATE_M_SP, { + OPCODE1(F_CALL_BUILTIN_AND_POP,"call builtin & pop", I_UPDATE_ALL, {    DO_CALL_BUILTIN(DO_NOT_WARN((INT32)(Pike_sp - *--Pike_mark_sp)));    pop_stack();   });    - OPCODE1_RETURN(F_CALL_BUILTIN_AND_RETURN,"call builtin & return", I_UPDATE_FP|I_UPDATE_SP|I_UPDATE_M_SP, { + OPCODE1_RETURN(F_CALL_BUILTIN_AND_RETURN,"call builtin & return", I_UPDATE_ALL, {    DO_CALL_BUILTIN(DO_NOT_WARN((INT32)(Pike_sp - *--Pike_mark_sp)));    DO_DUMB_RETURN;   });       - OPCODE1(F_MARK_CALL_BUILTIN, "mark, call builtin", I_UPDATE_SP, { + OPCODE1(F_MARK_CALL_BUILTIN, "mark, call builtin", I_UPDATE_ALL, {    DO_CALL_BUILTIN(0);   });      OPCODE1(F_MARK_CALL_BUILTIN_AND_POP, "mark, call builtin & pop", 0, {    DO_CALL_BUILTIN(0);    pop_stack();   });    - OPCODE1_RETURN(F_MARK_CALL_BUILTIN_AND_RETURN, "mark, call builtin & return", I_UPDATE_FP|I_UPDATE_SP, { + OPCODE1_RETURN(F_MARK_CALL_BUILTIN_AND_RETURN, "mark, call builtin & return", I_UPDATE_ALL, {    DO_CALL_BUILTIN(0);    DO_DUMB_RETURN;   });       - OPCODE1(F_CALL_BUILTIN1, "call builtin 1", 0, { + OPCODE1(F_CALL_BUILTIN1, "call builtin 1", I_UPDATE_ALL, {    DO_CALL_BUILTIN(1);   });    - OPCODE1(F_CALL_BUILTIN1_AND_POP, "call builtin1 & pop", I_UPDATE_SP, { + OPCODE1(F_CALL_BUILTIN1_AND_POP, "call builtin1 & pop", I_UPDATE_ALL, {    DO_CALL_BUILTIN(1);    pop_stack();   });      #ifndef ENTRY_PROLOGUE_SIZE   #define ENTRY_PROLOGUE_SIZE 0   #endif /* !ENTRY_PROLOGUE_SIZE */      #define DO_RECUR(XFLAGS) do{ \    PIKE_OPCODE_T *addr; \
pike.git/src/interpret_functions.h:2246:    \    DO_IF_SECURITY(if(!CHECK_DATA_SECURITY(Pike_fp->current_object, \    SECURITY_BIT_NOT_SETUID)) \    SET_CURRENT_CREDS(Pike_fp->current_object->prot)); \    \    FETCH; \    JUMP_DONE; \   }while(0)      /* Assume that the number of arguments is correct */ - OPCODE1_PTRJUMP(F_COND_RECUR, "recur if not overloaded", I_PC_AT_NEXT|I_UPDATE_FP|I_UPDATE_SP|I_UPDATE_M_SP, { + OPCODE1_PTRJUMP(F_COND_RECUR, "recur if not overloaded", I_PC_AT_NEXT|I_UPDATE_ALL, {    struct program *p = Pike_fp->current_object->prog;    PIKE_OPCODE_T *addr;    JUMP_SET_TO_PC_AT_NEXT (addr);    Pike_fp->pc = (PIKE_OPCODE_T *)(((INT32 *)addr) + 1);       /* Test if the function is overloaded.    *    * Note: The second part of the test is sufficient, but    * the since first case is much simpler to test and    * is common, it should offer a speed improvement.
pike.git/src/interpret_functions.h:2297:    Pike_fp->flags |= PIKE_FRAME_RETURN_INTERNAL;    addr = Pike_fp->pc;    }    DO_JUMP_TO(addr);    }       /* FALL THROUGH */       /* Assume that the number of arguments is correct */    -  OPCODE0_TAILPTRJUMP(F_RECUR, "recur", I_UPDATE_FP|I_UPDATE_SP|I_UPDATE_M_SP, { +  OPCODE0_TAILPTRJUMP(F_RECUR, "recur", I_UPDATE_ALL, {    DO_RECUR(0);    });   });      /* Ugly code duplication */ - OPCODE0_PTRJUMP(F_RECUR_AND_POP, "recur & pop", I_UPDATE_FP|I_UPDATE_SP|I_UPDATE_M_SP, { + OPCODE0_PTRJUMP(F_RECUR_AND_POP, "recur & pop", I_UPDATE_ALL, {    DO_RECUR(PIKE_FRAME_RETURN_POP);   });         /* Assume that the number of arguments is correct */   /* FIXME: adjust Pike_mark_sp */ - OPCODE0_PTRJUMP(F_TAIL_RECUR, "tail recursion", I_UPDATE_FP|I_UPDATE_SP|I_UPDATE_M_SP, { + OPCODE0_PTRJUMP(F_TAIL_RECUR, "tail recursion", I_UPDATE_ALL, {    INT32 num_locals;    PIKE_OPCODE_T *addr;    INT32 args;       fast_check_threads_etc(6);       JUMP_SET_TO_PC_AT_NEXT (addr);    addr += GET_JUMP();    num_locals = READ_INCR_BYTE(addr);    args = READ_INCR_BYTE(addr);