pike.git / src / las.c

version» Context lines:

pike.git/src/las.c:672:         /* here starts routines to make nodes */   static node *debug_mkemptynode(void)   {    node *res=alloc_node_s();       CHECK_COMPILER();      #ifdef __CHECKER__ -  MEMSET(res, 0, sizeof(node)); +  memset(res, 0, sizeof(node));   #endif /* __CHECKER__ */       res->refs = 0;    add_ref(res); /* For DMALLOC... */    res->token=0;    res->line_number=THIS_COMPILATION->lex.current_line;    copy_shared_string(res->current_file, THIS_COMPILATION->lex.current_file);    res->type=0;    res->name=0;    res->node_info=0;
pike.git/src/las.c:2439:    src = ret->locals;    while(src) {    struct scope_info *tmp = src->next;    free(src);    src = tmp;    }    free(ret);    Pike_error("Out of memory in copy_vars.\n");    return NULL; /* Make sure that the optimizer knows we exit here. */    } -  MEMCPY(*dst, src, sizeof(struct scope_info)); +  memcpy(*dst, src, sizeof(struct scope_info));    src = src->next;    dst = &((*dst)->next);    *dst = NULL;    }    src = a->externals;    dst = &(ret->externals);    *dst = NULL;    while (src) {    *dst = malloc(sizeof(struct scope_info));    if (!*dst) {
pike.git/src/las.c:2466:    src = ret->externals;    while(src) {    struct scope_info *tmp = src->next;    free(src);    src = tmp;    }    free(ret);    Pike_error("Out of memory in copy_vars.\n");    return NULL; /* Make sure that the optimizer knows we exit here. */    } -  MEMCPY(*dst, src, sizeof(struct scope_info)); +  memcpy(*dst, src, sizeof(struct scope_info));    src = src->next;    dst = &((*dst)->next);    *dst = NULL;    }       ret->err = a->err;    ret->ext_flags = a->ext_flags;    return ret;   }   
pike.git/src/las.c:2507:    }   #endif /* PIKE_DEBUG */    return (*a)->vars + num;    }   #ifdef PIKE_DEBUG    if (l_flag > 4) {    fputs("Creating new scope.\n", stderr);    }   #endif /* PIKE_DEBUG */    new = (struct scope_info *)xalloc(sizeof(struct scope_info)); -  MEMSET(new, VAR_UNUSED, sizeof(struct scope_info)); +  memset(new, VAR_UNUSED, sizeof(struct scope_info));    new->next = *a;    new->scope_id = scope_id;    *a = new;    return new->vars + num;   }      /* FIXME: Ought to use parent pointer to avoid recursion. */   /* Find the variables that are used in the tree n. */   /* noblock: Don't mark unused variables that are written to as blocked.    * overwrite: n is an lvalue that is overwritten.
pike.git/src/las.c:3974: Inside #if defined(SHARED_NODES) && 0
   find_usage(CADAR(n), usage, switch_u, cont_u, break_u, catch_u);    }    return;    }       case F_CATCH:    {    unsigned char catch_usage[MAX_LOCAL];    int i;    -  MEMCPY(catch_usage, usage, MAX_LOCAL); +  memcpy(catch_usage, usage, MAX_LOCAL);    find_usage(CAR(n), usage, switch_u, cont_u, catch_usage, catch_usage);    for(i=0; i < MAX_LOCAL; i++) {    usage[i] |= catch_usage[i];    }    return;    }       case F_AUTO_MAP:    case F_APPLY:    {
pike.git/src/las.c:4010: Inside #if defined(SHARED_NODES) && 0
   usage[CAR(n)->u.integer.a] = 0;    }    }    return;       case F_ARRAY_LVALUE:    find_usage(CAR(n), usage, switch_u, cont_u, break_u, catch_u);    return;       case F_CONTINUE: -  MEMCPY(usage, cont_u, MAX_LOCAL); +  memcpy(usage, cont_u, MAX_LOCAL);    return;       case F_BREAK: -  MEMCPY(usage, break_u, MAX_LOCAL); +  memcpy(usage, break_u, MAX_LOCAL);    return;       case F_DEFAULT:    case F_CASE:    case F_CASE_RANGE:    {    int i;       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);
