pike.git / src / las.c

version» Context lines:

pike.git/src/las.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: las.c,v 1.28 1997/03/01 02:37:03 hubbe Exp $"); + RCSID("$Id: las.c,v 1.29 1997/03/05 05:22:55 hubbe Exp $");      #include "language.h"   #include "interpret.h"   #include "las.h"   #include "array.h"   #include "object.h"   #include "stralloc.h"   #include "dynamic_buffer.h"   #include "lex.h"   #include "pike_types.h"
pike.git/src/las.c:304:    res->type = 0;       /* We try to optimize most things, but argument lists are hard... */    if(token != F_ARG_LIST && (a || b))    res->node_info |= OPT_TRY_OPTIMIZE;       if(a) a->parent = res;    if(b) b->parent = res;    if(!num_parse_error) optimize(res);    + #ifdef DEBUG +  if(d_flag > 3) +  verify_shared_strings_tables(); + #endif +     return res;   }      node *mkstrnode(struct pike_string *str)   {    node *res = mkemptynode();    res->token = F_CONSTANT;    copy_shared_string(res->type, string_type_string);    res->node_info = 0;    res->u.sval.type = T_STRING;
pike.git/src/las.c:383:       return mkefuncallnode(oper_id, arg1);   }      node *mklocalnode(int var)   {    node *res = mkemptynode();    res->token = F_LOCAL;    copy_shared_string(res->type, local_variables->variable[var].type);    res->node_info = OPT_NOT_CONST; +  res->tree_info=res->node_info;   #ifdef __CHECKER__    CDR(res)=0;   #endif    res->u.number = var;    return res;   }      node *mkidentifiernode(int i)   {    node *res = mkemptynode();
pike.git/src/las.c:404:    setup_fake_program();    copy_shared_string(res->type, ID_FROM_INT(&fake_program, i)->type);       /* FIXME */    if(IDENTIFIER_IS_CONSTANT(ID_FROM_INT(&fake_program, i)->flags))    {    res->node_info = OPT_EXTERNAL_DEPEND;    }else{    res->node_info = OPT_NOT_CONST;    } +  res->tree_info=res->node_info;      #ifdef __CHECKER__    CDR(res)=0;   #endif    res->u.number = i;    return res;   }      node *mkcastnode(struct pike_string *type,node *n)   {
pike.git/src/las.c:1361:    n=CAR(n);    continue;    }    if(cdr_is_node(n) && !(CDR(n)->node_info & OPT_OPTIMIZED))    {    n=CDR(n);    continue;    }    current_line = n->line_number;    -  if(!n->parent) break; +        n->tree_info = n->node_info;    if(car_is_node(n)) n->tree_info |= CAR(n)->tree_info;    if(cdr_is_node(n)) n->tree_info |= CDR(n)->tree_info;    -  +  if(!n->parent) break; +     if(n->tree_info & (OPT_NOT_CONST|    OPT_SIDE_EFFECT|    OPT_EXTERNAL_DEPEND|    OPT_ASSIGNMENT))    {    if(car_is_node(n) &&    !(CAR(n)->tree_info & (OPT_NOT_CONST|    OPT_SIDE_EFFECT|    OPT_EXTERNAL_DEPEND|    OPT_ASSIGNMENT)) &&
pike.git/src/las.c:1402:    {    CDR(n) = eval(CDR(n));    if(CDR(n)) CDR(n)->parent = n;    zapp_try_optimize(CDR(n)); /* avoid infinite loops */    continue;    }    }    fix_type_field(n);      #ifdef DEBUG -  if(l_flag > 3) +  if(l_flag > 3 && n)    { -  fprintf(stderr,"Optimizing: "); +  fprintf(stderr,"Optimizing (tree info=%x):",n->tree_info);    print_tree(n);    }   #endif       switch(n->token)    {    case F_APPLY:    if(CAR(n)->token == F_CONSTANT &&    CAR(n)->u.sval.type == T_FUNCTION &&    CAR(n)->u.sval.subtype == FUNCTION_BUILTIN && /* driver fun? */    CAR(n)->u.sval.u.efun->optimize)    {    if(tmp1=CAR(n)->u.sval.u.efun->optimize(n)) -  +  {    goto use_tmp1;    } -  +  }    break;       case F_ARG_LIST:    case F_LVALUE_LIST:    if(!CAR(n)) goto use_cdr;    if(!CDR(n)) goto use_car;       /*    * { X; break; Y; } -> { X; return; }    * { X; return; Y; } -> { X; return; }
pike.git/src/las.c:1786:    }   }      int eval_low(node *n)   {    unsigned INT16 num_strings, num_constants;    INT32 jump;    struct svalue *save_sp = sp;    int ret;    + #ifdef DEBUG +  if(l_flag > 3 && n) +  { +  fprintf(stderr,"Evaluating (tree info=%x):",n->tree_info); +  print_tree(n); +  } + #endif +     if(num_parse_error) return -1;    setup_fake_program();       num_strings=fake_program.num_strings;    num_constants=fake_program.num_constants;    jump=PC;       store_linenumbers=0;    docode(n);    ins_f_byte(F_DUMB_RETURN);
pike.git/src/las.c:2040:    modifiers,    IDENTIFIER_PIKE_FUNCTION | vargs,    &tmp);       free_node(n);    return ret;   }      INT32 get_opt_info() { return last_function_opt_info; }    +