[m-rev.] for review: extra_info sections in .analysis files
Julien Fischer
juliensf at cs.mu.OZ.AU
Fri Feb 17 16:17:38 AEDT 2006
On Fri, 17 Feb 2006, Peter Wang wrote:
> Estimated hours taken: 5
> Branches: main
>
> analysis/analysis.file.m:
> analysis/analysis.m:
> Add support for "extra info" sections in `.analysis' files. These are
> intended to contain any data that may be necessary but wouldn't fit as
> answer patterns.
>
> compiler/modules.m:
> Add `.imdg' and `.request' to the list of extensions treated specially
> by `make_file_name', so `--intermodule-analysis' works with
> `--use-grade-subdirs'.
>
> Index: analysis/analysis.file.m
> ===================================================================
> RCS file: /home/mercury1/repository/mercury/analysis/analysis.file.m,v
> retrieving revision 1.5
> diff -u -r1.5 analysis.file.m
> --- analysis/analysis.file.m 13 Feb 2006 03:47:39 -0000 1.5
> +++ analysis/analysis.file.m 17 Feb 2006 03:35:53 -0000
> @@ -15,35 +15,76 @@
>
> % read_module_overall_status(Compiler, ModuleId, MaybeModuleStatus,
> % !IO)
> + %
> % Attempt to read the overall status from a module `.analysis' file.
> + % If the module has outstanding requests, then an overall status of
> + % `optimal' is downgraded to `suboptimal'.
> %
> :- pred read_module_overall_status(Compiler::in, module_id::in,
> maybe(analysis_status)::out, io::di, io::uo) is det
> <= compiler(Compiler).
> -
> +
> + % read_module_analysis_results(AnalysisInfo, ModuleId,
> + % OverallStatus, AnalysisResults, ExtraInfo, !IO)
> + %
> + % Read the overall module status, analysis results and
> + % any extra info from a `.analysis' file.
> + %
> :- pred read_module_analysis_results(analysis_info::in, module_id::in,
> analysis_status::out, module_analysis_map(analysis_result)::out,
> - io__state::di, io__state::uo) is det.
> + module_extra_info_map::out, io::di, io::uo) is det.
>
> + % write_module_analysis_results(AnalysisInfo, ModuleId,
> + % OverallStatus, AnalysisResults, ExtraInfo, !IO)
> + %
> + % Write the overall module status, analysis results and
> + % extra info to a `.analysis' file.
> + %
> :- pred write_module_analysis_results(analysis_info::in,
> module_id::in, analysis_status::in,
> module_analysis_map(analysis_result)::in,
> - io__state::di, io__state::uo) is det.
> + module_extra_info_map::in, io::di, io::uo) is det.
>
> + % read_module_analysis_requests(AnalysisInfo, ModuleId,
> + % ModuleRequests, !IO)
> + %
> + % Read outstanding analysis requests to a module from disk.
> + %
> :- pred read_module_analysis_requests(analysis_info::in,
> module_id::in, module_analysis_map(analysis_request)::out,
> io__state::di, io__state::uo) is det.
>
> + % write_module_analysis_requests(AnalysisInfo, ModuleId,
> + % ModuleRequests, !IO)
> + %
> + % Write outstanding analysis requests for a module to disk.
> + %
> :- pred write_module_analysis_requests(analysis_info::in,
> module_id::in, module_analysis_map(analysis_request)::in,
> io__state::di, io__state::uo) is det.
>
> + % read_module_imdg(AnalysisInfo, ModuleId, ModuleEntries, !IO)
> + %
> + % Read the intermodule dependencies graph entries for a module
> + % from disk.
> + %
> :- pred read_module_imdg(analysis_info::in, module_id::in,
> module_analysis_map(imdg_arc)::out, io::di, io::uo) is det.
>
> + % write_module_imdg(AnalysisInfo, ModuleId, ModuleEntries, !IO)
> + %
> + % Write the intermodule dependencies graph entries for a module
> + % to disk.
> + %
> :- pred write_module_imdg(analysis_info::in, module_id::in,
> module_analysis_map(imdg_arc)::in, io::di, io::uo) is det.
>
> + % empty_request_file(AnalysisInfo, ModuleId, !IO)
> + %
> + % Delete the file containing outstanding analysis requests for a
> + % module. This means all the analysis requests should have been
> + % satisfied already.
> + %
> :- pred empty_request_file(analysis_info::in, module_id::in,
> io__state::di, io__state::uo) is det.
>
> @@ -55,6 +96,7 @@
> %
> % version_number.
> % module_status.
> +% extra_info(key, extra_info).
Perhaps the name of the compiler that wrote the extra_info ought
to be included as well.
extra_info(compiler_name, key, extra_info).
Also that definition looks as though it is recursive, so perhaps rewrite
it as
extra_info(compiler_name, key, extra_data)
where extra_data is ...
or something.
It's probably not worth adding the compiler name to it now (as we
currently only support mmc anyway) but you should mention it as an XXX.
On the structure fo the .analysis files - are analysis results and
extra_infos allowed to be interleaved or must all the extra_infos occur
before the analysis results? Either way, it isn't clear from that
comment.
...
> Index: analysis/analysis.m
> ===================================================================
> RCS file: /home/mercury1/repository/mercury/analysis/analysis.m,v
> retrieving revision 1.5
> diff -u -r1.5 analysis.m
> --- analysis/analysis.m 13 Feb 2006 03:47:39 -0000 1.5
> +++ analysis/analysis.m 17 Feb 2006 02:51:59 -0000
> @@ -110,6 +110,10 @@
> :- typeclass answer_pattern(Answer)
> <= (partial_order(Answer), to_string(Answer)) where [].
>
> +:- type extra_info_key == string.
> +
> +:- typeclass extra_info(ExtraInfo) <= to_string(ExtraInfo) where [].
> +
There should be some comments describing this type and typeclass and
what their intended purpose is.
That looks okay otherwise.
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