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.179 2004/12/18 18:07:16 grubba Exp $ + || $Id: interpret_functions.h,v 1.180 2004/12/18 21:52:50 grubba Exp $   */      /*    * Opcode definitions for the interpreter.    */      #include "global.h"      #undef CJUMP   #undef AUTO_BIGNUM_LOOP_TEST
pike.git/src/interpret_functions.h:302:    copy_shared_string(Pike_sp->u.string,Pike_fp->context.prog->strings[arg1]);    Pike_sp->type=PIKE_T_STRING;    Pike_sp->subtype=1; /* Magic */    Pike_sp++;    print_return_value();   });      OPCODE1(F_LOOKUP_LFUN, "->lfun", 0, {    LOCAL_VAR(struct object *o);    LOCAL_VAR(struct svalue tmp); +  LOCAL_VAR(struct program *p);    -  if ((Pike_sp[-1].type == T_OBJECT) && ((o = Pike_sp[-1].u.object)->prog) && -  (FIND_LFUN(o->prog, LFUN_ARROW) == -1)) { -  int id = FIND_LFUN(o->prog, arg1); +  if ((Pike_sp[-1].type == T_OBJECT) && +  (p = (o = Pike_sp[-1].u.object)->prog) && +  (FIND_LFUN(p = o->prog->inherits[Pike_sp[-1].subtype].prog, +  LFUN_ARROW) == -1)) { +  int id = FIND_LFUN(p, arg1);    if ((id != -1) && -  (!(o->prog->identifier_references[id].id_flags & +  (!(p->identifier_references[id].id_flags &    (ID_STATIC|ID_PRIVATE|ID_HIDDEN)))) {    low_object_index_no_free(&tmp, o, id);    } else {    /* Not found. */    tmp.type = T_INT;    tmp.subtype = NUMBER_UNDEFINED;    tmp.u.integer = 0;    }    } else {    LOCAL_VAR(struct svalue tmp2);
pike.git/src/interpret_functions.h:755:    (BIT_ARRAY | BIT_MULTISET | BIT_MAPPING | BIT_STRING) )    {    LOCAL_VAR(struct svalue tmp);    tmp.type=PIKE_T_INT;    tmp.subtype=NUMBER_NUMBER;    tmp.u.integer=0;    assign_lvalue(Pike_sp-4, &tmp);    } else if (Pike_sp[-2].type == T_OBJECT) {    /* One ref in the lvalue, and one on the stack. */    int i; -  if(Pike_sp[-2].u.object->refs <= 2 && -  (i = FIND_LFUN(Pike_sp[-2].u.object->prog, LFUN_ADD_EQ)) != -1) +  LOCAL_VAR(struct object *o); +  LOCAL_VAR(struct program *p); +  if((o = Pike_sp[-2].u.object)->refs <= 2 && +  (p = o->prog) && +  (i = FIND_LFUN(p->inherits[Pike_sp[-2].subtype].prog, +  LFUN_ADD_EQ)) != -1)    { -  apply_low(Pike_sp[-2].u.object, i, 1); +  apply_low(o, i, 1);    /* NB: The lvalue already contains the object, so    * no need to reassign it.    */    pop_stack();    stack_pop_2_elems_keep_top();    goto add_to_done;    }    }    f_add(2);    assign_lvalue(Pike_sp-3,Pike_sp-1);
pike.git/src/interpret_functions.h:813:    (BIT_ARRAY | BIT_MULTISET | BIT_MAPPING | BIT_STRING) )    {    LOCAL_VAR(struct svalue tmp);    tmp.type=PIKE_T_INT;    tmp.subtype=NUMBER_NUMBER;    tmp.u.integer=0;    assign_lvalue(Pike_sp-4, &tmp);    } else if (Pike_sp[-2].type == PIKE_T_OBJECT) {    /* One ref in the lvalue, and one on the stack. */    int i; -  if(Pike_sp[-2].u.object->refs <= 2 && -  (i = FIND_LFUN(Pike_sp[-2].u.object->prog, LFUN_ADD_EQ)) != -1) +  LOCAL_VAR(struct object *o); +  LOCAL_VAR(struct program *p); +  if((o = Pike_sp[-2].u.object)->refs <= 2 && +  (p = o->prog) && +  (i = FIND_LFUN(p->inherits[Pike_sp[-2].subtype].prog, +  LFUN_ADD_EQ)) != -1)    { -  apply_low(Pike_sp[-2].u.object, i, 1); +  apply_low(o, i, 1);    /* NB: The lvalue already contains the object, so    * no need to reassign it.    */    pop_n_elems(4);    goto add_to_and_pop_done;    }    }    f_add(2);    assign_lvalue(Pike_sp-3,Pike_sp-1);    pop_n_elems(3);
pike.git/src/interpret_functions.h:1116:    /* write_to_stderr("foreach\n", 8); */    DONT_BRANCH();    }else{    DO_BRANCH();    }    pop_stack();   });      OPCODE1_BRANCH(F_BRANCH_IF_TYPE_IS_NOT, "branch if type is !=", I_UPDATE_SP, {   /* fprintf(stderr,"******BRANCH IF TYPE IS NOT***** %s\n",get_name_of_type(arg1)); */ +  LOCAL_VAR(struct object *o);    if(Pike_sp[-1].type == T_OBJECT && -  Pike_sp[-1].u.object->prog) +  (o = Pike_sp[-1].u.object)->prog)    { -  int fun=FIND_LFUN(Pike_sp[-1].u.object->prog, LFUN__IS_TYPE); +  int fun = FIND_LFUN(o->prog->inherits[Pike_sp[-1].subtype].prog, +  LFUN__IS_TYPE);    if(fun != -1)    {   /* fprintf(stderr,"******OBJECT OVERLOAD IN TYPEP***** %s\n",get_name_of_type(arg1)); */    push_text(get_name_of_type(arg1)); -  apply_low(Pike_sp[-2].u.object, fun, 1); +  apply_low(o, fun, 1);    arg1=UNSAFE_IS_ZERO(Pike_sp-1) ? T_FLOAT : T_OBJECT ;    pop_stack();    }    }    if(Pike_sp[-1].type == arg1)    {    /* write_to_stderr("foreach\n", 8); */    DONT_BRANCH();    }else{    DO_BRANCH();
pike.git/src/interpret_functions.h:1429:   OPCODE0(F_MAKE_ITERATOR, "get_iterator", 0, {    f_get_iterator(1);   });      /* Stack is: iterator, index lvalue, value lvalue. */   OPCODE0_BRANCH (F_FOREACH_START, "foreach start", 0, {    DO_IF_DEBUG (    if(Pike_sp[-5].type != PIKE_T_OBJECT)    Pike_fatal ("Iterator gone from stack.\n");    ); +  /* FIXME: object subtype. */    if (foreach_iterate (Pike_sp[-5].u.object, 0))    DONT_BRANCH();    else {    DO_BRANCH();    }   });      /* Stack is: iterator, index lvalue, value lvalue. */   OPCODE0_BRANCH(F_FOREACH_LOOP, "foreach loop", 0, {    DO_IF_DEBUG (    if(Pike_sp[-5].type != PIKE_T_OBJECT)    Pike_fatal ("Iterator gone from stack.\n");    ); -  +  /* FIXME: object subtype. */    if(foreach_iterate(Pike_sp[-5].u.object, 1))    {    DO_BRANCH();    }else{    DONT_BRANCH();    }   });         OPCODE1_RETURN(F_RETURN_LOCAL,"return local", I_UPDATE_SP|I_UPDATE_FP, {
pike.git/src/interpret_functions.h:1635:    {    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, "@", I_UPDATE_SP, { +  int i; +  LOCAL_VAR(struct program *p); +     switch(Pike_sp[-1].type)    {    default:    PIKE_ERROR("@", "Bad argument.\n", Pike_sp, 1);       case PIKE_T_OBJECT: -  if(!Pike_sp[-1].u.object->prog || -  FIND_LFUN(Pike_sp[-1].u.object->prog,LFUN__VALUES) == -1) +  if(!(p = Pike_sp[-1].u.object->prog) || +  (i = FIND_LFUN(p->inherits[Pike_sp[-1].subtype].prog, +  LFUN__VALUES)) == -1)    PIKE_ERROR("@", "Bad argument.\n", Pike_sp, 1);    -  apply_lfun(Pike_sp[-1].u.object, LFUN__VALUES, 0); +  apply_low(Pike_sp[-1].u.object, i, 0);    if(Pike_sp[-1].type != PIKE_T_ARRAY)    Pike_error("Bad return type from o->_values() in @\n");    free_svalue(Pike_sp-2);    move_svalue (Pike_sp - 2, Pike_sp - 1);    Pike_sp--;    break;       case PIKE_T_ARRAY: break;    }    dmalloc_touch_svalue(Pike_sp-1);
pike.git/src/interpret_functions.h:1983:    LOCAL_VAR(struct svalue *s);    s = Pike_sp-args;    JUMP_SET_TO_PC_AT_NEXT (Pike_fp->return_addr);    if(s->type == T_OBJECT)    {    LOCAL_VAR(struct object *o);    LOCAL_VAR(struct program *p);    o = s->u.object;    if((p=o->prog))    { +  p = p->inherits[s->subtype].prog;    if(FIND_LFUN(p, LFUN_ARROW) == -1)    {    int fun;    fun=find_shared_string_identifier(Pike_fp->context.prog->strings[arg1],    p);    if(fun >= 0)    {    if(low_mega_apply(APPLY_LOW, args-1, o, (void *)(ptrdiff_t)fun))    {    Pike_fp->save_sp--;
pike.git/src/interpret_functions.h:2039:    LOCAL_VAR(struct svalue *s);    s = Pike_sp-args;    JUMP_SET_TO_PC_AT_NEXT (Pike_fp->return_addr);    if(s->type == T_OBJECT)    {    LOCAL_VAR(struct object *o);    LOCAL_VAR(struct program *p);    o = s->u.object;    if((p=o->prog))    { +  p = p->inherits[s->subtype].prog;    if(FIND_LFUN(p, LFUN_ARROW) == -1)    {    int fun;    fun=find_shared_string_identifier(Pike_fp->context.prog->strings[arg1],    p);    if(fun >= 0)    {    if(low_mega_apply(APPLY_LOW, args-1, o, (void *)(ptrdiff_t)fun))    {    Pike_fp->save_sp--;
pike.git/src/interpret_functions.h:2097:    INT32 args=DO_NOT_WARN((INT32)(Pike_sp - *--Pike_mark_sp));    LOCAL_VAR(struct svalue *s);    s = Pike_sp - args;    if(s->type == T_OBJECT)    {    LOCAL_VAR(struct object *o);    LOCAL_VAR(struct program *p);    o = s->u.object;    if((p=o->prog))    { +  p = p->inherits[s->subtype].prog;    if(FIND_LFUN(p, LFUN_ARROW) == -1)    {    int fun;    fun=find_shared_string_identifier(Pike_fp->context.prog->strings[arg1],    p);    if(fun >= 0)    {    if(low_mega_apply(APPLY_LOW, args-1, o, (void *)(ptrdiff_t)fun))    {    PIKE_OPCODE_T *addr = Pike_fp->pc;