[m-rev.] for review: preparing for CTGC system

Julien Fischer juliensf at cs.mu.OZ.AU
Mon Dec 5 16:01:51 AEDT 2005


On Fri, 2 Dec 2005, Nancy wrote:

>
> Hi,
>
> To get things started with the right foot, here a small diff for
> preparing the field for adding structure sharing analysis (as part of
> the CTGC system) into the main branch compiler.
>
> Some notes:
>
> 1. like Julien suggested, I've moved dead_procs to stage 192. The
> structure_sharing stage is 193, and the structure_reuse pass will then
> become 194.
>
> 2. I've added the ctgc files as submodules of the transform_hlds
> package. Which brings to the following hierarchy:
> 	transform_hlds.ctgc
> 	transform_hlds.ctgc.structure_sharing
> 	transform_hlds.ctgc.structure_sharing.analysis
> 	etc...
>
> 3. I presumed that "long" filenames are preferred over short ones, so I
> chose filenames reflecting the hierarchy above. Yet I didn't add the
> "transform_hlds" part to the filenames. It just seemed to become too
> long in that case.
>

There's no particularly policy on long vs. short filenames. I suggest
you may even want to omit the ctgc part from them as well.

> 4. For those who might have ever looked into the reuse-branch: I've
> replaced the terminology "possible alias" by "data structure sharing" or
> in short "structure sharing", conforming to the terminology used in my PhD.
>
> In attach the log + diff and new files...

It would be better if you didn't post the log and diffs as attachments

> Nancy
>
> Estimated hours taken: 1
> Branches: main
>
> Preparations for starting the CTGC implementation within the main branch.
>
> mercury_compile.m:
> options.m:
> top_level.m:
> transform_hlds.m:
>	Add the necessary entries for performing the structure sharing
>	analysis (as part of the CTGC system).
>

The lists of files should generally contain the directory as well.

e.g.

	compiler/mercury_compile.m:
	compiler/options.m:
	compiler/top_level.m:
	compiler/transform_hlds.m:
		Add the necessary entries for performing the structure sharing
		analysis (as part of the CTGC system).


etc.

> ctgc.m
> ctgc.structure_sharing.m
> ctgc.structure_sharing.analysis.m
>	New files.
>
Presumably there will be anohter package called `structure_reuse'?

> Index: mercury_compile.m
> ===================================================================
> RCS file: /home/mercury1/repository/mercury/compiler/mercury_compile.m,v
> retrieving revision 1.363
> diff -n -r1.363 mercury_compile.m
> a94 1
> :- import_module transform_hlds.ctgc.structure_sharing.analysis.
> d2395 1
> a2395 4
>   maybe_dump_hlds(!.HLDS, 192, "dead_procs", !DumpInfo, !IO),
>
>    maybe_data_structure_sharing_analysis(Verbose, Stats, !HLDS, !IO),
>    maybe_dump_hlds(!.HLDS, 193, "structure_sharing", !DumpInfo, !IO),
> a3692 18
>    ).
>
> :- pred maybe_data_structure_sharing_analysis(bool::in, bool::in,
>    module_info::in, module_info::out, io::di, io::uo) is det.
>
> maybe_data_structure_sharing_analysis(Verbose, Stats, !HLDS, !IO) :-
>    globals__io_lookup_bool_option(data_structure_sharing_analysis,
>         Sharing, !IO),
>    (
>        Sharing = yes,
>        maybe_write_string(Verbose, "% Data structure sharing analysis...\n",
>            !IO),
>        maybe_flush_output(Verbose, !IO),
>        % data_structure_sharing_analysis(!HLDS, !IO),

Although it doesn't (yet) do anything that would be better not commented
out - at least then we can make sure it compiles.

>        maybe_write_string(Verbose, "% done.\n", !IO),
>        maybe_report_stats(Stats, !IO)
>    ;
>        Sharing = no
> Index: options.m
> ===================================================================
> RCS file: /home/mercury1/repository/mercury/compiler/options.m,v
> retrieving revision 1.478
> diff -n -r1.478 options.m
> a511 1
>    ;       data_structure_sharing_analysis
> Index: top_level.m
> ===================================================================
> RCS file: /home/mercury1/repository/mercury/compiler/top_level.m,v
> retrieving revision 1.6
> diff -n -r1.6 top_level.m
> a21 2
> :- import_module transform_hlds.ctgc.
> :- import_module transform_hlds.ctgc.structure_sharing.
> Index: transform_hlds.m
> ===================================================================
> RCS file: /home/mercury1/repository/mercury/compiler/transform_hlds.m,v
> retrieving revision 1.20
> diff -n -r1.20 transform_hlds.m
> a43 3
> :- include_module transform_hlds.ctgc.
>   % :- include_module transform_hlds.ctgc.structure_sharing.

Why is this here?

> %-----------------------------------------------------------------------------%
> % Copyright (C) 2005 The University of Melbourne.
> % This file may only be copied under the terms of the GNU General
> % Public License - see the file COPYING in the Mercury distribution.
> %-----------------------------------------------------------------------------%
> %
> % File: ctgc.m
> % Main authors: nancy
> %
> % Package regrouping all the modules that are used for compile-time garbage

s/regrouping/grouping/ and below too.

> % collection.
> %
> %-----------------------------------------------------------------------------%
>
> :- module transform_hlds.ctgc.
>
> :- interface.
>
> :- include_module structure_sharing.
>
> :- end_module transform_hlds.ctgc.


> %-----------------------------------------------------------------------------%
> % Copyright (C) 2005 The University of Melbourne.
> % This file may only be copied under the terms of the GNU General
> % Public License - see the file COPYING in the Mercury distribution.
> %-----------------------------------------------------------------------------%
> %
> % File: structure_sharing.m
> % Main authors: nancy
> %
> % A package regrouping all the modules related to the data structure sharing
> % analysis needed for data structure reuse.
> %
> %-----------------------------------------------------------------------------%
>
> :- module transform_hlds.ctgc.structure_sharing.
>
> :- interface.
>
> :- include_module analysis.
>
> :- import_module hlds.
>
> :- end_module transform_hlds.ctgc.structure_sharing.

...

> %-----------------------------------------------------------------------------%
> % Copyright (C) 2005 The University of Melbourne.
> % This file may only be copied under the terms of the GNU General
> % Public License - see the file COPYING in the Mercury distribution.
> %-----------------------------------------------------------------------------%
> %
> % File: structure_sharing.analysis.m

That doesn't match the current name of this file - although as I suggested
it's a better name.

> % Main authors: nancy
> %
> % Implementation of the data structure analysis.
> %
> %-----------------------------------------------------------------------------%
>
> :- module transform_hlds.ctgc.structure_sharing.analysis.
>
> :- interface.
>
> :- import_module hlds__hlds_module.
>
> :- pred data_structure_sharing_analysis(module_info::in, module_info::out,
>		IO::di, IO::uo) is det.

s/IO/io/ there unless you mean for the last two arguments to be polymorphic.

> :- implementation.
>
>
> % library modules

That comment shouldn't be necessary - see the section `Module Imports'
in the coding standard.

That's fine otherwise.

Cheers,
Julien.
--------------------------------------------------------------------------
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