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.   \*/   /**/   #include "global.h" - RCSID("$Id: las.c,v 1.296 2002/08/12 20:19:08 grubba Exp $"); + RCSID("$Id: las.c,v 1.297 2002/08/15 14:49:22 marcus 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:102: Inside #if defined(PIKE_DEBUG)
      if(!d_flag) return;       if (!n) return;       parent = n->parent;    n->parent = NULL;       while(n) {    if(n->token==USHRT_MAX) -  fatal("Free node in tree.\n"); +  Pike_fatal("Free node in tree.\n");       check_node_hash(n);       switch(n->token)    {    case F_EXTERNAL:    if(n->type)    {    int parent_id = n->u.integer.a;    int id_no = n->u.integer.b;
pike.git/src/las.c:134: Inside #if defined(PIKE_DEBUG), #if 0 and #if defined(PIKE_DEBUG)
   */    if(id->type != n->type)    {    fprintf(stderr, "Type of external node "    "is not matching its identifier.\nid->type: ");    simple_describe_type(id->type);    fprintf(stderr, "\nn->type : ");    simple_describe_type(n->type);    fprintf(stderr, "\n");    -  fatal("Type of external node is not matching its identifier.\n"); +  Pike_fatal("Type of external node is not matching its identifier.\n");    }   #endif   #endif    }    }    }    }       if(d_flag<2) break;       if(!(depth & 1023))    {    node *q;    for(q=n->parent;q;q=q->parent)    if(q->parent==n) -  fatal("Cyclic node structure found.\n"); +  Pike_fatal("Cyclic node structure found.\n");    }       if(car_is_node(n))    {    /* Check CAR */   #ifdef SHARED_NODES    CAR(n)->parent = n;   #else /* !SHARED_NODES */    if(CAR(n)->parent != n) -  fatal("Parent is wrong.\n"); +  Pike_fatal("Parent is wrong.\n");   #endif /* SHARED_NODES */       depth++;    n = CAR(n);    continue;    }       if(cdr_is_node(n))    {    /* Check CDR */   #ifdef SHARED_NODES    CDR(n)->parent = n;   #else /* !SHARED_NODES */    if(CDR(n)->parent != n) -  fatal("Parent is wrong.\n"); +  Pike_fatal("Parent is wrong.\n");   #endif /* !SHARED_NODES */       depth++;    n = CDR(n);    continue;    }       while(n->parent &&    (!cdr_is_node(n->parent) || (CDR(n->parent) == n))) {    /* Backtrack */    n = n->parent;    depth--;    }       if (n->parent && cdr_is_node(n->parent)) {    /* Jump to the sibling */   #ifdef SHARED_NODES    CDR(n->parent)->parent = n->parent;   #else /* !SHARED_NODES */    if(CDR(n->parent)->parent != n->parent) -  fatal("Parent is wrong.\n"); +  Pike_fatal("Parent is wrong.\n");   #endif /* !SHARED_NODES */    n = CDR(n->parent);    continue;    }    break;    }       if (n != orig_n) {    fprintf(stderr, "check_tree() lost track.\n");    d_flag = 0;    fprintf(stderr, "n:");    print_tree(n);    fprintf(stderr, "orig_n:");    print_tree(orig_n); -  fatal("check_tree() lost track.\n"); +  Pike_fatal("check_tree() lost track.\n");    }    n->parent = parent;   }   #endif      /* FIXME: Ought to use parent pointer to avoid recursion. */   INT32 count_args(node *n)   {    int a,b;    check_tree(n,0);
pike.git/src/las.c:409: Inside #if defined(SHARED_NODES) and #if defined(PIKE_DEBUG)
   (void *)probe, (void *)n);    fprintf( stderr, " %ld <-> %ld\n",    DO_NOT_WARN((long)hval),    DO_NOT_WARN((long)(n->hash % node_hash.size)) );    probe = node_hash.table[hval];    while( probe )    {    fprintf(stderr, " %p\n", (void *)probe);    probe = probe->next;    } -  fatal( "Node already added!\n" ); +  Pike_fatal( "Node already added!\n" );    }    probe = probe->next;    }   #endif /* PIKE_DEBUG */    n->next = node_hash.table[hval];    node_hash.table[hval] = n;   }      static void sub_node(node *n)   {
