Branch: Tag:

2004-10-06

2004-10-06 18:35:02 by Martin Stjernholm <mast@lysator.liu.se>

Clear the subtype properly in a number of opcodes that can produce nonzero
integer svalues. Otherwise the zero type can remain in calculations that
start with UNDEFINED.

Rev: src/interpret_functions.h:1.130

2:   || 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 $   */      /*
536:    )    {    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);
554:    )    {    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);
570:    )    {    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);
586:    )    {    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);
604:    )    {    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);
621:    )    {    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);
702:    {    /* 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();
1320:    }   });    - 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();    }
1423:    }    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;
1440:    {    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:
1457:    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;    }   });
1490:    )    {    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);
1522:    )    {    Pike_sp[-1].u.integer+=arg1; +  Pike_sp[-1].subtype = NUMBER_NUMBER; /* Could have UNDEFINED there before. */    }else{    push_int(arg1);    f_add(2);
1536:    )    {    Pike_sp[-1].u.integer-=arg1; +  Pike_sp[-1].subtype = NUMBER_NUMBER; /* Could have UNDEFINED there before. */    }else{    push_int(-arg1);    f_add(2);