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.209 2000/09/12 14:41:40 grubba Exp $"); + RCSID("$Id: las.c,v 1.210 2000/09/12 17:06:38 grubba 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:218:    }    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); +  +  fatal_check_c_stack(16384); +     if(!n) return 0;    switch(n->token)    {    case F_COMMA_EXPR:    case F_VAL_LVAL:    case F_ARG_LIST:    a=count_args(CAR(n));    if(a==-1) return -1;    b=count_args(CDR(n));    if(b==-1) return -1;
pike.git/src/las.c:286:    }   }      /* FIXME: Ought to use parent pointer to avoid recursion. */   struct pike_string *find_return_type(node *n)   {    struct pike_string *a,*b;       check_tree(n,0);    +  fatal_check_c_stack(16384); +     if(!n) return 0;       if (n->token == F_RETURN) {    if (CAR(n)) {    if (CAR(n)->type) {    copy_shared_string(a, CAR(n)->type);    } else {   #ifdef PIKE_DEBUG    if (l_flag > 2) {    fprintf(stderr, "Return with untyped argument.\n");
pike.git/src/las.c:565:   #endif /* SHARED_NODES */   #endif /* PIKE_DEBUG */      #ifdef SHARED_NODES    if (dmalloc_touch(node *, n) && --(n->refs)) {    return;    }    sub_node(dmalloc_touch(node *, n));   #endif /* SHARED_NODES */    +  fatal_check_c_stack(16384); +     switch(n->token)    {    case USHRT_MAX:    fatal("Freeing node again!\n");    break;       case F_CONSTANT:    free_svalue(&(n->u.sval));    break;   
pike.git/src/las.c:1484:   /* FIXME: Ought to use parent pointer to avoid recursion. */   int node_is_eq(node *a,node *b)   {    check_tree(a,0);    check_tree(b,0);       if(a == b) return 1;    if(!a || !b) return 0;    if(a->token != b->token) return 0;    +  fatal_check_c_stack(16384); +     switch(a->token)    {    case F_LOCAL:    return a->u.integer.a == b->u.integer.a &&    a->u.integer.b == b->u.integer.b;       case F_IDENTIFIER:    case F_TRAMPOLINE: /* FIXME, the context has to be the same! */    return a->u.id.number == b->u.id.number;   
pike.git/src/las.c:1634: Inside #if 1 /* DEAD_CODE - I need this /Hubbe */
   *b=*n;    copy_shared_string(b->type, n->type);    return b;       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");       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;
pike.git/src/las.c:1747:    if(!n) return 0;    if(!n->type) return 1;    return type_may_overload(n->type->str, lfun);   }      /* FIXME: Ought to use parent pointer to avoid recursion. */   node **last_cmd(node **a)   {    node **n;    if(!a || !*a) return (node **)NULL; +  +  fatal_check_c_stack(16384); +     if(((*a)->token == F_CAST) ||    ((*a)->token == F_SOFT_CAST) ||    ((*a)->token == F_POP_VALUE)) return last_cmd(&_CAR(*a));    if(((*a)->token != F_ARG_LIST) &&    ((*a)->token != F_COMMA_EXPR)) return a;    if(CDR(*a))    {    if(CDR(*a)->token != F_CAST &&    CDR(*a)->token != F_SOFT_CAST &&    CDR(*a)->token != F_POP_VALUE &&
pike.git/src/las.c:1789:   {    node **n;    if (!a[0]) return NULL;    if(a[0]->token != F_ARG_LIST)    {    if(!(*nr)--)    return a;    else    return NULL;    } +  +  fatal_check_c_stack(16384); +     if(CAR(*a))    if((n=low_get_arg(&_CAR(*a),nr)))    return n;       if(CDR(*a))    if((n=low_get_arg(&_CDR(*a),nr)))    return n;       return 0;   }
pike.git/src/las.c:1826:         /* FIXME: Ought to use parent pointer to avoid recursion. */   static void low_print_tree(node *foo,int needlval)   {    if(!foo) return;    if(l_flag>9)    {    fprintf(stderr, "/*%x*/",foo->tree_info);    } +  +  fatal_check_c_stack(16384); +     switch(l_flag > 99 ? -1 : foo->token)    {    case USHRT_MAX:    fprintf(stderr, "FREED_NODE");    break;    case F_LOCAL:    if(needlval) fputc('&', stderr);    if(foo->u.integer.b)    {    fprintf(stderr, "$<%ld>%ld",(long)foo->u.integer.b,(long)foo->u.integer.a);
pike.git/src/las.c:2214:   /* Find the variables that are used in the tree n. */   static int find_used_variables(node *n,    struct used_vars *p,    int noblock,    int overwrite)   {    struct used_vars *a;    char *q;       if(!n) return 0; +  +  fatal_check_c_stack(16384); +     switch(n->token)    {    case F_LOCAL:    q = find_q(&(p->locals), n->u.integer.a, n->u.integer.b);   #ifdef PIKE_DEBUG    if (l_flag > 2) {    fprintf(stderr, "local %d:%d is ",    n->u.integer.b, n->u.integer.a);    }   #endif /* PIKE_DEBUG */
pike.git/src/las.c:2338:   }      /* FIXME: Ought to use parent pointer to avoid recursion. */   /* no subtility needed */   static void find_written_vars(node *n,    struct used_vars *p,    int lvalue)   {    if(!n) return;    +  fatal_check_c_stack(16384); +     switch(n->token)    {    case F_LOCAL:    if(lvalue) {   #ifdef PIKE_DEBUG    if (l_flag > 2) {    fprintf(stderr, "local %d:%d is written\n",    n->u.integer.b, n->u.integer.a);    }   #endif /* PIKE_DEBUG */
pike.git/src/las.c:2624:    case F_FOREACH:    case F_INC_NEQ_LOOP:    case F_DEC_NEQ_LOOP:    case F_INC_LOOP:    case F_DEC_LOOP: return 0;       case F_COMMA_EXPR:    case F_VAL_LVAL:    case F_LVALUE_LIST:    case F_ARG_LIST: +  +  fatal_check_c_stack(16384); +     return cntargs(CAR(n))+cntargs(CDR(n));       /* this might not be true, but it doesn't matter very much */    default: return 1;    }   }      static int function_type_max=0;      /* FIXME: Ought to use parent pointer to avoid recursion. */
pike.git/src/las.c:2656:    push_type(T_VOID);    push_type(T_OR); /* varargs */       push_type(T_MANY);    return;    }    switch(n->token)    {    case F_COMMA_EXPR:    case F_ARG_LIST: +  fatal_check_c_stack(16384); +     low_build_function_type(CDR(n));    low_build_function_type(CAR(n));    break;       case F_PUSH_ARRAY: /* We let this ruin type-checking for now.. */    reset_type_stack();       push_type(T_MIXED);    push_type(T_VOID);    push_type(T_OR); /* return type is void or mixed */
pike.git/src/las.c:3247:    check_type_string(n->type);   #endif /* PIKE_DEBUG */   }      /* FIXME: Ought to use parent pointer to avoid recursion. */   static void zapp_try_optimize(node *n)   {    if(!n) return;    n->node_info &=~ OPT_TRY_OPTIMIZE;    n->tree_info &=~ OPT_TRY_OPTIMIZE; +  +  fatal_check_c_stack(16384); +     if(car_is_node(n)) zapp_try_optimize(CAR(n));    if(cdr_is_node(n)) zapp_try_optimize(CDR(n));   }      #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,    const unsigned char *break_u,    const unsigned char *catch_u)   {    if (!n)    return;    -  +  fatal_check_c_stack(16384); +     switch(n->token) {    case F_ASSIGN:    if ((CDR(n)->token == F_LOCAL) && (!CDR(n)->u.integer.b)) {    usage[CDR(n)->u.integer.a] = 0;    } else if (CDR(n)->token == F_ARRAY_LVALUE) {    find_usage(CDR(n), usage, switch_u, cont_u, break_u, catch_u);    }    find_usage(CAR(n), usage, switch_u, cont_u, break_u, catch_u);    return;   
pike.git/src/las.c:4354:    }    return dmalloc_touch(node *, n);   }      INT32 last_function_opt_info;      /* FIXME: Ought to use parent pointer to avoid recursion. */   static int stupid_args(node *n, int expected,int vargs)   {    if(!n) return expected; +  +  fatal_check_c_stack(16384); +     switch(n->token)    {    case F_PUSH_ARRAY:    if(!vargs) return -1;       if(stupid_args(CAR(n), expected,vargs) == expected+1)    return 65535;    return -1;       case F_ARG_LIST:
pike.git/src/las.c:4378:    return (!n->u.integer.b && n->u.integer.a==expected) ? expected + 1 : -1;    default:    return -1;    }   }      /* FIXME: Ought to use parent pointer to avoid recursion. */   static int is_null_branch(node *n)   {    if(!n) return 1; +  +  fatal_check_c_stack(16384); +     if((n->token==F_CAST && n->type==void_type_string) ||    n->token == F_POP_VALUE)    return is_null_branch(CAR(n));    if(n->token==F_ARG_LIST)    return is_null_branch(CAR(n)) && is_null_branch(CDR(n));    return 0;   }      static struct svalue *is_stupid_func(node *n,    int args,