pike.git/src/las.c:621:    tmp->refs = 1;   #endif /* SHARED_NODES */    debug_malloc_touch(tmp->type);    free_node(tmp);    }    }    }    }   #if defined(PIKE_DEBUG)    if(!cumulative_parse_error) -  fatal("Failed to free %d nodes when compiling!\n",e2); +  Pike_fatal("Failed to free %d nodes when compiling!\n",e2);   #endif    }   #ifndef PIKE_DEBUG    }   #endif    free_all_node_s_blocks();    cumulative_parse_error=0;      #ifdef SHARED_NODES    /* MEMSET(node_hash.table, 0, sizeof(node *) * node_hash.size); */
pike.git/src/las.c:653: Inside #if defined(SHARED_NODES) and #if defined(PIKE_DEBUG)
   if(l_flag>9)    print_tree(n);       if (!(n->tree_info & (OPT_NOT_SHARED | OPT_DEFROSTED))) {    size_t hash;    if ((hash = hash_node(n)) != n->hash) {    fprintf(stderr, "Hash-value is bad 0x%08lx != 0x%08lx\n",    DO_NOT_WARN((unsigned long)hash),    DO_NOT_WARN((unsigned long)n->hash));    print_tree(n); -  fatal("token:%d, car:%p cdr:%p file:%s line:%d\n", +  Pike_fatal("token:%d, car:%p cdr:%p file:%s line:%d\n",    n->token, _CAR(n), _CDR(n), n->current_file->str, n->line_number);    }    }   #endif /* PIKE_DEBUG */    return;    }   #endif /* SHARED_NODES */       n->parent = NULL;   
pike.git/src/las.c:677: Inside #if defined(PIKE_DEBUG)
   print_tree(n);      #ifdef SHARED_NODES    if (!(n->tree_info & (OPT_NOT_SHARED | OPT_DEFROSTED))) {    size_t hash;    if ((hash = hash_node(n)) != n->hash) {    fprintf(stderr, "Hash-value is bad 0x%08lx != 0x%08lx\n",    DO_NOT_WARN((unsigned long)hash),    DO_NOT_WARN((unsigned long)n->hash));    print_tree(n); -  fatal("token:%d, car:%p cdr:%p file:%s line:%d\n", +  Pike_fatal("token:%d, car:%p cdr:%p file:%s line:%d\n",    n->token, _CAR(n), _CDR(n), n->current_file->str, n->line_number);    }    }   #endif /* SHARED_NODES */   #endif /* PIKE_DEBUG */       debug_malloc_touch(n);      #ifdef SHARED_NODES   #ifdef PIKE_DEBUG    if (n->refs) { -  fatal("Node with refs left about to be killed: %8p\n", n); +  Pike_fatal("Node with refs left about to be killed: %8p\n", n);    }   #endif /* PIKE_DEBUG */    sub_node(dmalloc_touch(node *, n));   #endif /* SHARED_NODES */       switch(n->token)    {    case USHRT_MAX: -  fatal("Freeing node again!\n"); +  Pike_fatal("Freeing node again!\n");    break;       case F_CONSTANT:    free_svalue(&(n->u.sval));    break;    }       if (car_is_node(n)) {    /* Free CAR */   
pike.git/src/las.c:745:    }   #endif /* SHARED_NODES */    }    backtrack:    while (n->parent && !cdr_is_node(n->parent)) {    /* Kill the node and backtrack */    node *dead = n;      #if defined(SHARED_NODES) && defined(PIKE_DEBUG)    if (dead->refs) { -  fatal("Killed node %p still has refs: %d\n", dead, 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) { -  fatal("Killed node %p still has refs: %d\n", dead, 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;
pike.git/src/las.c:797: Inside #if defined(SHARED_NODES)
   continue;   #ifdef SHARED_NODES    }   #endif /* SHARED_NODES */    }       /* Kill root node. */      #if defined(SHARED_NODES) && defined(PIKE_DEBUG)    if (n->refs) { -  fatal("Killed node %p still has refs: %d\n", n, 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;
