pike.git / src / interpret.c

version» Context lines:

pike.git/src/interpret.c:1:   /*\   ||| This file a part of Pike, and is copyright by Fredrik Hubinette   ||| Pike is distributed as GPL (General Public License)   ||| See the files COPYING and DISCLAIMER for more information.   \*/   #include "global.h" - RCSID("$Id: interpret.c,v 1.71 1998/03/26 05:37:50 hubbe Exp $"); + RCSID("$Id: interpret.c,v 1.72 1998/03/31 21:52:17 hubbe Exp $");   #include "interpret.h"   #include "object.h"   #include "program.h"   #include "svalue.h"   #include "array.h"   #include "mapping.h"   #include "error.h"   #include "language.h"   #include "stralloc.h"   #include "constants.h"
pike.git/src/interpret.c:573:       /* Push number */    CASE(F_CONST0); push_int(0); break;    CASE(F_CONST1); push_int(1); break;    CASE(F_CONST_1); push_int(-1); break;    CASE(F_BIGNUM); push_int(0x7fffffff); break;    CASE(F_NUMBER); push_int(GET_ARG()); break;    CASE(F_NEG_NUMBER); push_int(-GET_ARG()); break;       /* The rest of the basic 'push value' instructions */ +  +  CASE(F_MARK_AND_STRING); *(mark_sp++)=sp;    CASE(F_STRING);    copy_shared_string(sp->u.string,fp->context.prog->strings[GET_ARG()]);    sp->type=T_STRING;    sp->subtype=0;    sp++;    print_return_value();    break;       CASE(F_ARROW_STRING);    copy_shared_string(sp->u.string,fp->context.prog->strings[GET_ARG()]);
pike.git/src/interpret.c:750:    instr=GET_ARG();    free_svalues(fp->locals + instr, 2, -1);    fp->locals[instr].type=T_INT;    fp->locals[instr].subtype=0;    fp->locals[instr].u.integer=0;    fp->locals[instr+1].type=T_INT;    fp->locals[instr+1].subtype=0;    fp->locals[instr+1].u.integer=0;    break;    +  CASE(F_CLEAR_4_LOCAL); +  { +  int e; +  instr=GET_ARG(); +  free_svalues(fp->locals + instr, 4, -1); +  for(e=0;e<4;e++) +  { +  fp->locals[instr+e].type=T_INT; +  fp->locals[instr+e].subtype=0; +  fp->locals[instr+e].u.integer=0; +  } +  break; +  } +     CASE(F_CLEAR_LOCAL);    instr=GET_ARG();    free_svalue(fp->locals + instr);    fp->locals[instr].type=T_INT;    fp->locals[instr].subtype=0;    fp->locals[instr].u.integer=0;    break;       CASE(F_INC_LOCAL);    instr=GET_ARG();
pike.git/src/interpret.c:1031:    free_svalue(sp-2);    sp[-3]=sp[-1];    sp-=2;    break;       CASE(F_ASSIGN_AND_POP);    assign_lvalue(sp-3,sp-1);    pop_n_elems(3);    break;    +  CASE(F_APPLY_ASSIGN_LOCAL); +  strict_apply_svalue(fp->context.prog->constants + GET_ARG(), sp - *--mark_sp ); +  /* Fall through */ +     CASE(F_ASSIGN_LOCAL);    assign_svalue(fp->locals+GET_ARG(),sp-1);    break;    -  +  CASE(F_APPLY_ASSIGN_LOCAL_AND_POP); +  strict_apply_svalue(fp->context.prog->constants + GET_ARG(), sp - *--mark_sp ); +  /* Fall through */ +     CASE(F_ASSIGN_LOCAL_AND_POP);    instr=GET_ARG();    free_svalue(fp->locals+instr);    fp->locals[instr]=sp[-1];    sp--;    break;       CASE(F_ASSIGN_GLOBAL)    {    struct identifier *i;
pike.git/src/interpret.c:1094:    pop_stack();    }    }    break;       /* Stack machine stuff */    CASE(F_POP_VALUE); pop_stack(); break;    CASE(F_POP_N_ELEMS); pop_n_elems(GET_ARG()); break;    CASE(F_MARK2); *(mark_sp++)=sp;    CASE(F_MARK); *(mark_sp++)=sp; break; +  CASE(F_MARK_X); *(mark_sp++)=sp-GET_ARG(); break;       CASE(F_CLEAR_STRING_SUBTYPE);    if(sp[-1].type==T_STRING) sp[-1].subtype=0;    break;       /* Jumps */    CASE(F_BRANCH);    DOJUMP();    break;   
pike.git/src/interpret.c:1124:    CASE(F_BRANCH_WHEN_NON_ZERO);    if(IS_ZERO(sp-1))    {    pc+=sizeof(INT32);    }else{    DOJUMP();    }    pop_stack();    break;    +  CASE(F_BRANCH_IF_LOCAL); +  instr=GET_ARG(); +  if(IS_ZERO(fp->locals + instr)) +  { +  pc+=sizeof(INT32); +  }else{ +  DOJUMP(); +  } +  break; +     CJUMP(F_BRANCH_WHEN_EQ, is_eq);    CJUMP(F_BRANCH_WHEN_NE,!is_eq);    CJUMP(F_BRANCH_WHEN_LT, is_lt);    CJUMP(F_BRANCH_WHEN_LE,!is_gt);    CJUMP(F_BRANCH_WHEN_GT, is_gt);    CJUMP(F_BRANCH_WHEN_GE,!is_lt);       CASE(F_LAND);    if(!IS_ZERO(sp-1))    {
pike.git/src/interpret.c:1258:    }    /* More stack sabotage */    sp[-args-1].u.object=fp->current_object;    sp[-args-1].subtype=GET_ARG()+fp->context.identifier_level;    sp[-args-1].type=T_FUNCTION;    fp->current_object->refs++;       return args+1;    }    +  CASE(F_RETURN_LOCAL); +  instr=GET_ARG(); +  pop_n_elems(sp-1 - (fp->locals+instr)); +  print_return_value(); +  goto do_return; +     CASE(F_RETURN_1);    push_int(1);    goto do_return;       CASE(F_RETURN_0);    push_int(0);    goto do_return;       CASE(F_RETURN);    do_return:
pike.git/src/interpret.c:1346:       CASE(F_ADD_INT); push_int(GET_ARG()); f_add(2); break;    CASE(F_ADD_NEG_INT); push_int(-GET_ARG()); f_add(2); break;       CASE(F_PUSH_ARRAY);    if(sp[-1].type!=T_ARRAY) error("Bad argument to @\n");    sp--;    push_array_items(sp->u.array);    break;    +  CASE(F_STRICT_ARROW); +  if(sp[-1].type != T_OBJECT) +  error("Expected object for first argument to `->\n"); +  if(!sp[-1].u.object->prog) +  error("`-> on destructed object.\n"); +  sp[-1].subtype=GET_ARG(); +  if(sp[-1].u.object->prog->id != EXTRACT_INT(pc)) +  error("`->: Object not of specified type.\n"); +  sp[-1].type=T_FUNCTION; +  pc+=sizeof(INT32); +  break; +  +  CASE(F_STRICT_ARROW_VARIABLE); +  if(sp[-1].type != T_OBJECT) +  error("Expected object for first argument to `->\n"); +  if(!sp[-1].u.object->prog) +  error("`-> on destructed object.\n"); +  instr=GET_ARG(); +  if(sp[-1].u.object->prog->id != EXTRACT_INT(pc)) +  error("`->: Object not of specified type.\n"); +  pc+=sizeof(INT32); +  low_object_index_no_free(sp,sp[-1].u.object,instr); +  free_object(sp[-1].u.object); +  sp[-1]=*sp; +  break; +  +  CASE(F_LOCAL_LOCAL_INDEX); +  { +  struct svalue *s=fp->locals+GET_ARG(); +  if(s->type == T_STRING) s->subtype=0; +  sp++->type=T_INT; +  index_no_free(sp-1,fp->locals+GET_ARG(),s); +  break; +  } +     CASE(F_LOCAL_INDEX); -  assign_svalue_no_free(sp++,fp->locals+GET_ARG()); -  if(sp[-1].type == T_STRING) -  sp[-1].subtype=0; -  print_return_value(); -  goto do_index; +  { +  struct svalue tmp,*s=fp->locals+GET_ARG(); +  if(s->type == T_STRING) s->subtype=0; +  index_no_free(&tmp,sp-1,s); +  free_svalue(sp-1); +  sp[-1]=tmp; +  break; +  }       CASE(F_POS_INT_INDEX);    push_int(GET_ARG());    print_return_value();    goto do_index;       CASE(F_NEG_INT_INDEX);    push_int(-GET_ARG());    print_return_value();    goto do_index;