pike.git/src/las.c:4037: Inside #if defined(SHARED_NODES) && 0
   }    return;    }       case F_SWITCH:    {    unsigned char break_usage[MAX_LOCAL];    unsigned char switch_usage[MAX_LOCAL];    int i;    -  MEMSET(switch_usage, 0, MAX_LOCAL); -  MEMCPY(break_usage, usage, MAX_LOCAL); +  memset(switch_usage, 0, MAX_LOCAL); +  memcpy(break_usage, usage, MAX_LOCAL);       find_usage(CDR(n), usage, switch_usage, cont_u, break_usage, catch_u);       for(i = 0; i < MAX_LOCAL; i++) {    usage[i] |= switch_usage[i];    }       find_usage(CAR(n), usage, switch_u, cont_u, break_u, catch_u);    return;    }       case F_RETURN: -  MEMSET(usage, 0, MAX_LOCAL); +  memset(usage, 0, MAX_LOCAL);    /* FIXME: The function arguments should be marked "used", since    * they are seen in backtraces.    */    return;       case F_LOR:    case F_LAND:    {    unsigned char trail_usage[MAX_LOCAL];    int i;    -  MEMCPY(trail_usage, usage, MAX_LOCAL); +  memcpy(trail_usage, usage, MAX_LOCAL);       find_usage(CDR(n), usage, switch_u, cont_u, break_u, catch_u);       for(i=0; i < MAX_LOCAL; i++) {    usage[i] |= trail_usage[i];    }       find_usage(CAR(n), usage, switch_u, cont_u, break_u, catch_u);    return;    }       case '?':    {    unsigned char cadr_usage[MAX_LOCAL];    unsigned char cddr_usage[MAX_LOCAL];    int i;    -  MEMCPY(cadr_usage, usage, MAX_LOCAL); -  MEMCPY(cddr_usage, usage, MAX_LOCAL); +  memcpy(cadr_usage, usage, MAX_LOCAL); +  memcpy(cddr_usage, usage, MAX_LOCAL);       find_usage(CADR(n), cadr_usage, switch_u, cont_u, break_u, catch_u);    find_usage(CDDR(n), cddr_usage, switch_u, cont_u, break_u, catch_u);       for (i=0; i < MAX_LOCAL; i++) {    usage[i] = cadr_usage[i] | cddr_usage[i];    }    find_usage(CAR(n), usage, switch_u, cont_u, break_u, catch_u);    return;    }       case F_DO:    {    unsigned char break_usage[MAX_LOCAL];    unsigned char continue_usage[MAX_LOCAL];    -  MEMCPY(break_usage, usage, MAX_LOCAL); +  memcpy(break_usage, usage, MAX_LOCAL);       find_usage(CDR(n), usage, switch_u, cont_u, break_usage, catch_u);    -  MEMCPY(continue_usage, usage, MAX_LOCAL); +  memcpy(continue_usage, usage, MAX_LOCAL);       find_usage(CAR(n), usage, switch_u, break_usage, continue_usage,    catch_u);    return;    }       case F_FOR:    {    unsigned char loop_usage[MAX_LOCAL];    unsigned char break_usage[MAX_LOCAL];    unsigned char continue_usage[MAX_LOCAL];    int i;    -  MEMCPY(break_usage, usage, MAX_LOCAL); +  memcpy(break_usage, usage, MAX_LOCAL);       /* for(;a;b) c; is handled like:    *    * if (a) { do { c; b; } while(a); }    */    -  MEMSET(loop_usage, 0, MAX_LOCAL); +  memset(loop_usage, 0, MAX_LOCAL);       find_usage(CAR(n), loop_usage, switch_u, cont_u, break_u, catch_u);    if (CDR(n)) {    find_usage(CDDR(n), loop_usage, switch_u, cont_u, break_usage,    catch_u);    -  MEMCPY(continue_usage, loop_usage, MAX_LOCAL); +  memcpy(continue_usage, loop_usage, MAX_LOCAL);       find_usage(CADR(n), loop_usage, switch_u, continue_usage, break_usage,    catch_u);    }       for (i = 0; i < MAX_LOCAL; i++) {    usage[i] |= loop_usage[i];    }       find_usage(CAR(n), usage, switch_u, cont_u, break_u, catch_u);    return;    }       case F_FOREACH:    {    unsigned char loop_usage[MAX_LOCAL];    unsigned char break_usage[MAX_LOCAL];    unsigned char continue_usage[MAX_LOCAL];    int i;    -  MEMCPY(break_usage, usage, MAX_LOCAL); +  memcpy(break_usage, usage, MAX_LOCAL);       /* Find the usage from the loop */    -  MEMSET(loop_usage, 0, MAX_LOCAL); +  memset(loop_usage, 0, MAX_LOCAL);    -  MEMCPY(continue_usage, usage, MAX_LOCAL); +  memcpy(continue_usage, usage, MAX_LOCAL);       find_usage(CDR(n), loop_usage, switch_u, continue_usage, break_usage,    catch_u);    if (CDAR(n)->token == F_LOCAL) {    if (!(CDAR(n)->u.integer.b)) {    loop_usage[CDAR(n)->u.integer.a] = 0;    }    } else if (CDAR(n)->token == F_LVALUE_LIST) {    find_usage(CDAR(n), loop_usage, switch_u, cont_u, break_u, catch_u);    }
pike.git/src/las.c:4267: Inside #if defined(SHARED_NODES) && 0
   }    ADD_NODE_REF(n);    return n;    }       case F_CATCH:    {    unsigned char catch_usage[MAX_LOCAL];    int i;    -  MEMCPY(catch_usage, usage, MAX_LOCAL); +  memcpy(catch_usage, usage, MAX_LOCAL);    car = low_localopt(CAR(n), usage, switch_u, cont_u, catch_usage,    catch_usage);    for(i=0; i < MAX_LOCAL; i++) {    usage[i] |= catch_usage[i];    }    return mknode(F_CATCH, car, 0);    }    break;       case F_AUTO_MAP:
