pike.git / src / las.c

version» Context lines:

pike.git/src/las.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: las.c,v 1.322 2003/01/26 11:09:00 mirar Exp $ + || $Id: las.c,v 1.323 2003/02/04 18:17:33 mast Exp $   */      #include "global.h" - RCSID("$Id: las.c,v 1.322 2003/01/26 11:09:00 mirar Exp $"); + RCSID("$Id: las.c,v 1.323 2003/02/04 18:17:33 mast 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:520: Inside #if defined(SHARED_NODES)
   scan = scan->next;    }    } else {    /* FIXME: sub_node() recalculates the hash index.    * We might get better performance by using the one we already have.    */    sub_node(orig);    }    /* Propagate the line-number information. */    n->line_number = orig->line_number; - #ifdef PIKE_DEBUG +     if (orig->current_file) {    if (n->current_file) {    free_string(n->current_file);    }    n->current_file = orig->current_file;    orig->current_file = NULL;    } - #endif /* PIKE_DEBUG */ +     free_node(dmalloc_touch(node *, orig));    n->refs++;    return check_node_hash(dmalloc_touch(node *, n));    }    n = n->next;    }    orig->node_info &= ~OPT_DEFROSTED;    if (!found) {    add_node(dmalloc_touch(node *, orig));    }
pike.git/src/las.c:766: Inside #if defined(SHARED_NODES) && defined(PIKE_DEBUG)
  #if defined(SHARED_NODES) && defined(PIKE_DEBUG)    if (dead->refs) {    Pike_fatal("Killed node %p still has refs: %d\n", dead, dead->refs);    }   #endif /* SHARED_NODES && PIKE_DEBUG */       n = n->parent;       if(dead->type) free_type(dead->type);    if(dead->name) free_string(dead->name); - #ifdef PIKE_DEBUG +     if(dead->current_file) free_string(dead->current_file); - #endif +     dead->token=USHRT_MAX;    really_free_node_s(dead);    }    if (n->parent && cdr_is_node(n->parent)) {    /* Kill node and jump to the sibling. */    node *dead = n;      #if defined(SHARED_NODES) && defined(PIKE_DEBUG)    if (dead->refs) {    Pike_fatal("Killed node %p still has refs: %d\n", dead, dead->refs);    }   #endif /* SHARED_NODES && PIKE_DEBUG */       n = n->parent;    if(dead->type) free_type(dead->type);    if(dead->name) free_string(dead->name); - #ifdef PIKE_DEBUG +     if(dead->current_file) free_string(dead->current_file); - #endif +     dead->token=USHRT_MAX;    really_free_node_s(dead);      #ifdef SHARED_NODES    if (--_CDR(n)->refs) {    _CDR(n) = NULL;    goto backtrack;    } else {   #endif /* SHARED_NODES */    _CDR(n)->parent = n;
pike.git/src/las.c:816:    /* Kill root node. */      #if defined(SHARED_NODES) && defined(PIKE_DEBUG)    if (n->refs) {    Pike_fatal("Killed node %p still has refs: %d\n", n, n->refs);    }   #endif /* SHARE_NODES && PIKE_DEBUG */       if(n->type) free_type(n->type);    if(n->name) free_string(n->name); - #ifdef PIKE_DEBUG +     if(n->current_file) free_string(n->current_file); - #endif +        n->token=USHRT_MAX;    really_free_node_s(n);    break;    } while (n->parent);   }         node *debug_check_node_hash(node *n)   {
pike.git/src/las.c:857: Inside #if defined(SHARED_NODES) || defined(__CHECKER__)
  #if defined(SHARED_NODES) || defined(__CHECKER__)    MEMSET(res, 0, sizeof(node));   #ifdef SHARED_NODES    res->hash = 0;    res->refs = 1;   #endif /* SHARED_NODES */   #endif /* SHARED_NODES || __CHECKER__ */       res->token=0;    res->line_number=lex.current_line; - #ifdef PIKE_DEBUG +     copy_shared_string(res->current_file, lex.current_file); - #endif +     res->type=0;    res->name=0;    res->node_info=0;    res->tree_info=0;    res->parent=0;    return res;   }      #define mkemptynode() dmalloc_touch(node *, debug_mkemptynode())   
pike.git/src/las.c:5101: Inside #if defined(SHARED_NODES) && !defined(IN_TPIKE)
   free_node(n);    return n2;   }   #endif /* SHARED_NODES && !IN_TPIKE */      static void optimize(node *n)   {   #ifndef IN_TPIKE    node *tmp1, *tmp2, *tmp3;   #endif /* !IN_TPIKE */ -  INT32 save_line = lex.current_line; - #ifdef PIKE_DEBUG +     struct pike_string *save_file = lex.current_file; - #endif /* PIKE_DEBUG */ +  INT32 save_line = lex.current_line;       do    {    if(car_is_node(n) &&    ((CAR(n)->node_info & (OPT_OPTIMIZED|OPT_DEFROSTED)) != OPT_OPTIMIZED))    {    CAR(n)->parent = n;    n = CAR(n);    continue;    }
pike.git/src/las.c:5149: Inside #if defined(SHARED_NODES)
   n->node_info &= ~OPT_DEFROSTED;    if (n->node_info & OPT_OPTIMIZED) {    /* No need to check this node any more. */    n = n->parent;    continue;    }    }   #endif /* SHARED_NODES && !IN_TPIKE */       lex.current_line = n->line_number; - #ifdef PIKE_DEBUG +     lex.current_file = n->current_file; - #endif /* PIKE_DEBUG */ +       #ifdef SHARED_NODES    if (n->tree_info & OPT_NOT_SHARED) {    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->tree_info & OPT_NOT_SHARED)) {    /* We need to fix the hash for this node. */    n->hash = hash_node(n);    /* FIXME: Should probably add the node to the hashtable here. */
pike.git/src/las.c:5318:   #endif    continue;       }   #endif /* !IN_TPIKE */    n->node_info |= OPT_OPTIMIZED;    n=n->parent;    }while(n);       lex.current_line = save_line; - #ifdef PIKE_DEBUG +     lex.current_file = save_file; - #endif /* PIKE_DEBUG */ +    }      void optimize_node(node *n)   {    if(n &&    !Pike_compiler->num_parse_error &&    Pike_compiler->compiler_pass==2 &&    (n->node_info & OPT_TRY_OPTIMIZE))    {    optimize(n);