pike.git / src / pike_types.cmod

version» Context lines:

pike.git/src/pike_types.cmod:4185:    *    * Note:    * There are two major operating modes; the external, where    * the two types have unrelated markers, which then need to    * be remapped in the result, and the internal, where the    * two types have related markers (this mode is used mainly    * when evaluating a type).    *    * The internal mode is indicated via the remap state being NULL.    */ + static struct pike_type *lower_type_binop(enum pt_binop op, +  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);   static struct pike_type *low_type_binop(enum pt_binop op,    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)   { -  struct pike_type *tmp, *tmp2, *ret; -  struct pike_type *aret = NULL, *bret = NULL; -  enum pt_cmp_flags avoidable; -  enum pt_cmp_flags bvoidable; + #ifdef DEBUG_MALLOC + #define low_type_binop(OP, A, B, REMAP, AFLAGS, BFLAGS, REMAP_FLAGS) \ +  ((struct pike_type *) \ +  debug_malloc_pass(low_type_binop(OP, debug_malloc_pass(A), \ +  debug_malloc_pass(B), \ +  debug_malloc_pass(REMAP), \ +  AFLAGS, BFLAGS, REMAP_FLAGS))) + #endif /* DEBUG_MALLOC */ + #ifdef PIKE_DEBUG +  struct pike_type **save_type_stackp = Pike_compiler->type_stackp; +  struct pike_type ***save_mark_stackp = Pike_compiler->pike_type_mark_stackp; + #endif +  struct pike_type *ret;    -  recur: +     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);    }    -  +  ret = lower_type_binop(op, a, b, remap, +  aflags, bflags, remap_flags); +  +  if (remap_flags & PT_FLAG_REMAP_TRACE) { +  fprintf(stderr, "ret: "); +  simple_describe_type(ret); +  fprintf(stderr, "\n"); +  } +  + #ifdef PIKE_DEBUG +  if ((save_type_stackp != Pike_compiler->type_stackp) || +  (save_mark_stackp != Pike_compiler->pike_type_mark_stackp)) { +  fprintf(stderr, "low_type_binop stack level corruption!\n" +  "op : 0x%x\na: ", op); +  simple_describe_type(a); +  fprintf(stderr, "\nb: "); +  simple_describe_type(b); +  fprintf(stderr, "\nret: "); +  simple_describe_type(ret); +  fprintf(stderr, "\n\n"); +  +  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); +  } + #endif +  +  return ret; + } + static struct pike_type *lower_type_binop(enum pt_binop op, +  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) + { +  struct pike_type *tmp, *tmp2, *ret; +  struct pike_type *aret = NULL, *bret = NULL; +  enum pt_cmp_flags avoidable; +  enum pt_cmp_flags bvoidable; +  +  recur:    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;