[m-rev.] for preliminary review: bug 493 & 532 alterative fix

Peter Wang novalazy at gmail.com
Fri May 14 17:18:42 AEST 2021


On Fri, 14 May 2021 16:59:44 +1000 "Zoltan Somogyi" <zoltan.somogyi at runbox.com> wrote:
> 
> 2021-05-14 16:40 GMT+10:00 "Peter Wang" <novalazy at gmail.com>:
> > (row 4 and row 5 are identical)
> 
> That is not supposed to happen. Unfortunately, I know that
> two ground terms that have identical representations nevertheless
> do not share a row because they are of different types, and the
> code that does lookups used to use the type as part of the key.
> However, I thought I fixed that years ago.
> 
> > Anyway, common.m is too eager to replace V = (integer) with V = Base.
> 
> I thought the check on line 462 in common.m would prevent that.
> It should be moved earlier in the test chain, but it should work.
> Are you saying it doesn't? And if so, do you know why?

My bad. This part:

    ArgVars = [],
    % Constants don't use memory, so there is no point in
    % optimizing away their construction; in fact, doing so
    % could cause more stack usage.
    GoalExpr = GoalExpr0,
    GoalInfo = GoalInfo0

does leave V = (integer) alone.

Before that, though, it establishes the equivalence V = Base:

    eqvclass.ensure_equivalence(Var, OldVar, VarEqv1, VarEqv),
    !Common·var_eqv := VarEqv,

which causes a following closure construction:

    Pred = accumulate_negative_int(V)

to be replaced with:

    Pred = accumulate_negative_int(Base)

Peter


More information about the reviews mailing list