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.129 2004/03/13 15:59:46 grubba Exp $ + || $Id: interpret_functions.h,v 1.130 2004/10/06 18:35:02 mast Exp $   */      /*    * Opcode definitions for the interpreter.    */      #include "global.h"      #undef CJUMP   #undef AUTO_BIGNUM_LOOP_TEST
pike.git/src/interpret_functions.h:529:   });      OPCODE1(F_INC_LOCAL, "++local", 0, {    if( (Pike_fp->locals[arg1].type == PIKE_T_INT)    DO_IF_BIGNUM(    && (!INT_TYPE_ADD_OVERFLOW(Pike_fp->locals[arg1].u.integer, 1))    )    )    {    push_int(++(Pike_fp->locals[arg1].u.integer)); +  Pike_fp->locals[arg1].subtype = NUMBER_NUMBER; /* Could have UNDEFINED there before. */    } else {    push_svalue(Pike_fp->locals+arg1);    push_int(1);    f_add(2);    assign_svalue(Pike_fp->locals+arg1,Pike_sp-1);    }   });      OPCODE1(F_POST_INC_LOCAL, "local++", 0, {    push_svalue( Pike_fp->locals + arg1);       if( (Pike_fp->locals[arg1].type == PIKE_T_INT)    DO_IF_BIGNUM(    && (!INT_TYPE_ADD_OVERFLOW(Pike_fp->locals[arg1].u.integer, 1))    )    )    {    Pike_fp->locals[arg1].u.integer++; -  +  Pike_fp->locals[arg1].subtype = NUMBER_NUMBER; /* Could have UNDEFINED there before. */    } else {    push_svalue(Pike_fp->locals + arg1);    push_int(1);    f_add(2);    stack_pop_to(Pike_fp->locals + arg1);    }   });      OPCODE1(F_INC_LOCAL_AND_POP, "++local and pop", 0, {    if( (Pike_fp->locals[arg1].type == PIKE_T_INT)    DO_IF_BIGNUM(    && (!INT_TYPE_ADD_OVERFLOW(Pike_fp->locals[arg1].u.integer, 1))    )    )    {    Pike_fp->locals[arg1].u.integer++; -  +  Pike_fp->locals[arg1].subtype = NUMBER_NUMBER; /* Could have UNDEFINED there before. */    } else {    push_svalue( Pike_fp->locals + arg1);    push_int(1);    f_add(2);    stack_pop_to(Pike_fp->locals + arg1);    }   });      OPCODE1(F_DEC_LOCAL, "--local", 0, {    if( (Pike_fp->locals[arg1].type == PIKE_T_INT)    DO_IF_BIGNUM(    && (!INT_TYPE_SUB_OVERFLOW(Pike_fp->locals[arg1].u.integer, 1))    )    )    {    push_int(--(Pike_fp->locals[arg1].u.integer)); -  +  Pike_fp->locals[arg1].subtype = NUMBER_NUMBER; /* Could have UNDEFINED there before. */    } else {    push_svalue(Pike_fp->locals+arg1);    push_int(1);    o_subtract();    assign_svalue(Pike_fp->locals+arg1,Pike_sp-1);    }   });      OPCODE1(F_POST_DEC_LOCAL, "local--", 0, {    push_svalue( Pike_fp->locals + arg1);       if( (Pike_fp->locals[arg1].type == PIKE_T_INT)    DO_IF_BIGNUM(    && (!INT_TYPE_SUB_OVERFLOW(Pike_fp->locals[arg1].u.integer, 1))    )    )    {    Pike_fp->locals[arg1].u.integer--; -  +  Pike_fp->locals[arg1].subtype = NUMBER_NUMBER; /* Could have UNDEFINED there before. */    } else {    push_svalue(Pike_fp->locals + arg1);    push_int(1);    o_subtract();    stack_pop_to(Pike_fp->locals + arg1);    }    /* Pike_fp->locals[instr].u.integer--; */   });      OPCODE1(F_DEC_LOCAL_AND_POP, "--local and pop", 0, {    if( (Pike_fp->locals[arg1].type == PIKE_T_INT)    DO_IF_BIGNUM(    && (!INT_TYPE_SUB_OVERFLOW(Pike_fp->locals[arg1].u.integer, 1))    )    )    {    Pike_fp->locals[arg1].u.integer--; -  +  Pike_fp->locals[arg1].subtype = NUMBER_NUMBER; /* Could have UNDEFINED there before. */    } else {    push_svalue(Pike_fp->locals + arg1);    push_int(1);    o_subtract();    stack_pop_to(Pike_fp->locals + arg1);    }   });      OPCODE0(F_LTOSVAL, "lvalue to svalue", 0, {    dmalloc_touch_svalue(Pike_sp-2);
pike.git/src/interpret_functions.h:695:       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))    )    {    /* Optimization for a rather common case. Makes it 30% faster. */    Pike_sp[-1].u.integer += Pike_sp[-2].u.integer; +  Pike_sp[-1].subtype = NUMBER_NUMBER; /* Could have UNDEFINED there before. */    assign_lvalue(Pike_sp-4,Pike_sp-1);    Pike_sp-=2;    pop_2_elems();    goto add_and_pop_done;    }    }    /* 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
pike.git/src/interpret_functions.h:1313:    push_int(1);    if (!is_lt(Pike_sp-2, Pike_sp-1)) {    o_subtract();    DO_BRANCH();    } else {    DONT_BRANCH();    pop_2_elems();    }   });    - OPCODE0_BRANCH(F_FOREACH, "foreach", 0, { /* array, lvalue, X, i */ + OPCODE0_BRANCH(F_FOREACH, "foreach", 0, { /* array, lvalue, i */    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)    {    if(Pike_sp[-1].u.integer < 0) -  +  /* Isn't this an internal compiler error? /mast */    Pike_error("Foreach loop variable is negative!\n");    assign_lvalue(Pike_sp-3, Pike_sp[-4].u.array->item + Pike_sp[-1].u.integer);    DO_BRANCH();    Pike_sp[-1].u.integer++; -  +  DO_IF_DEBUG ( +  if (Pike_sp[-1].subtype) +  Pike_fatal ("Got unexpected subtype in loop variable.\n"); +  );    }else{    DONT_BRANCH();    }   });      OPCODE0(F_MAKE_ITERATOR, "Iterator", 0, {    extern void f_Iterator(INT32);    f_Iterator(1);   });   
pike.git/src/interpret_functions.h:1416:    if(Pike_sp[-1].type == PIKE_T_INT)    {    DO_IF_BIGNUM(    if(INT_TYPE_NEG_OVERFLOW(Pike_sp[-1].u.integer))    {    convert_stack_top_to_bignum();    o_negate();    }    else    ) +  {    Pike_sp[-1].u.integer =- Pike_sp[-1].u.integer; -  +  Pike_sp[-1].subtype = NUMBER_NUMBER; /* Could have UNDEFINED there before. */    } -  +  }    else if(Pike_sp[-1].type == PIKE_T_FLOAT)    {    Pike_sp[-1].u.float_number =- Pike_sp[-1].u.float_number;    }else{    o_negate();    }   });      OPCODE0_ALIAS(F_COMPL, "~", 0, o_compl);      OPCODE0(F_NOT, "!", 0, {    switch(Pike_sp[-1].type)    {    case PIKE_T_INT:    Pike_sp[-1].u.integer =! Pike_sp[-1].u.integer; -  +  Pike_sp[-1].subtype = NUMBER_NUMBER; /* Could have UNDEFINED there before. */    break;       case PIKE_T_FUNCTION:    case PIKE_T_OBJECT:    if(UNSAFE_IS_ZERO(Pike_sp-1))    {    pop_stack();    push_int(1);    }else{    pop_stack();    push_int(0);    }    break;       default:    free_svalue(Pike_sp-1);    Pike_sp[-1].type=PIKE_T_INT; -  +  Pike_sp[-1].subtype = NUMBER_NUMBER;    Pike_sp[-1].u.integer=0;    }   });      OPCODE0_ALIAS(F_LSH, "<<", 0, o_lsh);   OPCODE0_ALIAS(F_RSH, ">>", 0, o_rsh);      #define COMPARISON(ID,DESC,EXPR) \    OPCODE0(ID, DESC, 0, { \    INT32 val = EXPR; \
pike.git/src/interpret_functions.h:1483:   });      OPCODE0(F_ADD_INTS, "int+int", 0, {    if(Pike_sp[-1].type == T_INT && Pike_sp[-2].type == T_INT    DO_IF_BIGNUM(    && (!INT_TYPE_ADD_OVERFLOW(Pike_sp[-1].u.integer, Pike_sp[-2].u.integer))    )    )    {    Pike_sp[-2].u.integer+=Pike_sp[-1].u.integer; +  Pike_sp[-2].subtype = NUMBER_NUMBER; /* Could have UNDEFINED there before. */    Pike_sp--;    }else{    f_add(2);    }   });      OPCODE0(F_ADD_FLOATS, "float+float", 0, {    if(Pike_sp[-1].type == T_FLOAT && Pike_sp[-2].type == T_FLOAT)    {    Pike_sp[-2].u.float_number+=Pike_sp[-1].u.float_number;
pike.git/src/interpret_functions.h:1515:   OPCODE0_ALIAS(F_MOD, "%", 0, o_mod);      OPCODE1(F_ADD_INT, "add integer", 0, {    if(Pike_sp[-1].type == T_INT    DO_IF_BIGNUM(    && (!INT_TYPE_ADD_OVERFLOW(Pike_sp[-1].u.integer, arg1))    )    )    {    Pike_sp[-1].u.integer+=arg1; +  Pike_sp[-1].subtype = NUMBER_NUMBER; /* Could have UNDEFINED there before. */    }else{    push_int(arg1);    f_add(2);    }   });      OPCODE1(F_ADD_NEG_INT, "add -integer", 0, {    if(Pike_sp[-1].type == T_INT    DO_IF_BIGNUM(    && (!INT_TYPE_ADD_OVERFLOW(Pike_sp[-1].u.integer, -arg1))    )    )    {    Pike_sp[-1].u.integer-=arg1; -  +  Pike_sp[-1].subtype = NUMBER_NUMBER; /* Could have UNDEFINED there before. */    }else{    push_int(-arg1);    f_add(2);    }   });      OPCODE0(F_PUSH_ARRAY, "@", 0, {    switch(Pike_sp[-1].type)    {    default: