pike.git / src / docode.c

version» Context lines:

pike.git/src/docode.c: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: docode.c,v 1.160 2002/11/23 16:36:44 mast Exp $ + || $Id: docode.c,v 1.161 2003/02/24 21:00:44 mast Exp $   */      #include "global.h" - RCSID("$Id: docode.c,v 1.160 2002/11/23 16:36:44 mast Exp $"); + RCSID("$Id: docode.c,v 1.161 2003/02/24 21:00:44 mast Exp $");   #include "las.h"   #include "program.h"   #include "pike_types.h"   #include "stralloc.h"   #include "interpret.h"   #include "constants.h"   #include "array.h"   #include "pike_macros.h"   #include "pike_error.h"   #include "pike_memory.h"
pike.git/src/docode.c:687:    }else{    emit2(F_EXTERNAL, n->u.integer.b, level);    return 1;    }    }else{    if(flags & WANT_LVALUE)    {    emit1(F_GLOBAL_LVALUE, n->u.integer.b);    return 2;    }else{ -  if(IDENTIFIER_IS_FUNCTION(ID_FROM_INT(state->new_program,n->u.integer.b)->identifier_flags)) +  struct identifier *id = ID_FROM_INT(state->new_program,n->u.integer.b); +  if(IDENTIFIER_IS_FUNCTION(id->identifier_flags) && +  id->identifier_flags & IDENTIFIER_HAS_BODY)    { -  +  /* Only use this opcode when it's certain that the result +  * can't zero, i.e. when we know the function isn't just a +  * prototype. */    emit1(F_LFUN, n->u.integer.b);    }else{    emit1(F_GLOBAL, n->u.integer.b);    }    return 1;    }    }    }    break;   
pike.git/src/docode.c:2048:    case T_STRING:    tmp1=store_prog_string(n->u.sval.u.string);    emit1(F_STRING, DO_NOT_WARN((INT32)tmp1));    return 1;       case T_FUNCTION:    if(n->u.sval.subtype!=FUNCTION_BUILTIN)    {    if(n->u.sval.u.object == Pike_compiler->fake_object)    { -  emit1(F_LFUN,n->u.sval.subtype); +  /* When does this occur? /mast */ +  emit1(F_GLOBAL,n->u.sval.subtype);    return 1;    }       if(n->u.sval.u.object->next == n->u.sval.u.object)    {    int x=0;   #if 0    struct object *o;       for(o=Pike_compiler->fake_object;o!=n->u.sval.u.object;o=o->parent)
pike.git/src/docode.c:2169:    struct compiler_frame *f;    int depth=0;    for(f=Pike_compiler->compiler_frame;    f!=n->u.trampoline.frame;f=f->previous)    depth++;       emit2(F_TRAMPOLINE,n->u.trampoline.ident,depth);    return 1;    }    -  case F_IDENTIFIER: -  if(IDENTIFIER_IS_FUNCTION(ID_FROM_INT(Pike_compiler->new_program, n->u.id.number)->identifier_flags)) +  case F_IDENTIFIER: { +  struct identifier *id = ID_FROM_INT(Pike_compiler->new_program, n->u.id.number); +  if(IDENTIFIER_IS_FUNCTION(id->identifier_flags))    {    if(flags & WANT_LVALUE)    {    yyerror("Cannot assign functions.\n");    }else{ -  +  if (id->identifier_flags & IDENTIFIER_HAS_BODY) +  /* Only use this opcode when it's certain that the result +  * can't zero, i.e. when we know the function isn't just a +  * prototype. */    emit1(F_LFUN,n->u.id.number); -  +  else +  emit1(F_GLOBAL,n->u.id.number);    }    }else{    if(flags & WANT_LVALUE)    {    emit1(F_GLOBAL_LVALUE,n->u.id.number);    return 2;    }else{    emit1(F_GLOBAL,n->u.id.number);    }    }    return 1; -  +  }       case F_VAL_LVAL:    return do_docode(CAR(n),flags) +    do_docode(CDR(n), (INT16)(flags | DO_LVALUE));       case F_AUTO_MAP:    emit0(F_MARK);    code_expression(CAR(n), 0, "automap function");    do_encode_automap_arg_list(CDR(n),0);    emit_apply_builtin("__automap__");