pike.git / src / interpret_functions.h

version» Context lines:

pike.git/src/interpret_functions.h:1:   /* -  * $Id: interpret_functions.h,v 1.8 2000/04/19 14:14:12 grubba Exp $ +  * $Id: interpret_functions.h,v 1.9 2000/04/19 20:20:01 grubba 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:240:    break;    }          CASE(F_MARK_AND_LOCAL); *(Pike_mark_sp++)=Pike_sp;    CASE(F_LOCAL);    assign_svalue_no_free(Pike_sp++,Pike_fp->locals+GET_ARG());    print_return_value();    break;    -  CASE(F_2_LOCALS); -  assign_svalue_no_free(Pike_sp++,Pike_fp->locals+GET_ARG()); + OPCODE2(F_2_LOCALS, "2 locals") +  assign_svalue_no_free(Pike_sp++, Pike_fp->locals + arg1);    print_return_value(); -  assign_svalue_no_free(Pike_sp++,Pike_fp->locals+GET_ARG2()); +  assign_svalue_no_free(Pike_sp++, Pike_fp->locals + arg2);    print_return_value(); -  break; + BREAK;    -  CASE(F_LOCAL_2_LOCAL); + OPCODE2(F_LOCAL_2_LOCAL, "local=local;")   { -  int tmp=GET_ARG(); -  assign_svalue(Pike_fp->locals+tmp, Pike_fp->locals+GET_ARG2()); -  break; +  int tmp=arg1; +  assign_svalue(Pike_fp->locals + tmp, Pike_fp->locals + arg2);   } -  + BREAK;    -  CASE(F_LOCAL_2_GLOBAL); + OPCODE2(F_LOCAL_2_GLOBAL, "global=local;")   { -  INT32 tmp=GET_ARG() + Pike_fp->context.identifier_level; +  INT32 tmp = arg1 + Pike_fp->context.identifier_level;    struct identifier *i;       if(!Pike_fp->current_object->prog)    error("Cannot access global variables in destructed object.\n");    -  i=ID_FROM_INT(Pike_fp->current_object->prog, tmp); +  i = ID_FROM_INT(Pike_fp->current_object->prog, tmp);    if(!IDENTIFIER_IS_VARIABLE(i->identifier_flags))    error("Cannot assign functions or constants.\n");    if(i->run_time_type == T_MIXED)    { -  assign_svalue((struct svalue *)GLOBAL_FROM_INT(tmp), Pike_fp->locals + GET_ARG2()); +  assign_svalue((struct svalue *)GLOBAL_FROM_INT(tmp), +  Pike_fp->locals + arg2);    }else{    assign_to_short_svalue((union anything *)GLOBAL_FROM_INT(tmp),    i->run_time_type, -  Pike_fp->locals + GET_ARG2()); +  Pike_fp->locals + arg2);    } -  break; +    } -  + BREAK;    -  CASE(F_GLOBAL_2_LOCAL); + OPCODE2(F_GLOBAL_2_LOCAL, "local=global;")   { -  INT32 tmp=GET_ARG() + Pike_fp->context.identifier_level; -  INT32 tmp2=GET_ARG2(); +  INT32 tmp = arg1 + Pike_fp->context.identifier_level; +  INT32 tmp2 = arg2;    free_svalue(Pike_fp->locals + tmp2);    low_object_index_no_free(Pike_fp->locals + tmp2,    Pike_fp->current_object,    tmp); -  break; +    } -  + BREAK;    -  CASE(F_LOCAL_LVALUE); -  Pike_sp[0].type=T_LVALUE; -  Pike_sp[0].u.lval=Pike_fp->locals+GET_ARG(); -  Pike_sp[1].type=T_VOID; -  Pike_sp+=2; -  break; + OPCODE1(F_LOCAL_LVALUE, "& local") +  Pike_sp[0].type = T_LVALUE; +  Pike_sp[0].u.lval = Pike_fp->locals + arg1; +  Pike_sp[1].type = T_VOID; +  Pike_sp += 2; + BREAK;    -  CASE(F_LEXICAL_LOCAL); + OPCODE1ACC(F_LEXICAL_LOCAL, "lexical local")   { -  struct pike_frame *f=Pike_fp; -  while(accumulator--) +  struct pike_frame *f = Pike_fp; +  while(acc--)    {    f=f->scope;    if(!f) error("Lexical scope error.\n");    } -  push_svalue(f->locals + GET_ARG()); +  push_svalue(f->locals + arg1);    print_return_value(); -  break; +    } -  + BREAK;    -  CASE(F_LEXICAL_LOCAL_LVALUE); + OPCODE1ACC(F_LEXICAL_LOCAL_LVALUE, "& lexical local")   { -  struct pike_frame *f=Pike_fp; -  while(accumulator--) +  struct pike_frame *f = Pike_fp; +  while(acc--)    { -  f=f->scope; +  f = f->scope;    if(!f) error("Lexical scope error.\n");    } -  Pike_sp[0].type=T_LVALUE; -  Pike_sp[0].u.lval=f->locals+GET_ARG(); -  Pike_sp[1].type=T_VOID; -  Pike_sp+=2; -  break; +  Pike_sp[0].type = T_LVALUE; +  Pike_sp[0].u.lval = f->locals+arg1; +  Pike_sp[1].type = T_VOID; +  Pike_sp += 2;   } -  + BREAK;    -  CASE(F_ARRAY_LVALUE); -  f_aggregate(GET_ARG()*2); + OPCODE1(F_ARRAY_LVALUE, "[ lvalues ]") +  f_aggregate(arg1*2);    Pike_sp[-1].u.array->flags |= ARRAY_LVALUE;    Pike_sp[-1].u.array->type_field |= BIT_UNFINISHED | BIT_MIXED; -  Pike_sp[0]=Pike_sp[-1]; -  Pike_sp[-1].type=T_ARRAY_LVALUE; +  /* FIXME: Shouldn't a ref be added here? */ +  Pike_sp[0] = Pike_sp[-1]; +  Pike_sp[-1].type = T_ARRAY_LVALUE;    Pike_sp++; -  break; + BREAK;    -  CASE(F_CLEAR_2_LOCAL); -  instr=GET_ARG(); + OPCODE1(F_CLEAR_2_LOCAL, "clear 2 local") +  instr = arg1;    free_svalues(Pike_fp->locals + instr, 2, -1); -  Pike_fp->locals[instr].type=PIKE_T_INT; -  Pike_fp->locals[instr].subtype=0; -  Pike_fp->locals[instr].u.integer=0; -  Pike_fp->locals[instr+1].type=PIKE_T_INT; -  Pike_fp->locals[instr+1].subtype=0; -  Pike_fp->locals[instr+1].u.integer=0; -  break; +  Pike_fp->locals[instr].type = PIKE_T_INT; +  Pike_fp->locals[instr].subtype = 0; +  Pike_fp->locals[instr].u.integer = 0; +  Pike_fp->locals[instr+1].type = PIKE_T_INT; +  Pike_fp->locals[instr+1].subtype = 0; +  Pike_fp->locals[instr+1].u.integer = 0; + BREAK;    -  CASE(F_CLEAR_4_LOCAL); + OPCODE1(F_CLEAR_4_LOCAL, "clear 4 local")   {    int e; -  instr=GET_ARG(); +  instr = arg1;    free_svalues(Pike_fp->locals + instr, 4, -1); -  for(e=0;e<4;e++) +  for(e = 0; e < 4; e++)    { -  Pike_fp->locals[instr+e].type=PIKE_T_INT; -  Pike_fp->locals[instr+e].subtype=0; -  Pike_fp->locals[instr+e].u.integer=0; +  Pike_fp->locals[instr+e].type = PIKE_T_INT; +  Pike_fp->locals[instr+e].subtype = 0; +  Pike_fp->locals[instr+e].u.integer = 0;    } -  break; +    } -  + BREAK;    -  CASE(F_CLEAR_LOCAL); -  instr=GET_ARG(); + OPCODE1(F_CLEAR_LOCAL, "clear local") +  instr = arg1;    free_svalue(Pike_fp->locals + instr); -  Pike_fp->locals[instr].type=PIKE_T_INT; -  Pike_fp->locals[instr].subtype=0; -  Pike_fp->locals[instr].u.integer=0; -  break; +  Pike_fp->locals[instr].type = PIKE_T_INT; +  Pike_fp->locals[instr].subtype = 0; +  Pike_fp->locals[instr].u.integer = 0; + BREAK;    -  CASE(F_INC_LOCAL); -  instr=GET_ARG(); + OPCODE1(F_INC_LOCAL, "++local") +  instr = arg1; +  if( (Pike_fp->locals[instr].type == PIKE_T_INT)   #ifdef AUTO_BIGNUM -  if(Pike_fp->locals[instr].type == PIKE_T_INT && -  !INT_TYPE_ADD_OVERFLOW(Pike_fp->locals[instr].u.integer, 1)) - #else -  if(Pike_fp->locals[instr].type == PIKE_T_INT) +  && (!INT_TYPE_ADD_OVERFLOW(Pike_fp->locals[instr].u.integer, 1))   #endif /* AUTO_BIGNUM */ -  +  )    {    Pike_fp->locals[instr].u.integer++;    assign_svalue_no_free(Pike_sp++,Pike_fp->locals+instr); -  } -  else -  { +  } else {    assign_svalue_no_free(Pike_sp++,Pike_fp->locals+instr);    push_int(1);    f_add(2);    assign_svalue(Pike_fp->locals+instr,Pike_sp-1);    } -  break; + BREAK;       CASE(F_POST_INC_LOCAL);    instr=GET_ARG();    assign_svalue_no_free(Pike_sp++,Pike_fp->locals+instr);    goto inc_local_and_pop;       CASE(F_INC_LOCAL_AND_POP);    instr=GET_ARG();    inc_local_and_pop:   #ifdef AUTO_BIGNUM
pike.git/src/interpret_functions.h:410:    Pike_fp->locals[instr].u.integer++;    }else{    assign_svalue_no_free(Pike_sp++,Pike_fp->locals+instr);    push_int(1);    f_add(2);    assign_svalue(Pike_fp->locals+instr,Pike_sp-1);    pop_stack();    }    break;    -  CASE(F_DEC_LOCAL); -  instr=GET_ARG(); + OPCODE1(F_DEC_LOCAL, "--local") +  instr = arg1; +  if( (Pike_fp->locals[instr].type == PIKE_T_INT)   #ifdef AUTO_BIGNUM -  if(Pike_fp->locals[instr].type == PIKE_T_INT && -  !INT_TYPE_SUB_OVERFLOW(Pike_fp->locals[instr].u.integer, 1)) - #else -  if(Pike_fp->locals[instr].type == PIKE_T_INT) +  && (!INT_TYPE_SUB_OVERFLOW(Pike_fp->locals[instr].u.integer, 1))   #endif /* AUTO_BIGNUM */ -  +  )    {    Pike_fp->locals[instr].u.integer--;    assign_svalue_no_free(Pike_sp++,Pike_fp->locals+instr); -  }else{ +  } else {    assign_svalue_no_free(Pike_sp++,Pike_fp->locals+instr);    push_int(1);    o_subtract();    assign_svalue(Pike_fp->locals+instr,Pike_sp-1);    } -  break; + BREAK;       CASE(F_POST_DEC_LOCAL);    instr=GET_ARG();    assign_svalue_no_free(Pike_sp++,Pike_fp->locals+instr);    goto dec_local_and_pop;    /* Pike_fp->locals[instr].u.integer--; */    break;       CASE(F_DEC_LOCAL_AND_POP);    instr=GET_ARG();
pike.git/src/interpret_functions.h:456:    Pike_fp->locals[instr].u.integer--;    }else{    assign_svalue_no_free(Pike_sp++,Pike_fp->locals+instr);    push_int(1);    o_subtract();    assign_svalue(Pike_fp->locals+instr,Pike_sp-1);    pop_stack();    }    break;    -  CASE(F_LTOSVAL); -  lvalue_to_svalue_no_free(Pike_sp,Pike_sp-2); + OPCODE0(F_LTOSVAL, "lvalue to svalue") +  lvalue_to_svalue_no_free(Pike_sp, Pike_sp-2);    Pike_sp++; -  break; + BREAK;    -  CASE(F_LTOSVAL2); -  Pike_sp[0]=Pike_sp[-1]; -  Pike_sp[-1].type=PIKE_T_INT; + OPCODE0(F_LTOSVAL2, "ltosval2") +  Pike_sp[0] = Pike_sp[-1]; +  Pike_sp[-1].type = PIKE_T_INT;    Pike_sp++; -  lvalue_to_svalue_no_free(Pike_sp-2,Pike_sp-4); +  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    */ -  if( (1 << Pike_sp[-2].type) & ( BIT_ARRAY | BIT_MULTISET | BIT_MAPPING | BIT_STRING )) +  if( (1 << Pike_sp[-2].type) & +  (BIT_ARRAY | BIT_MULTISET | BIT_MAPPING | BIT_STRING) )    {    struct svalue s; -  s.type=PIKE_T_INT; -  s.subtype=0; -  s.u.integer=0; -  assign_lvalue(Pike_sp-4,&s); +  s.type = PIKE_T_INT; +  s.subtype = 0; +  s.u.integer = 0; +  assign_lvalue(Pike_sp-4, &s);    } -  break; + BREAK;       -  CASE(F_ADD_TO_AND_POP); + OPCODE0(F_ADD_TO_AND_POP, "+= and pop")    Pike_sp[0]=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    */ -  if( (1 << Pike_sp[-2].type) & ( BIT_ARRAY | BIT_MULTISET | BIT_MAPPING | BIT_STRING )) +  if( (1 << Pike_sp[-2].type) & +  (BIT_ARRAY | BIT_MULTISET | BIT_MAPPING | BIT_STRING) )    {    struct svalue s;    s.type=PIKE_T_INT;    s.subtype=0;    s.u.integer=0;    assign_lvalue(Pike_sp-4,&s);    }    f_add(2);    assign_lvalue(Pike_sp-3,Pike_sp-1);    pop_n_elems(3); -  break; + BREAK;    -  CASE(F_GLOBAL_LVALUE); + OPCODE1(F_GLOBAL_LVALUE, "& global")   {    struct identifier *i; -  INT32 tmp=GET_ARG() + Pike_fp->context.identifier_level; +  INT32 tmp=arg1 + Pike_fp->context.identifier_level;       if(!Pike_fp->current_object->prog)    error("Cannot access global variables in destructed object.\n");       i=ID_FROM_INT(Pike_fp->current_object->prog, tmp);       if(!IDENTIFIER_IS_VARIABLE(i->identifier_flags))    error("Cannot re-assign functions or constants.\n");       if(i->run_time_type == T_MIXED)    {    Pike_sp[0].type=T_LVALUE;    Pike_sp[0].u.lval=(struct svalue *)GLOBAL_FROM_INT(tmp);    }else{    Pike_sp[0].type=T_SHORT_LVALUE;    Pike_sp[0].u.short_lval= (union anything *)GLOBAL_FROM_INT(tmp);    Pike_sp[0].subtype=i->run_time_type;    }    Pike_sp[1].type=T_VOID;    Pike_sp+=2; -  break; +    } -  + BREAK;      OPCODE0(F_INC, "++x")   {    union anything *u=get_pointer_if_this_type(Pike_sp-2, PIKE_T_INT);    if(u   #ifdef AUTO_BIGNUM    && !INT_TYPE_ADD_OVERFLOW(u->integer, 1)   #endif    )    {