pike.git / src / interpret_functions.h

version» Context lines:

pike.git/src/interpret_functions.h:1:   /* -  * $Id: interpret_functions.h,v 1.9 2000/04/19 20:20:01 grubba Exp $ +  * $Id: interpret_functions.h,v 1.10 2000/04/20 02:41:44 hubbe 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:95:      OPCODE1(F_GLOBAL,"global")    low_object_index_no_free(Pike_sp,    Pike_fp->current_object,    arg1 + Pike_fp->context.identifier_level);    Pike_sp++;    print_return_value();   BREAK;       - OPCODE1ACC(F_EXTERNAL,"external") + OPCODE2(F_EXTERNAL,"external")   {    struct inherit *inherit;    struct program *p;    struct object *o;    INT32 i;       inherit=&Pike_fp->context;       o=Pike_fp->current_object;   
pike.git/src/interpret_functions.h:123: Inside #if defined(PIKE_DEBUG)
  #ifdef PIKE_DEBUG    if(t_flag>4)    {    sprintf(trace_buffer,"- Following o->parent (accumulator+=%d)\n",inherit->parent_offset-1);    write_to_stderr(trace_buffer,strlen(trace_buffer));    }   #endif       i=o->parent_identifier;    o=o->parent; -  acc+=inherit->parent_offset-1; +  arg2+=inherit->parent_offset-1;    }else{   #ifdef PIKE_DEBUG    if(t_flag>4)    {    sprintf(trace_buffer,"- Following inherit->parent (accumulator+=%d)\n",inherit->parent_offset-1);    write_to_stderr(trace_buffer,strlen(trace_buffer));    }   #endif    i=inherit->parent_identifier;    o=inherit->parent;
pike.git/src/interpret_functions.h:176: Inside #if defined(DEBUG_MALLOC)
   fprintf(stderr, "The inherit %p has been zapped!\n", inherit);    debug_malloc_dump_references(inherit,0,2,0);    fprintf(stderr, "It was extracted from the program %p %d\n", p, i);    describe(p);    fprintf(stderr, "Which was in turn taken from the object %p\n", o);    describe(o);    fatal("Looks like the program %p has been zapped!\n", p);    }   #endif /* DEBUG_MALLOC */    -  if(!acc) break; -  --acc; +  if(!arg2) break; +  --arg2;    }       low_object_index_no_free(Pike_sp,    o,    arg1 + inherit->identifier_level);    Pike_sp++;    print_return_value();    break;   }   BREAK;    -  CASE(F_EXTERNAL_LVALUE); + OPCODE2(F_EXTERNAL_LVALUE,"& external")   {    struct inherit *inherit;    struct program *p;    struct object *o; -  INT32 i,id=GET_ARG(); +  INT32 i,id=arg1;       inherit=&Pike_fp->context;    o=Pike_fp->current_object;       if(!o)    error("Current object is destructed\n");       while(1)    {    if(inherit->parent_offset)    {    i=o->parent_identifier;    o=o->parent; -  accumulator+=inherit->parent_offset-1; +  arg2+=inherit->parent_offset-1;    }else{    i=inherit->parent_identifier;    o=inherit->parent;    }       if(!o)    error("Parent no longer exists\n");       if(!(p=o->prog))    error("Attempting to access variable in destructed object\n");       inherit=INHERIT_FROM_INT(p, i);    -  if(!accumulator) break; -  accumulator--; +  if(!arg2) break; +  arg2--;    }       ref_push_object(o);    Pike_sp->type=T_LVALUE;    Pike_sp->u.integer=id + inherit->identifier_level;    Pike_sp++;    break;   }    -  + 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;      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 + arg2);    print_return_value();   BREAK;    - OPCODE2(F_LOCAL_2_LOCAL, "local=local;") - { -  int tmp=arg1; -  assign_svalue(Pike_fp->locals + tmp, Pike_fp->locals + arg2); - } + OPCODE2(F_LOCAL_2_LOCAL, "local = local") +  assign_svalue(Pike_fp->locals+arg1, Pike_fp->locals+arg2);   BREAK;      OPCODE2(F_LOCAL_2_GLOBAL, "global=local;")   {    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");   
pike.git/src/interpret_functions.h:277:    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 + arg2);    }   }   BREAK;    - OPCODE2(F_GLOBAL_2_LOCAL, "local=global;") + OPCODE2(F_GLOBAL_2_LOCAL,"global = local")   { -  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, +  INT32 tmp=arg1 + Pike_fp->context.identifier_level; +  free_svalue(Pike_fp->locals + arg2); +  low_object_index_no_free(Pike_fp->locals + arg2,    Pike_fp->current_object,    tmp);   }   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;    - OPCODE1ACC(F_LEXICAL_LOCAL, "lexical local") + OPCODE2(F_LEXICAL_LOCAL,"lexical local")   { -  struct pike_frame *f = Pike_fp; -  while(acc--) +  struct pike_frame *f=Pike_fp; +  while(arg2--)    {    f=f->scope;    if(!f) error("Lexical scope error.\n");    }    push_svalue(f->locals + arg1);    print_return_value(); -  +  break;   }   BREAK;    - OPCODE1ACC(F_LEXICAL_LOCAL_LVALUE, "& lexical local") +  + OPCODE2(F_LEXICAL_LOCAL_LVALUE,"&lexical local")   { -  struct pike_frame *f = Pike_fp; -  while(acc--) +  struct pike_frame *f=Pike_fp; +  while(arg2--)    { -  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+arg1; -  Pike_sp[1].type = T_VOID; -  Pike_sp += 2; +  Pike_sp[0].type=T_LVALUE; +  Pike_sp[0].u.lval=f->locals+arg1; +  Pike_sp[1].type=T_VOID; +  Pike_sp+=2; +  break;   }   BREAK;      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;    /* FIXME: Shouldn't a ref be added here? */    Pike_sp[0] = Pike_sp[-1];    Pike_sp[-1].type = T_ARRAY_LVALUE;
pike.git/src/interpret_functions.h:513:    }    f_add(2);    assign_lvalue(Pike_sp-3,Pike_sp-1);    pop_n_elems(3);   BREAK;      OPCODE1(F_GLOBAL_LVALUE, "& global")   {    struct identifier *i;    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;    -  +    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    )    {    instr=++ u->integer;
pike.git/src/interpret_functions.h:648:    assign_svalue_no_free(Pike_sp,Pike_sp-1); Pike_sp++;    push_int(1);    f_add(2);    assign_lvalue(Pike_sp-4, Pike_sp-1);    assign_svalue(Pike_sp-4, Pike_sp-2);    pop_n_elems(3);    }   }   BREAK;    +    OPCODE0(F_POST_DEC, "x--")   {    union anything *u=get_pointer_if_this_type(Pike_sp-2, PIKE_T_INT);    if(u   #ifdef AUTO_BIGNUM    && !INT_TYPE_SUB_OVERFLOW(u->integer, 1)   #endif    )    {    instr=u->integer --;
pike.git/src/interpret_functions.h:672:    assign_svalue_no_free(Pike_sp,Pike_sp-1); Pike_sp++;    push_int(1);    o_subtract();    assign_lvalue(Pike_sp-4, Pike_sp-1);    assign_svalue(Pike_sp-4, Pike_sp-2);    pop_n_elems(3);    }   }   BREAK;    + OPCODE1(F_ASSIGN_LOCAL,"assign local") +  assign_svalue(Pike_fp->locals+arg1,Pike_sp-1); + BREAK; +    OPCODE0(F_ASSIGN, "assign")    assign_lvalue(Pike_sp-3,Pike_sp-1);    free_svalue(Pike_sp-3);    free_svalue(Pike_sp-2);    Pike_sp[-3]=Pike_sp[-1];    Pike_sp-=2;   BREAK;    -  + OPCODE2(F_APPLY_ASSIGN_LOCAL_AND_POP,"apply, assign local and pop") +  strict_apply_svalue(Pike_fp->context.prog->constants + arg1, Pike_sp - *--Pike_mark_sp ); +  free_svalue(Pike_fp->locals+arg2); +  Pike_fp->locals[arg2]=Pike_sp[-1]; +  Pike_sp--; + BREAK; +  + OPCODE2(F_APPLY_ASSIGN_LOCAL,"apply, assign local") +  strict_apply_svalue(Pike_fp->context.prog->constants + arg1, Pike_sp - *--Pike_mark_sp ); +  assign_svalue(Pike_fp->locals+arg2,Pike_sp-1); + BREAK; +    OPCODE0(F_ASSIGN_AND_POP, "assign and pop")    assign_lvalue(Pike_sp-3, Pike_sp-1);    pop_n_elems(3);   BREAK;    -  CASE(F_APPLY_ASSIGN_LOCAL); -  strict_apply_svalue(Pike_fp->context.prog->constants + GET_ARG(), Pike_sp - *--Pike_mark_sp ); -  /* Fall through */ +     -  CASE(F_ASSIGN_LOCAL); -  assign_svalue(Pike_fp->locals+GET_ARG(),Pike_sp-1); -  break; -  -  CASE(F_APPLY_ASSIGN_LOCAL_AND_POP); -  strict_apply_svalue(Pike_fp->context.prog->constants + GET_ARG(), Pike_sp - *--Pike_mark_sp ); -  /* Fall through */ -  +     CASE(F_ASSIGN_LOCAL_AND_POP);    instr=GET_ARG();    free_svalue(Pike_fp->locals+instr);    Pike_fp->locals[instr]=Pike_sp[-1];    Pike_sp--;    break;      OPCODE1(F_ASSIGN_GLOBAL, "assign global")   {    struct identifier *i;
pike.git/src/interpret_functions.h:751:    *s=*Pike_sp;    }else{    assign_to_short_svalue((union anything *)GLOBAL_FROM_INT(tmp),    i->run_time_type,    Pike_sp-1);    pop_stack();    }   }   BREAK;    +    /* Stack machine stuff */      OPCODE0(F_POP_VALUE, "pop")    pop_stack();   BREAK;      OPCODE1(F_POP_N_ELEMS, "pop_n_elems")    pop_n_elems(arg1);   BREAK;   
pike.git/src/interpret_functions.h:1233:    {    struct svalue s;    index_no_free(&s,Pike_sp-2,Pike_sp-1);    pop_n_elems(2);    *Pike_sp=s;    Pike_sp++;    }    print_return_value();    break;    - OPCODE1ACC(F_MAGIC_INDEX, "::`[]") -  push_magic_index(magic_index_program, acc, arg1); + OPCODE2(F_MAGIC_INDEX, "::`[]") +  push_magic_index(magic_index_program, arg2, arg1);   BREAK;    - OPCODE1ACC(F_MAGIC_SET_INDEX, "::`[]=") -  push_magic_index(magic_set_index_program, acc, arg1); + OPCODE2(F_MAGIC_SET_INDEX, "::`[]=") +  push_magic_index(magic_set_index_program, arg2, arg1);   BREAK;      OPCODE0(F_CAST, "cast")    f_cast();   BREAK;      OPCODE0(F_SOFT_CAST, "soft cast")    /* Stack: type_string, value */   #ifdef PIKE_DEBUG    if (Pike_sp[-2].type != T_STRING) {