pike.git / src / pike_types.cmod

version» Context lines:

pike.git/src/pike_types.cmod:4045:   /**    * Remap markers (if any) in the type.    */   static struct pike_type *remap_markers(struct pike_type *t,    struct mapping *markers,    struct remap_state *remap,    enum pt_remap_flags flags)   {    if (!t) return NULL;    +  if (flags & PT_FLAG_REMAP_TRACE) { +  fprintf(stderr, "remap_markers("); +  simple_describe_type(t); +  fprintf(stderr, ", "); +  simple_describe_mapping(markers); +  fprintf(stderr, ", %p, 0x%02x)\n", remap, flags); +  } +     type_stack_mark();    push_remap_markers(t, markers, remap, flags); -  +  +  if (flags & PT_FLAG_REMAP_TRACE) { +  fprintf(stderr, "remap ==> "); +  simple_describe_type(peek_type_stack()); +  fprintf(stderr, "\n"); +  }    return pop_unfinished_type();   }      static struct pike_type *low_intersect_types(struct pike_type *a,    struct pike_type *b,    struct remap_state *remap,    enum pt_cmp_flags aflags,    enum pt_cmp_flags bflags,    enum pt_remap_flags remap_flags);   
pike.git/src/pike_types.cmod:4171:    struct remap_state *remap,    enum pt_cmp_flags aflags,    enum pt_cmp_flags bflags,    enum pt_remap_flags remap_flags)   {    struct pike_type *tmp, *tmp2, *ret;    struct pike_type *aret = NULL, *bret = NULL;    enum pt_cmp_flags avoidable;    enum pt_cmp_flags bvoidable;    +  if (remap_flags & PT_FLAG_REMAP_TRACE) { +  fprintf(stderr, "low_type_binop(0x%04x, ", op); +  simple_describe_type(a); +  fprintf(stderr, ", "); +  simple_describe_type(b); +  fprintf(stderr, ", %p, 0x%04x, 0x%04x, 0x%02x)\n", +  remap, aflags, bflags, remap_flags); +  } +     switch(op) {    case PT_BINOP_AND:    case PT_BINOP_MINUS:    break;    case PT_BINOP_INVERSE_MINUS:    tmp = a;    a = b;    b = tmp;    avoidable = aflags;    aflags = bflags;
pike.git/src/pike_types.cmod:4545:       /* NB: The MANY argument is always voidable. */    if (ai->type == T_MANY) avoidable |= PT_FLAG_CMP_VOIDABLE;    if (bi->type == T_MANY) bvoidable |= PT_FLAG_CMP_VOIDABLE;       tmp = low_type_binop(op, ai->car, bi->car, remap,    aflags | avoidable,    bflags | bvoidable,    remap_flags);    +  if (remap_flags & PT_FLAG_REMAP_TRACE) { +  fprintf(stderr, "got_empty: %d, got_full: %d\n" +  "tmp: ", +  got_empty, got_full); +  simple_describe_type(tmp); +  fprintf(stderr, "\n"); +  } +     switch(op) {    case PT_BINOP_AND:    if (!tmp) {    if (avoidable && bvoidable) {    /* NB: The VOIDABLE flag only affects comparisons with    * explicit void. If both arguments have implicit void,    * and nothing other in common, we arrive here.    */    push_type(T_VOID);    } else {
pike.git/src/pike_types.cmod:4571:       if (avoidable && bvoidable) {    /* Time to check the return types. */       if (!aret) aret = ai->cdr;    if (!bret) bret = bi->cdr;       tmp = low_type_binop(op, aret, bret, remap,    aflags | PT_FLAG_CMP_VOIDABLE,    bflags | PT_FLAG_CMP_VOIDABLE, remap_flags); +  +  if (remap_flags & PT_FLAG_REMAP_TRACE) { +  fprintf(stderr, "ret_tmp: "); +  simple_describe_type(tmp); +  fprintf(stderr, "\n"); +  }    if (!tmp) goto function_fail;       nargs = pop_stack_mark();       push_finished_type(tmp);    free_type(tmp);       nargs--;    push_reverse_type(T_MANY);   
pike.git/src/pike_types.cmod:4608:    free_type(tmp);    if (got_empty) goto function_next;    }       if (avoidable && bvoidable) {    /* Time to check the return types. */       if (!aret) aret = ai->cdr;    if (!bret) bret = bi->cdr;    +  /* NB: Ignore the return type if matching against void. */    tmp = low_type_binop(op, aret, bret, NULL,    aflags | PT_FLAG_CMP_VOIDABLE,    bflags | PT_FLAG_CMP_VOIDABLE, remap_flags); -  +  +  if (remap_flags & PT_FLAG_REMAP_TRACE) { +  fprintf(stderr, "got_empty: %d, got_full: %d\n" +  "ret tmp: ", +  got_empty, got_full); +  simple_describe_type(tmp); +  fprintf(stderr, "\n"); +  } +     if (!tmp) {    if (got_full) goto function_next;    got_empty = 1;    } else {    if (tmp == aret) {    got_full = 1;    } else {    free_type(tmp);    goto function_next;    }
pike.git/src/pike_types.cmod:8573:    tmp2 = remap_markers(tmp, markers, NULL, PT_FLAG_REMAP_EVAL_MARKERS);   #endif       clear_markers();    res = low_pike_types_le(a, b, 0, 0);      #ifdef PIKE_DEBUG    if ((save_type_stackp != Pike_compiler->type_stackp) ||    (save_mark_stackp != Pike_compiler->pike_type_mark_stackp) ||    (res != !tmp2)) { +  struct pike_type *tmp3; +     fprintf(stderr, "pike_types_le mismatch!\n"    "a: ");    simple_describe_type(a);    fprintf(stderr, "\nb: ");    simple_describe_type(b);    fprintf(stderr, "\nres: %d\ntmp: ", res);    simple_describe_type(tmp);    fprintf(stderr, "\ntmp2: ");    simple_describe_type(tmp2);    fprintf(stderr, "\n\n"); -  +  +  tmp3 = low_type_binop(PT_BINOP_MINUS, a, b, &remap, +  0, 0, PT_FLAG_REMAP_TRACE); +  fprintf(stderr, "tmp3: "); +  simple_describe_type(tmp3); +  fprintf(stderr, "\n\n"); +     if ((save_type_stackp != Pike_compiler->type_stackp) ||    (save_mark_stackp != Pike_compiler->pike_type_mark_stackp)) {    Pike_fatal("Stack level corruption!\n"    "type stack: %p (expected: %p)\n"    "mark stack: %p (expected: %p)\n",    Pike_compiler->type_stackp, save_type_stackp,    Pike_compiler->pike_type_mark_stackp, save_mark_stackp);    } -  +  +  free_type(tmp3);    }       free_type(tmp);    free_type(tmp2);    free_mapping(markers);   #endif       return res;   }