pike.git/src/las.c:4321: Inside #if defined(SHARED_NODES) && 0
      case F_CAST:    return mkcastnode(n->type, low_localopt(CAR(n), usage, switch_u, cont_u,    break_u, catch_u));       case F_SOFT_CAST:    return mksoftcastnode(n->type, low_localopt(CAR(n), usage, switch_u,    cont_u, break_u, catch_u));       case F_CONTINUE: -  MEMCPY(usage, cont_u, MAX_LOCAL); +  memcpy(usage, cont_u, MAX_LOCAL);    ADD_NODE_REF(n);    return n;       case F_BREAK: -  MEMCPY(usage, break_u, MAX_LOCAL); +  memcpy(usage, break_u, MAX_LOCAL);    ADD_NODE_REF(n);    return n;       case F_DEFAULT:    case F_CASE:    case F_CASE_RANGE:    {    int i;       cdr = low_localopt(CDR(n), usage, switch_u, cont_u, break_u, catch_u);
pike.git/src/las.c:4350: Inside #if defined(SHARED_NODES) && 0
   }    return mknode(n->token, car, cdr);    }       case F_SWITCH:    {    unsigned char break_usage[MAX_LOCAL];    unsigned char switch_usage[MAX_LOCAL];    int i;    -  MEMSET(switch_usage, 0, MAX_LOCAL); -  MEMCPY(break_usage, usage, MAX_LOCAL); +  memset(switch_usage, 0, MAX_LOCAL); +  memcpy(break_usage, usage, MAX_LOCAL);       cdr = low_localopt(CDR(n), usage, switch_usage, cont_u, break_usage,    catch_u);       for(i = 0; i < MAX_LOCAL; i++) {    usage[i] |= switch_usage[i];    }       car = low_localopt(CAR(n), usage, switch_u, cont_u, break_u, catch_u);    return mknode(F_SWITCH, car, cdr);    }       case F_RETURN: -  MEMSET(usage, 0, MAX_LOCAL); +  memset(usage, 0, MAX_LOCAL);    /* FIXME: The function arguments should be marked "used", since    * they are seen in backtraces.    */    return mknode(F_RETURN, low_localopt(CAR(n), usage, switch_u, cont_u,    break_u, catch_u), 0);       case F_LOR:    case F_LAND:    {    unsigned char trail_usage[MAX_LOCAL];    int i;    -  MEMCPY(trail_usage, usage, MAX_LOCAL); +  memcpy(trail_usage, usage, MAX_LOCAL);       cdr = low_localopt(CDR(n), usage, switch_u, cont_u, break_u, catch_u);       for(i=0; i < MAX_LOCAL; i++) {    usage[i] |= trail_usage[i];    }       car = low_localopt(CAR(n), usage, switch_u, cont_u, break_u, catch_u);       return mknode(n->token, car, cdr);    }       case '?':    {    unsigned char cadr_usage[MAX_LOCAL];    unsigned char cddr_usage[MAX_LOCAL];    int i;    -  MEMCPY(cadr_usage, usage, MAX_LOCAL); -  MEMCPY(cddr_usage, usage, MAX_LOCAL); +  memcpy(cadr_usage, usage, MAX_LOCAL); +  memcpy(cddr_usage, usage, MAX_LOCAL);       car = low_localopt(CADR(n), cadr_usage, switch_u, cont_u, break_u,    catch_u);    cdr = low_localopt(CDDR(n), cddr_usage, switch_u, cont_u, break_u,    catch_u);       for (i=0; i < MAX_LOCAL; i++) {    usage[i] = cadr_usage[i] | cddr_usage[i];    }    cdr = mknode(':', car, cdr);    car = low_localopt(CAR(n), usage, switch_u, cont_u, break_u, catch_u);    return mknode('?', car, cdr);    }       case F_DO:    {    unsigned char break_usage[MAX_LOCAL];    unsigned char continue_usage[MAX_LOCAL];    int i;    -  MEMCPY(break_usage, usage, MAX_LOCAL); +  memcpy(break_usage, usage, MAX_LOCAL);       /* Find the usage from the loop */    find_usage(CDR(n), usage, switch_u, cont_u, break_u, catch_u);    -  MEMCPY(continue_usage, usage, MAX_LOCAL); +  memcpy(continue_usage, usage, MAX_LOCAL);       find_usage(CAR(n), usage, switch_u, continue_usage, break_usage,    catch_u);       for (i = 0; i < MAX_LOCAL; i++) {    usage[i] |= break_usage[i];    }       cdr = low_localopt(CDR(n), usage, switch_u, cont_u, break_usage,    catch_u);    -  MEMCPY(continue_usage, usage, MAX_LOCAL); +  memcpy(continue_usage, usage, MAX_LOCAL);       car = low_localopt(CAR(n), usage, switch_u, continue_usage, break_usage,    catch_u);       return mknode(F_DO, car, cdr);    }       case F_FOR:    {    unsigned char loop_usage[MAX_LOCAL];    unsigned char break_usage[MAX_LOCAL];    unsigned char continue_usage[MAX_LOCAL];    int i;    -  MEMCPY(break_usage, usage, MAX_LOCAL); +  memcpy(break_usage, usage, MAX_LOCAL);       /*    * if (a A|B) {    * B    * do {    * B    * c;    * continue:    * D    * b;    * C    * } while (a A|B);    * A    * }    * break:    * A    */       /* Find the usage from the loop. */    -  MEMSET(loop_usage, 0, MAX_LOCAL); +  memset(loop_usage, 0, MAX_LOCAL);       find_usage(CAR(n), loop_usage, switch_u, cont_u, break_u, catch_u);    if (CDR(n)) {    find_usage(CDDR(n), loop_usage, switch_u, cont_u, break_usage,    catch_u);    -  MEMCPY(continue_usage, loop_usage, MAX_LOCAL); +  memcpy(continue_usage, loop_usage, MAX_LOCAL);       find_usage(CADR(n), loop_usage, switch_u, continue_usage, break_usage,    catch_u);    }       for (i = 0; i < MAX_LOCAL; i++) {    usage[i] |= loop_usage[i];    }       /* The last thing to be evaluated is the conditional */    car = low_localopt(CAR(n), usage, switch_u, cont_u, break_u, catch_u);       if (CDR(n)) {    node *cadr, *cddr;       /* The incrementor */    cddr = low_localopt(CDDR(n), usage, switch_u, cont_u, break_usage,    catch_u);    -  MEMCPY(continue_usage, usage, MAX_LOCAL); +  memcpy(continue_usage, usage, MAX_LOCAL);       /* The body */    cadr = low_localopt(CADR(n), usage, switch_u, continue_usage,    break_usage, catch_u);    cdr = mknode(':', cadr, cddr);    } else {    cdr = 0;    }       for (i = 0; i < MAX_LOCAL; i++) {
pike.git/src/las.c:4526: Inside #if defined(SHARED_NODES) && 0
   return mknode(F_FOR, car, cdr);    }       case F_FOREACH:    {    unsigned char loop_usage[MAX_LOCAL];    unsigned char break_usage[MAX_LOCAL];    unsigned char continue_usage[MAX_LOCAL];    int i;    -  MEMCPY(break_usage, usage, MAX_LOCAL); +  memcpy(break_usage, usage, MAX_LOCAL);       /*    * D    * arr = copy_value(arr);    * int i = 0;    * A|B    * while (i < sizeof(arr)) {    * B    * loopvar = arr[i];    * C    * body;    * continue:    * A|B    * }    * break:    * A    */       /* Find the usage from the loop */ -  MEMSET(loop_usage, 0, MAX_LOCAL); +  memset(loop_usage, 0, MAX_LOCAL);    -  MEMCPY(continue_usage, usage, MAX_LOCAL); +  memcpy(continue_usage, usage, MAX_LOCAL);       find_usage(CDR(n), loop_usage, switch_u, continue_usage, break_usage,    catch_u);    if (CDAR(n)->token == F_LOCAL) {    if (!(CDAR(n)->u.integer.b)) {    loop_usage[CDAR(n)->u.integer.a] = 0;    }    } else if (CDAR(n)->token == F_LVALUE_LIST) {    find_usage(CDAR(n), loop_usage, switch_u, cont_u, break_u, catch_u);    }       for (i = 0; i < MAX_LOCAL; i++) {    usage[i] |= loop_usage[i];    }    -  MEMCPY(continue_usage, usage, MAX_LOCAL); +  memcpy(continue_usage, usage, MAX_LOCAL);    cdr = low_localopt(CDR(n), usage, switch_u, continue_usage, break_usage,    catch_u);    if (CDAR(n)->token == F_LOCAL) {    if (!(CDAR(n)->u.integer.b)) {    usage[CDAR(n)->u.integer.a] = 0;    }    } else if (CDAR(n)->token == F_LVALUE_LIST) {    find_usage(CDAR(n), usage, switch_u, cont_u, break_u, catch_u);    }   
pike.git/src/las.c:4620: Inside #if defined(SHARED_NODES) && 0
     static node *localopt(node *n)   {    unsigned char usage[MAX_LOCAL];    unsigned char b_usage[MAX_LOCAL];    unsigned char c_usage[MAX_LOCAL];    unsigned char s_usage[MAX_LOCAL];    unsigned char catch_usage[MAX_LOCAL];    node *n2;    -  MEMSET(usage, 0, MAX_LOCAL); -  MEMSET(b_usage, 0, MAX_LOCAL); -  MEMSET(c_usage, 0, MAX_LOCAL); -  MEMSET(s_usage, 0, MAX_LOCAL); -  MEMSET(catch_usage, 0, MAX_LOCAL); +  memset(usage, 0, MAX_LOCAL); +  memset(b_usage, 0, MAX_LOCAL); +  memset(c_usage, 0, MAX_LOCAL); +  memset(s_usage, 0, MAX_LOCAL); +  memset(catch_usage, 0, MAX_LOCAL);       n2 = low_localopt(n, usage, s_usage, c_usage, b_usage, catch_usage);      #ifdef PIKE_DEBUG    if (l_flag > 0) {    if ((n2 != n) || (l_flag > 4)) {    fputs("\nBefore localopt: ", stderr);    print_tree(n);       fputs("After localopt: ", stderr);