pike.git / src / pike_types.cmod

version» Context lines:

pike.git/src/pike_types.cmod:4013:    SET_SVAL(val, T_TYPE, 0, type, value);    } else {    SET_SVAL(val, T_INT, NUMBER_NUMBER, integer, 0);    }    mapping_insert(remap->markers, &key, &val);   }   #define store_marker(REMAP, M, T) store_marker(REMAP, M, debug_malloc_pass(T))      /**    * Copy marker assignments from remap->markers to -  * their corresponding T_ASSIGN nodes. +  * their corresponding T_ASSIGN nodes (aka backpatch).    *    * Leave the result on the type stack.    */   static void push_and_fixup_markers(struct pike_type *t,    struct remap_state *remap)   {    if (!t || !(t->flags & PT_FLAG_ASSIGN) || !remap || !remap->markers) {    /* Type t does not contain any marker assignments,    * or the remap state has no markers set.    */
pike.git/src/pike_types.cmod:4035:    return;    }    /* NB: Many of the cases in the switch below are unreached    * as they never contain a T_ASSIGN and thus are    * handled by the PT_FLAG_ASSIGN test above.    */    switch(t->type & (0x8000 | PIKE_T_MASK)) {    case T_ASSIGN:    {    int marker = '0' + CAR_TO_INT(t); -  struct pike_type *t2 = lookup_marker(remap, marker); +  struct pike_type *t2 = lookup_marker(remap, marker | 0x100);    push_finished_type(t2);    push_assign_type(marker);    free_type(t2);    }    break;       case PIKE_T_NAME:    push_and_fixup_markers(t->cdr, remap);    push_type_name((struct pike_string *)(t->car));    break;
pike.git/src/pike_types.cmod:4625:    } else {    return NULL;    }    }       /* First check for markers. */    switch(a?a->type:PIKE_T_UNKNOWN) {    case T_ASSIGN:    {    int marker; -  tmp = low_type_binop(op, a->cdr, b, remap, aflags, bflags, remap_flags); -  if (!tmp) return NULL; +  tmp = low_type_binop(PT_BINOP_AND, a->cdr, b, remap, +  aflags, bflags, remap_flags); +     marker = alloc_remap_marker(remap, CAR_TO_INT(a), remap_flags);    store_marker(remap, marker, tmp); -  +  +  if (op != PT_BINOP_AND) { +  if ((op == PT_BINOP_MINUS) && !tmp) { +  tmp = a->cdr; +  if (tmp) add_ref(tmp); +  } else if ((op == PT_BINOP_MINUS) && (tmp == a->cdr)) { +  free_type(tmp); +  tmp = NULL; +  } else { +  free_type(tmp); +  tmp = low_type_binop(op, a->cdr, b, remap, +  aflags, bflags, remap_flags); +  } +  } +  +  store_marker(remap, marker | 0x100, tmp); +  +  if (!tmp) return NULL; +     type_stack_mark();    push_finished_type(tmp);    push_assign_type(marker);    free_type(tmp);    return pop_unfinished_type();    }    }    switch(b?b->type:PIKE_T_UNKNOWN) {    case T_ASSIGN:    {    int marker; -  tmp = low_type_binop(op, a, b->cdr, remap, aflags, bflags, remap_flags); -  if (!tmp) return NULL; +  tmp = low_type_binop(PT_BINOP_AND, a, b->cdr, remap, +  aflags, bflags, remap_flags); +     marker = alloc_remap_marker(remap, CAR_TO_INT(b),    remap_flags ^ PT_FLAG_REMAP_SWAP_MARKERS);    store_marker(remap, marker, tmp); -  +  +  if (op != PT_BINOP_AND) { +  if ((op == PT_BINOP_MINUS) && !tmp) { +  tmp = a; +  if (tmp) add_ref(tmp); +  } else if ((op == PT_BINOP_MINUS) && (tmp == a)) { +  free_type(tmp); +  tmp = NULL; +  } else { +  free_type(tmp); +  tmp = low_type_binop(op, a, b->cdr, remap, +  aflags, bflags, remap_flags); +  } +  } +  +  store_marker(remap, marker | 0x100, tmp); +  +  if (!tmp) return NULL; +     type_stack_mark();    push_finished_type(tmp);    push_assign_type(marker);    free_type(tmp);    return pop_unfinished_type();    }    }       /* Attributes and names. */    switch(a?a->type:PIKE_T_UNKNOWN) {
pike.git/src/pike_types.cmod:5038:       a = lookup_marker(remap, marker);       if (!a) break;       tmp = low_type_binop(op, a, b, remap, aflags, bflags, remap_flags);       free_type(a);       store_marker(remap, marker, tmp); -  -  if (!tmp) { -  a = NULL; -  break; +  if ((op == PT_BINOP_AND) || (op == PT_BINOP_MINUS)) { +  store_marker(remap, marker | 0x100, tmp);    } -  +  +  if (!tmp) return NULL;    free_type(tmp);       type_stack_mark();    push_type(marker);    return pop_unfinished_type();    }    }    switch(b ? b->type : PIKE_T_UNKNOWN) {    case '0': case '1': case '2': case '3': case '4':    case '5': case '6': case '7': case '8': case '9':
pike.git/src/pike_types.cmod:5069:    }       b = lookup_marker(remap, marker);       if (!b) break;       tmp = low_type_binop(op, a, b, remap, aflags, bflags, remap_flags);       free_type(b);    +  /* FIXME: Do we need to invert for PT_BINOP_MINUS here? */    store_marker(remap, marker, tmp); -  -  if (!tmp) { -  b = NULL; -  break; +  if (op == PT_BINOP_AND) { +  store_marker(remap, marker | 0x100, tmp);    } -  +  +  if (!tmp) return NULL;    free_type(tmp);       type_stack_mark();    push_type(marker);    return pop_unfinished_type();    }    }       /* Handle a or b being NULL. */    /* NB: We know that a != b due to an earlier test. */