pike.git/src/las.c:823:      node *debug_check_node_hash(node *n)   {   #if defined(PIKE_DEBUG) && defined(SHARED_NODES)    if (n && !(n->tree_info & (OPT_DEFROSTED|OPT_NOT_SHARED)) && (n->hash != hash_node(n))) {    fprintf(stderr,"Bad node hash at %p, (%s:%d) (token=%d).\n",    (void *)n, n->current_file->str, n->line_number,    n->token);    debug_malloc_dump_references(n,0,0,0);    print_tree(n); -  fatal("Bad node hash!\n"); +  Pike_fatal("Bad node hash!\n");    }   #endif /* PIKE_DEBUG && SHARED_NODES */    return n;   }      /* here starts routines to make nodes */   static node *debug_mkemptynode(void)   {    node *res=alloc_node_s();   
pike.git/src/las.c:904:    return res;       case 3:    return mkefuncallnode("`[]",mknode(F_ARG_LIST,a,b));    }    break;      #ifdef PIKE_DEBUG    case F_CAST:    case F_SOFT_CAST: -  fatal("Attempt to create a cast-node with mknode()!\n"); +  Pike_fatal("Attempt to create a cast-node with mknode()!\n");    case F_CONSTANT: -  fatal("Attempt to create an F_CONSTANT-node with mknode()!\n"); +  Pike_fatal("Attempt to create an F_CONSTANT-node with mknode()!\n");    case F_LOCAL: -  fatal("Attempt to create an F_LOCAL-node with mknode()!\n"); +  Pike_fatal("Attempt to create an F_LOCAL-node with mknode()!\n");    case F_IDENTIFIER: -  fatal("Attempt to create an F_IDENTIFIER-node with mknode()!\n"); +  Pike_fatal("Attempt to create an F_IDENTIFIER-node with mknode()!\n");    case F_TRAMPOLINE: -  fatal("Attempt to create an F_TRAMPOLINE-node with mknode()!\n"); +  Pike_fatal("Attempt to create an F_TRAMPOLINE-node with mknode()!\n");    case F_EXTERNAL: -  fatal("Attempt to create an F_EXTERNAL-node with mknode()!\n"); +  Pike_fatal("Attempt to create an F_EXTERNAL-node with mknode()!\n");   #endif /* PIKE_DEBUG */    }      #if defined(PIKE_DEBUG) && !defined(SHARED_NODES)    if(b && a==b) -  fatal("mknode: a and be are the same!\n"); +  Pike_fatal("mknode: a and be are the same!\n");   #endif       check_tree(a,0);    check_tree(b,0);       res = mkemptynode();    _CAR(res) = dmalloc_touch(node *, a);    _CDR(res) = dmalloc_touch(node *, b);    res->node_info = 0;    res->tree_info = 0;
pike.git/src/las.c:1433: Inside #if 0 and #if defined(PIKE_DEBUG)
   * identifier can change in pass 2 -Hubbe    */    if(d_flag && id->type != res->type)    {    printf("Type of external node is not matching it's identifier.\nid->type: ");    simple_describe_type(id->type);    printf("\nres->type : ");    simple_describe_type(res->type);    printf("\n");    -  fatal("Type of external node is not matching it's identifier.\n"); +  Pike_fatal("Type of external node is not matching it's identifier.\n");    }   #endif   #endif       return res;   }      node *debug_mkcastnode(struct pike_type *type, node *n)   {    node *res;       if(!n) return 0;      #ifdef PIKE_DEBUG    if (!type) { -  fatal("Casting to no type!\n"); +  Pike_fatal("Casting to no type!\n");    }   #endif /* PIKE_DEBUG */       if (type == void_type_string) return mknode(F_POP_VALUE, n, 0);       if(type==n->type) return n;       res = mkemptynode();    res->token = F_CAST;    copy_pike_type(res->type, type);
