[m-rev.] for review: restructure prog_mutable.m

Julien Fischer jfischer at opturion.com
Sat May 29 20:24:03 AEST 2021


On Fri, 28 May 2021, Zoltan Somogyi wrote:

> For review by anyone.

...

> Simplify the logic of prog_mutable.m.
> 
> compiler/prog_mutable.m:
>     The old logic was complicated by the need to have some decisions
>     made by prog_mutable.m and some by add_mutable_aux_preds.m,
>     which had different tasks (generating public declarations
>     vs generating both public and private definitions), and thus
>     used different approaches.
>
>     Replace this with code in which for each kind of auxiliary predicate,
>     the code to generate its declaration is just before the code
>     to generate its definition. And the code that decides what public
>     declarations to generate is just before the code that decides
>     what public and private definitions to generate.
>
>     Make this latter logic operate as directly as possible on the mutable's
>     attributes, instead of first calling a separate predicate to compute
>     the set of auxiliary predicates the mutable needs, recording the results
>     in the mutable_target_params structure, and then generating definitions
>     as directed by this structure.
>
>     To make this possible, split some existing predicates that used
>     to do two related but nevertheless separate jobs, such as defining
>     get and set predicates for both constant and nonconstant mutables.
>
>     Give a bunch of predicates names that better reflect whether they
>     generate declarations only, definitions only, or both.
>
>     Consistently refer to the name of them mutable as MutableName,

s/them/the/

>     since the code handles the names of other kinds of things as well.
>
>     Give some predicates slightly shorter names, so calls to them
>     fit on just one line.
> 
> compiler/prog_item.m:
>     Change the arg type of a function based on the updated needs of
>     prog_mutable.m.
> 
> compiler/add_mutable_aux_preds.m:
> compiler/comp_unit_interface.m:
>     Conform to the changes above.

The diff looks fine.

Julien.


More information about the reviews mailing list