[m-rev.] for review: convert lco.m, and dumping out goals, to use var_tables

Julien Fischer jfischer at opturion.com
Sun Apr 17 21:16:57 AEST 2022

On Sun, 17 Apr 2022, Zoltan Somogyi wrote:

> Use var_tables in lco.m, and when dumping goals.
> Since this is the first converted module that dumps out goals when
> debugging trace flags are enabled, this required generalizing the code
> that does that, to take either varsets or var_tables as a means of
> specifying the names of variables. We do this via a new type,
> var_name_source, which contains either a varset or a var_table.
> Almost all of this diff is there to implement this generalization.
> A large part of it affects code in the parse_tree package that we use
> to write out the parts of HLDS goals that are defined by types defined
> in that package. Since we want to avoid making any part of the parse_tree
> package dependent on the hlds package, this required defining the
> var_name_source type in the parse_tree package, which in turn requires
> var_table.m to be in that same package.


> compiler/parse_tree_out_term.m:
>     Provide variants of some existing predicates and functions that take
>     var_name_sources instead of varsets. The code of the copies
>     duplicates the logic of the originals, though I hope that this
>     duplication can be done away with at the end of the transition.
>     (The best solution would be too use a typeclass with methods


>     that convert vars to their names, but we would want to ensure
>     that the compiler can specialize all the affected predicates
>     and functions to the two instances of this typeclass, which is
>     something that we cannot do yet. In the meantime, the lack of
>     any generalization in the old versions preserves their performance.)


That looks fine.


More information about the reviews mailing list