Branch: Tag:

2021-12-30

2021-12-30 09:31:47 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler [Typechecker]: Add PT_FLAG_REMAP_INEXACT.

This flag causes type_binop() to cheat a bit, and is useful if
its result is only going to be used to compare against NULL.
This speeds up pike_types_le() quite a bit for some cases.

4586:    aflags, bflags, remap_flags);    if (!tmp2) return tmp;    -  ret = low_type_binop(PT_BINOP_MINUS, tmp, tmp2, NULL, 0, 0, 0); +  ret = low_type_binop(PT_BINOP_MINUS, tmp, tmp2, NULL, 0, 0, +  remap_flags & PT_FLAG_REMAP_INEXACT);    free_type(tmp);    free_type(tmp2);    return ret;
4601:    aflags, bflags, remap_flags);    if (!tmp2) return tmp;    -  ret = low_type_binop(PT_BINOP_MINUS, tmp, tmp2, NULL, 0, 0, 0); +  ret = low_type_binop(PT_BINOP_MINUS, tmp, tmp2, NULL, 0, 0, +  remap_flags & PT_FLAG_REMAP_INEXACT);    free_type(tmp);    free_type(tmp2);    return ret;
4735:    remap->markers = copy_mapping(orig_markers);    }    tmp = low_type_binop(op, a->car, b, remap, aflags, bflags, remap_flags); +  if ((remap_flags & PT_FLAG_REMAP_INEXACT) && tmp) { +  if ((op == PT_BINOP_AND) || (op == PT_BINOP_MINUS)) { +  free_type(tmp); +  add_ref(a); +  return a; +  } +  }    if (remap) {    do_free_mapping(remap->markers);    remap->markers = copy_mapping(orig_markers);
4833:    }       tmp = low_type_binop(op, a, b->car, remap, aflags, bflags, remap_flags); +  if ((remap_flags & PT_FLAG_REMAP_INEXACT) && tmp) { +  if (op == PT_BINOP_AND) { +  free_type(tmp); +  add_ref(a); +  return a; +  } +  }    if (remap) {    do_free_mapping(remap->markers);    remap->markers = copy_mapping(orig_markers);
9457:       INIT_REMAP_STATE(remap);    -  tmp = low_type_binop(PT_BINOP_MINUS, a, b, &remap, aflags, bflags, 0); +  tmp = low_type_binop(PT_BINOP_MINUS, a, b, &remap, aflags, bflags, +  PT_FLAG_REMAP_INEXACT);       if (tmp) {    clear_mapping(remap.markers);