[m-rev.] [reuse] for review: move type definitions to prog_data
Zoltan Somogyi
zs at cs.mu.OZ.AU
Thu Jun 10 17:36:39 AEST 2004
On 10-Jun-2004, Nancy Mazur <Nancy.Mazur at cs.kuleuven.ac.be> wrote:
> This is my plan for further adapting and improving the module dependencies of
> the alias and reuse modules:
The five step plan is fine.
> Index: hlds_pred.m
> ===================================================================
> RCS file: /home/mercury1/repository/mercury/compiler/hlds_pred.m,v
> retrieving revision 1.81.2.22
> diff -u -r1.81.2.22 hlds_pred.m
> --- hlds_pred.m 2 Jun 2004 10:30:38 -0000 1.81.2.22
> +++ hlds_pred.m 10 Jun 2004 05:23:09 -0000
> @@ -23,7 +23,7 @@
> :- import_module bool, list, set, map, std_util, term, varset.
> :- import_module possible_alias.
> :- import_module possible_alias__pa_alias_as.
> -:- import_module possible_alias__pa_datastruct.
> +% :- import_module possible_alias__pa_datastruct.
> :- import_module structure_reuse.
> :- import_module structure_reuse__sr_data.
>
> @@ -1812,11 +1812,11 @@
> :- mode proc_info_set_reuse_information(in, in, out) is det.
>
> :- pred proc_info_static_terms(proc_info,
> - maybe(set(pa_datastruct__datastruct))).
> + maybe(set(prog_data__datastruct))).
> :- mode proc_info_static_terms(in, out) is det.
If you didn't have the module qualifier on the type name, you wouldn't
have to update this. This we why usually omit module qualifiers on type names.
> Index: prog_data.m
> ===================================================================
> RCS file: /home/mercury1/repository/mercury/compiler/prog_data.m,v
> retrieving revision 1.58.2.16
> diff -u -r1.58.2.16 prog_data.m
> --- prog_data.m 2 Jun 2004 10:30:50 -0000 1.58.2.16
> +++ prog_data.m 10 Jun 2004 05:23:23 -0000
> @@ -22,6 +22,10 @@
> % Any types which are needed in both the parse tree and in the HLDS
> % should be defined here, rather than in hlds*.m.
>
> + % XXX temporary. Type "cons_id" needed for selector.
> +:- import_module hlds.
> +:- import_module hlds__hlds_data.
> +
> :- import_module (parse_tree__inst), libs__options, libs__globals.
> :- import_module recompilation.
> :- import_module bool, list, assoc_list, map, set, varset, term, std_util.
> @@ -429,6 +433,28 @@
> % possible inputs.
> ; can_loop. % This procedure might not terminate.
>
> +%
> +% Stuff for the 'pa_alias_info' and 'sr_reuse_info' pragma's.
> +%
It would be nice to find better names for those pragmas. What about simply
"possible_alias" and "structure_reuse"?
This section should refer readers to your thesis for documentation.
> +:- type selector == list(unit_sel).
> +:- type unit_sel
> + ---> us(hlds_data__cons_id, int) ; % normal selector
> + ts(prog_data__type). % type selector
You don't want to include the module qualifier in the type names
unless there is a possibility of a type with that name being defined
in mor than one module, which isn't the case in either type here.
> +:- type datastruct
> + ---> cel(
> + dsvar:: prog_var,
> + dsselector:: selector
> + ).
Again, it would be nicer to have better name for this type. How about
"selected_cell"? The field names would then become sc_var and sc_selector.
> +:- type alias == pair(datastruct).
> +:- type aliases == list(alias).
> +:- type reuse_tuple
> + ---> unconditional
> + ; conditional(
> + reuse_nodes :: set(datastruct),
> + live_headvars :: set(datastruct),
> + alias_headvars :: aliases
> + ).
Some documentation of the meanings of the fields would be nice.
Apart from the above, the diff is fine.
Zoltan.
--------------------------------------------------------------------------
mercury-reviews mailing list
post: mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the reviews
mailing list