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.171 2004/09/23 11:45:22 grubba Exp $ + || $Id: interpret_functions.h,v 1.172 2004/09/30 13:20:00 mast Exp $   */      /*    * Opcode definitions for the interpreter.    */      #include "global.h"      #undef CJUMP   #undef AUTO_BIGNUM_LOOP_TEST
pike.git/src/interpret_functions.h:201:   #else /* !OPCODE_RETURN_JUMPADDR */   #define JUMP_SET_TO_PC_AT_NEXT(PC) ((PC) = PROG_COUNTER)   #define DO_JUMP_TO_NEXT JUMP_DONE   #endif /* !OPCODE_RETURN_JUMPADDR */      #undef DO_INDEX   #define DO_INDEX do { \    LOCAL_VAR(struct svalue tmp); \    index_no_free(&tmp,Pike_sp-2,Pike_sp-1); \    pop_2_elems(); \ -  *Pike_sp=tmp; \ +  move_svalue (Pike_sp, &tmp); \    Pike_sp++; \ -  dmalloc_touch_svalue(Pike_sp-1); \ +     print_return_value(); \    }while(0)         OPCODE0(F_UNDEFINED, "push UNDEFINED", I_UPDATE_SP, {    push_int(0);    Pike_sp[-1].subtype=NUMBER_UNDEFINED;   });      OPCODE0(F_CONST0, "push 0", I_UPDATE_SP, {
pike.git/src/interpret_functions.h:325:    tmp.u.integer = 0;    }    } else {    LOCAL_VAR(struct svalue tmp2);    tmp2.type = PIKE_T_STRING;    tmp2.u.string = lfun_strings[arg1];    tmp2.subtype = 1;    index_no_free(&tmp, Pike_sp-1, &tmp2);    }    free_svalue(Pike_sp-1); -  Pike_sp[-1] = tmp; +  move_svalue (Pike_sp - 1, &tmp);    print_return_value();   });      OPCODE1(F_LFUN, "local function", I_UPDATE_SP, {    ref_push_function (Pike_fp->current_object,    arg1+Pike_fp->context.identifier_level);    print_return_value();   });      OPCODE2(F_TRAMPOLINE, "trampoline", I_UPDATE_SP, {
pike.git/src/interpret_functions.h:499:    Pike_sp[0].u.lval=f->locals+arg1;    Pike_sp[1].type=T_VOID;    Pike_sp+=2;   });      OPCODE1(F_ARRAY_LVALUE, "[ lvalues ]", I_UPDATE_SP, {    f_aggregate(arg1*2);    Pike_sp[-1].u.array->flags |= ARRAY_LVALUE;    Pike_sp[-1].u.array->type_field |= BIT_UNFINISHED | BIT_MIXED;    /* FIXME: Shouldn't a ref be added here? */ -  Pike_sp[0] = Pike_sp[-1]; +  move_svalue (Pike_sp, Pike_sp - 1);    Pike_sp[-1].type = T_ARRAY_LVALUE; -  dmalloc_touch_svalue(Pike_sp); +     Pike_sp++;   });      OPCODE1(F_CLEAR_2_LOCAL, "clear 2 local", 0, {    free_mixed_svalues(Pike_fp->locals + arg1, 2);    Pike_fp->locals[arg1].type = PIKE_T_INT;    Pike_fp->locals[arg1].subtype = 0;    Pike_fp->locals[arg1].u.integer = 0;    Pike_fp->locals[arg1+1].type = PIKE_T_INT;    Pike_fp->locals[arg1+1].subtype = 0;
pike.git/src/interpret_functions.h:646:    dmalloc_touch_svalue(Pike_sp-1);    lvalue_to_svalue_no_free(Pike_sp, Pike_sp-2);    Pike_sp++;    print_return_value();   });      OPCODE0(F_LTOSVAL2, "ltosval2", I_UPDATE_SP, {    dmalloc_touch_svalue(Pike_sp-3);    dmalloc_touch_svalue(Pike_sp-2);    dmalloc_touch_svalue(Pike_sp-1); -  Pike_sp[0] = Pike_sp[-1]; +  move_svalue (Pike_sp, Pike_sp - 1);    Pike_sp[-1].type = PIKE_T_INT;    Pike_sp++;    lvalue_to_svalue_no_free(Pike_sp-2, Pike_sp-4);       /* this is so that foo+=bar (and similar things) will be faster, this    * is done by freeing the old reference to foo after it has been pushed    * on the stack. That way foo can have only 1 reference if we are lucky,    * and then the low array/multiset/mapping manipulation routines can be    * destructive if they like    */
pike.git/src/interpret_functions.h:669:    {    LOCAL_VAR(struct svalue tmp);    tmp.type = PIKE_T_INT;    tmp.subtype = 0;    tmp.u.integer = 0;    assign_lvalue(Pike_sp-4, &tmp);    }   });      OPCODE0(F_LTOSVAL3, "ltosval3", I_UPDATE_SP, { -  Pike_sp[0] = Pike_sp[-1]; -  Pike_sp[-1] = Pike_sp[-2]; +  move_svalue (Pike_sp, Pike_sp - 1); +  move_svalue (Pike_sp - 1, Pike_sp - 2);    Pike_sp[-2].type = PIKE_T_INT;    Pike_sp++;    lvalue_to_svalue_no_free(Pike_sp-3, Pike_sp-5);       /* this is so that foo=foo[x..y] (and similar things) will be faster, this    * is done by freeing the old reference to foo after it has been pushed    * on the stack. That way foo can have only 1 reference if we are lucky,    * and then the low array/multiset/mapping manipulation routines can be    * destructive if they like    */
pike.git/src/interpret_functions.h:693:    {    LOCAL_VAR(struct svalue tmp);    tmp.type = PIKE_T_INT;    tmp.subtype = 0;    tmp.u.integer = 0;    assign_lvalue(Pike_sp-5, &tmp);    }   });      OPCODE0(F_ADD_TO, "+=", I_UPDATE_SP, { -  Pike_sp[0]=Pike_sp[-1]; +  move_svalue (Pike_sp, Pike_sp - 1);    Pike_sp[-1].type=PIKE_T_INT;    Pike_sp++;    lvalue_to_svalue_no_free(Pike_sp-2,Pike_sp-4);       if( Pike_sp[-1].type == PIKE_T_INT &&    Pike_sp[-2].type == PIKE_T_INT )    {    DO_IF_BIGNUM(    if(!INT_TYPE_ADD_OVERFLOW(Pike_sp[-1].u.integer, Pike_sp[-2].u.integer))    )
pike.git/src/interpret_functions.h:751:    }    }    f_add(2);    assign_lvalue(Pike_sp-3,Pike_sp-1);    stack_pop_2_elems_keep_top();    add_to_done:    ; /* make gcc happy */   });      OPCODE0(F_ADD_TO_AND_POP, "+= and pop", I_UPDATE_SP, { -  Pike_sp[0]=Pike_sp[-1]; +  move_svalue (Pike_sp, Pike_sp - 1);    Pike_sp[-1].type=PIKE_T_INT;    Pike_sp++;    lvalue_to_svalue_no_free(Pike_sp-2,Pike_sp-4);       if( Pike_sp[-1].type == PIKE_T_INT &&    Pike_sp[-2].type == PIKE_T_INT )    {    DO_IF_BIGNUM(    if(!INT_TYPE_ADD_OVERFLOW(Pike_sp[-1].u.integer, Pike_sp[-2].u.integer))    )
pike.git/src/interpret_functions.h:944:   });      OPCODE1(F_ASSIGN_LOCAL, "assign local", 0, {    assign_svalue(Pike_fp->locals+arg1,Pike_sp-1);   });      OPCODE0(F_ASSIGN, "assign", I_UPDATE_SP, {    assign_lvalue(Pike_sp-3,Pike_sp-1);    free_svalue(Pike_sp-3);    free_svalue(Pike_sp-2); -  Pike_sp[-3]=Pike_sp[-1]; -  dmalloc_touch_svalue(Pike_sp-1); -  dmalloc_touch_svalue(Pike_sp-2); +  move_svalue (Pike_sp - 3, Pike_sp - 1);    Pike_sp-=2;   });      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); +  move_svalue (Pike_fp->locals + arg2, Pike_sp - 1);    Pike_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);   });      OPCODE1(F_ASSIGN_LOCAL_AND_POP, "assign local and pop", I_UPDATE_SP, {    free_svalue(Pike_fp->locals + arg1); -  Pike_fp->locals[arg1] = Pike_sp[-1]; -  dmalloc_touch_svalue(Pike_sp-1); +  move_svalue (Pike_fp->locals + arg1, Pike_sp - 1);    Pike_sp--;   });      OPCODE1(F_ASSIGN_GLOBAL, "assign global", 0, {    object_low_set_index(Pike_fp->current_object,    arg1 + Pike_fp->context.identifier_level,    Pike_sp-1);   });      OPCODE1(F_ASSIGN_GLOBAL_AND_POP, "assign global and pop", I_UPDATE_SP, {
pike.git/src/interpret_functions.h:1282:    pop_stack();    DO_JUMP_TO(addr + *(INT32*)addr);   });      OPCODE1_JUMP(F_SWITCH_ON_INDEX, "switch on index", I_UPDATE_ALL, {    INT32 tmp;    PIKE_OPCODE_T *addr;    LOCAL_VAR(struct svalue tmp2);    JUMP_SET_TO_PC_AT_NEXT (addr);    index_no_free(&tmp2, Pike_sp-2, Pike_sp-1); -  Pike_sp++[0] = tmp2; +  move_svalue (Pike_sp++, &tmp2);       tmp=switch_lookup(Pike_fp->context.prog->    constants[arg1].sval.u.array,Pike_sp-1);    pop_n_elems(3);    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);    DO_JUMP_TO(addr + *(INT32*)addr);
pike.git/src/interpret_functions.h:1615:       case PIKE_T_OBJECT:    if(!Pike_sp[-1].u.object->prog ||    FIND_LFUN(Pike_sp[-1].u.object->prog,LFUN__VALUES) == -1)    PIKE_ERROR("@", "Bad argument.\n", Pike_sp, 1);       apply_lfun(Pike_sp[-1].u.object, LFUN__VALUES, 0);    if(Pike_sp[-1].type != PIKE_T_ARRAY)    Pike_error("Bad return type from o->_values() in @\n");    free_svalue(Pike_sp-2); -  Pike_sp[-2]=Pike_sp[-1]; -  dmalloc_touch_svalue(Pike_sp-1); +  move_svalue (Pike_sp - 2, Pike_sp - 1);    Pike_sp--;    break;       case PIKE_T_ARRAY: break;    }    dmalloc_touch_svalue(Pike_sp-1);    Pike_sp--;    push_array_items(Pike_sp->u.array);   });   
pike.git/src/interpret_functions.h:1642:    index_no_free(Pike_sp-1,Pike_fp->locals+arg2,s);   });      OPCODE1(F_LOCAL_INDEX, "local index", 0, {    LOCAL_VAR(struct svalue *s);    LOCAL_VAR(struct svalue tmp);    s = Pike_fp->locals + arg1;    if(s->type == PIKE_T_STRING) s->subtype=0;    index_no_free(&tmp,Pike_sp-1,s);    free_svalue(Pike_sp-1); -  Pike_sp[-1]=tmp; +  move_svalue (Pike_sp - 1, &tmp);   });      OPCODE2(F_GLOBAL_LOCAL_INDEX, "global[local]", I_UPDATE_SP, {    LOCAL_VAR(struct svalue *s);    LOCAL_VAR(struct svalue tmp);    low_object_index_no_free(Pike_sp,    Pike_fp->current_object,    arg1 + Pike_fp->context.identifier_level);    Pike_sp++;    s=Pike_fp->locals+arg2;    if(s->type == PIKE_T_STRING) s->subtype=0;    index_no_free(&tmp,Pike_sp-1,s);    free_svalue(Pike_sp-1); -  Pike_sp[-1]=tmp; +  move_svalue (Pike_sp - 1, &tmp);   });      OPCODE2(F_LOCAL_ARROW, "local->x", I_UPDATE_SP, {    LOCAL_VAR(struct svalue tmp);    tmp.type=PIKE_T_STRING;    tmp.u.string=Pike_fp->context.prog->strings[arg1];    tmp.subtype=1;    Pike_sp->type=PIKE_T_INT;    Pike_sp++;    index_no_free(Pike_sp-1,Pike_fp->locals+arg2, &tmp);
pike.git/src/interpret_functions.h:1678:   });      OPCODE1(F_ARROW, "->x", 0, {    LOCAL_VAR(struct svalue tmp);    LOCAL_VAR(struct svalue tmp2);    tmp.type=PIKE_T_STRING;    tmp.u.string=Pike_fp->context.prog->strings[arg1];    tmp.subtype=1;    index_no_free(&tmp2, Pike_sp-1, &tmp);    free_svalue(Pike_sp-1); -  Pike_sp[-1]=tmp2; +  move_svalue (Pike_sp - 1, &tmp2);    print_return_value();   });      OPCODE1(F_STRING_INDEX, "string index", 0, {    LOCAL_VAR(struct svalue tmp);    LOCAL_VAR(struct svalue tmp2);    tmp.type=PIKE_T_STRING;    tmp.u.string=Pike_fp->context.prog->strings[arg1];    tmp.subtype=0;    index_no_free(&tmp2, Pike_sp-1, &tmp);    free_svalue(Pike_sp-1); -  Pike_sp[-1]=tmp2; +  move_svalue (Pike_sp - 1, &tmp2);    print_return_value();   });      OPCODE1(F_POS_INT_INDEX, "int index", 0, {    push_int(arg1);    print_return_value();    DO_INDEX;   });      OPCODE1(F_NEG_INT_INDEX, "-int index", 0, {
pike.git/src/interpret_functions.h:1799:    stack_swap();    pop_stack();   });      OPCODE0_ALIAS(F_RANGE, "range", I_UPDATE_SP, o_range);      OPCODE0(F_COPY_VALUE, "copy_value", 0, {    LOCAL_VAR(struct svalue tmp);    copy_svalues_recursively_no_free(&tmp,Pike_sp-1,1,0);    free_svalue(Pike_sp-1); -  Pike_sp[-1]=tmp; +  move_svalue (Pike_sp - 1, &tmp);    print_return_value();   });      OPCODE0(F_INDIRECT, "indirect", I_UPDATE_SP, {    LOCAL_VAR(struct svalue tmp);    lvalue_to_svalue_no_free(&tmp, Pike_sp-2);    if(tmp.type != PIKE_T_STRING)    {    pop_2_elems(); -  *Pike_sp = tmp; +  move_svalue (Pike_sp, &tmp);    Pike_sp++;    }else{    LOCAL_VAR(struct object *o); -  +  LOCAL_VAR(struct string_assignment_storage *s);    o=low_clone(string_assignment_program); -  ((struct string_assignment_storage *)o->storage)->lval[0]=Pike_sp[-2]; -  ((struct string_assignment_storage *)o->storage)->lval[1]=Pike_sp[-1]; -  ((struct string_assignment_storage *)o->storage)->s=tmp.u.string; +  s = (struct string_assignment_storage *)o->storage; +  move_svalue (s->lval, Pike_sp - 2); +  move_svalue (s->lval + 1, Pike_sp - 1); +  s->s=tmp.u.string;    Pike_sp-=2;    push_object(o);    }    print_return_value();   });      OPCODE0(F_SIZEOF, "sizeof", 0, {    INT_TYPE val = pike_sizeof(Pike_sp-1);    pop_stack();    push_int(val);
pike.git/src/interpret_functions.h:1980:    {    LOCAL_VAR(struct svalue tmp);    LOCAL_VAR(struct svalue tmp2);       tmp.type=PIKE_T_STRING;    tmp.u.string=Pike_fp->context.prog->strings[arg1];    tmp.subtype=1;       index_no_free(&tmp2, s, &tmp);    free_svalue(s); -  *s=tmp2; +  move_svalue (s, &tmp2);    print_return_value();       if(low_mega_apply(APPLY_STACK, args, 0, 0))    {    Pike_fp->flags |= PIKE_FRAME_RETURN_INTERNAL;    DO_JUMP_TO(Pike_fp->pc);    }    else {    DO_JUMP_TO_NEXT;    }
pike.git/src/interpret_functions.h:2038:    {    LOCAL_VAR(struct svalue tmp);    LOCAL_VAR(struct svalue tmp2);       tmp.type=PIKE_T_STRING;    tmp.u.string=Pike_fp->context.prog->strings[arg1];    tmp.subtype=1;       index_no_free(&tmp2, s, &tmp);    free_svalue(s); -  *s=tmp2; +  move_svalue (s, &tmp2);    print_return_value();       if(low_mega_apply(APPLY_STACK, args, 0, 0))    {    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.git/src/interpret_functions.h:2096:    {    LOCAL_VAR(struct svalue tmp);    LOCAL_VAR(struct svalue tmp2);       tmp.type=PIKE_T_STRING;    tmp.u.string=Pike_fp->context.prog->strings[arg1];    tmp.subtype=1;       index_no_free(&tmp2, s, &tmp);    free_svalue(s); -  *s=tmp2; +  move_svalue (s, &tmp2);    print_return_value();       if(low_mega_apply(APPLY_STACK, args, 0, 0))    {    PIKE_OPCODE_T *addr = Pike_fp->pc;    DO_IF_DEBUG(Pike_fp->next->pc=0);    unlink_previous_frame();    DO_JUMP_TO(addr);    }    DO_DUMB_RETURN;