[m-rev.] [reuse] for review: move type definitions to prog_data
Nancy Mazur
Nancy.Mazur at cs.kuleuven.ac.be
Thu Jun 10 22:23:32 AEST 2004
Zoltan Somogyi wrote:
> 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.
Okay, I've removed them in this file. I will remove them in the
{pa,sr}_* modules whenever I encounter them.
>>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"?
I will do that in a separate commit though. I have no idea why I chose
the obfuscated terms instead of the evident ones ;-)
> This section should refer readers to your thesis for documentation.
done.
>
>
>>+:- 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.
I removed them.
I also changed "us" to "ns" for "normal selector".
>>+:- 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.
done.
>>+:- 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.
I've documented the other types too.
In attach I'm sending the diff for the prog_data.m file. Can I commit it?
Nancy
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: zzdiff.prog_data
URL: <http://lists.mercurylang.org/archives/reviews/attachments/20040610/bdd9fcda/attachment.ksh>
More information about the reviews
mailing list