pike.git/src/las.c:1483:   }      node *debug_mksoftcastnode(struct pike_type *type, node *n)   {    node *res;       if(!n) return 0;      #ifdef PIKE_DEBUG    if (!type) { -  fatal("Soft cast to no type!\n"); +  Pike_fatal("Soft cast to no type!\n");    }   #endif /* PIKE_DEBUG */       if (Pike_compiler->compiler_pass == 2) {    if (type == void_type_string) {    yywarning("Soft cast to void.");    return mknode(F_POP_VALUE, n, 0);    }       if(type==n->type) {
pike.git/src/las.c:1882:    SET_CYCLIC_RET(c+1);    ref_push_string(id);    {    struct svalue *save_sp = Pike_sp-2;    JMP_BUF recovery;    if (SETJMP(recovery)) {    /* f_index() threw an error! */    if (Pike_sp > save_sp) {    pop_n_elems(Pike_sp - save_sp);    } else if (Pike_sp != save_sp) { -  fatal("f_index() munged stack!\n"); +  Pike_fatal("f_index() munged stack!\n");    }    push_undefined();    thrown = throw_value;    throw_value.type = T_INT;    } else {    f_index(2);    }    UNSETJMP(recovery);    }   
pike.git/src/las.c:2125: Inside #if defined(SHARED_NODES)
   default:   #ifdef SHARED_NODES    n->refs++;    return n;   #else /* !SHARED_NODES */       fatal_check_c_stack(16384);       switch((car_is_node(n) << 1) | cdr_is_node(n))    { -  default: fatal("fooo?\n"); +  default: Pike_fatal("fooo?\n");       case 3:    b=mknode(n->token, copy_node(CAR(n)), copy_node(CDR(n)));    break;    case 2:    b=mknode(n->token, copy_node(CAR(n)), CDR(n));    break;       case 1:    b=mknode(n->token, CAR(n), copy_node(CDR(n)));
pike.git/src/las.c:3538:    node *arg1 = *nptr;       if ((nptr = my_get_arg(&_CDR(n), 1))) {    node *arg2 = *nptr;       n->type = range_type(CAR(n)->type, arg1->type, arg2->type);    break;    }    }    /* Fewer than 2 arguments to F_RANGE. */ -  fatal("Bad number of arguments to F_RANGE.\n"); +  Pike_fatal("Bad number of arguments to F_RANGE.\n");    }    break;    case F_AUTO_MAP_MARKER:    if (!CAR(n) || (CAR(n)->type == void_type_string)) {    my_yyerror("Indexing a void expression.");    /* The optimizer converts this to an expression returning 0. */    copy_pike_type(n->type, zero_type_string);    } else {    type_a=CAR(n)->type;    if(!match_types(type_a, array_type_string))
pike.git/src/las.c:3707: Inside #if 0 and #if defined(PIKE_DEBUG)
   * identifier can change in pass 2 -Hubbe    */    if(id->type != f)    {    printf("Type of external node is not matching it's identifier.\nid->type: ");    simple_describe_type(id->type);    printf("\nf : ");    simple_describe_type(f);    printf("\n");    -  fatal("Type of external node is not matching it's identifier.\n"); +  Pike_fatal("Type of external node is not matching it's identifier.\n");    }   #endif   #endif    }    }    }    break;       default:    name="unknown function";
pike.git/src/las.c:3823:    case F_MULT_EQ:    MAKE_CONSTANT_SHARED_STRING(op_string, "`*");    break;    case F_MOD_EQ:    MAKE_CONSTANT_SHARED_STRING(op_string, "`%");    break;    case F_DIV_EQ:    MAKE_CONSTANT_SHARED_STRING(op_string, "`/");    break;    default: -  fatal("fix_type_field(): Unhandled token: %d\n", n->token); +  Pike_fatal("fix_type_field(): Unhandled token: %d\n", n->token);    break;    }    if (!(op_node = find_module_identifier(op_string, 0))) {    my_yyerror("Internally used efun undefined for token %d: %s()",    n->token, op_string->str);    copy_pike_type(n->type, mixed_type_string);    free_string(op_string);    break;    }    if (!op_node->type) {
pike.git/src/las.c:4279:    }    if (n->parent && cdr_is_node(n->parent)) {    CDR(n->parent)->parent = n->parent;    n = CDR(n->parent);    continue;    }    break;    }   #ifdef PIKE_DEBUG    if (n != orig_n) { -  fatal("zzap_try_optimize() lost track of parent.\n"); +  Pike_fatal("zzap_try_optimize() lost track of parent.\n");    }   #endif /* PIKE_DEBUG */    n->parent = parent;   }      #if defined(SHARED_NODES) && !defined(IN_TPIKE)   /* FIXME: Ought to use parent pointer to avoid recursion. */   static void find_usage(node *n, unsigned char *usage,    unsigned char *switch_u,    const unsigned char *cont_u,