[m-rev.] diff: break up program_representation_utils

Paul Bone pbone at csse.unimelb.edu.au
Thu Nov 6 09:59:06 AEDT 2008


On Thu, Nov 06, 2008 at 08:02:02AM +1100, Paul Bone wrote:
> 
> On 05/11/2008, at 5:36 PM, Peter Wang wrote:
> 
> >On 2008-11-05, Zoltan Somogyi <zs at csse.unimelb.edu.au> wrote:
> >>Increase the deep profiler's cohesion by dividing the
> >>program_representation_utils.m module into three files:
> >>
> >>- coverage.m containing the coverage analysis algorithm,
> >>- var_use_analysis.m containing the variable use analysis  
> >>algorithm, and
> >>- program_representation_utils.m itself containing generally  
> >>useful predicates
> >>  working on program representations.
> >
> >Something seems to be missing:
> >
> >coverage.m:332: In definition of predicate
> >coverage.m:332:   `coverage.disj_annotate_coverage_2'/9:
> >coverage.m:332:   error: undefined type `solution_count_rep'/0.
> >
> 
> I beleive this is defined in program_representation_utils.m   
> coverage.m should import program_representation_utils.
> 
> I can check for this and other problems in about an hour.
>

The following patch (commited this morning) fixes this issue,  I can now
build all the mdprof_* targets in the deep_profiler directory.

Estimated hours taken: 0.25
Branches: main

Fix a problem reported by Peter Wang that prevented the var_use_analysis module
from compiling.

deep_profiler/program_representation_utils.m:
    Re-add some accidentally deleted code when this module was split in three.

deep_profiler/var_use_analysis.m:
    Mark an issue in the variable use analysis algorithm with an XXX.

Index: deep_profiler/program_representation_utils.m
===================================================================
RCS file: /home/mercury1/repository/mercury/deep_profiler/program_representation_utils.m,v
retrieving revision 1.19
diff -u -p -b -r1.19 program_representation_utils.m
--- deep_profiler/program_representation_utils.m	5 Nov 2008 03:38:40 -0000	1.19
+++ deep_profiler/program_representation_utils.m	5 Nov 2008 23:02:05 -0000
@@ -122,6 +122,22 @@
     %
 :- pred atomic_goal_get_vars(atomic_goal_rep::in, set(var_rep)::out) is det.
 
+
+%----------------------------------------------------------------------------%
+
+:- type solution_count_rep
+    --->    at_most_zero_rep
+    ;       at_most_one_rep   % Including committed choice.
+    ;       at_most_many_rep.
+
+:- func detism_get_solutions(detism_rep) = solution_count_rep.
+
+:- type can_fail_rep
+    --->    can_fail_rep
+    ;       cannot_fail_rep.
+
+:- func detism_get_can_fail(detism_rep) = can_fail_rep.
+
 %----------------------------------------------------------------------------%
 
 :- implementation.
@@ -753,6 +769,26 @@ merge_seen_duplicate_instantiation(A, B)
 
 %----------------------------------------------------------------------------%
 
+detism_get_solutions(det_rep) =         at_most_one_rep.
+detism_get_solutions(semidet_rep) =     at_most_one_rep.
+detism_get_solutions(multidet_rep) =    at_most_many_rep.
+detism_get_solutions(nondet_rep) =      at_most_many_rep.
+detism_get_solutions(cc_multidet_rep) = at_most_one_rep.
+detism_get_solutions(cc_nondet_rep) =   at_most_one_rep.
+detism_get_solutions(erroneous_rep) =   at_most_zero_rep.
+detism_get_solutions(failure_rep) =     at_most_zero_rep.
+
+detism_get_can_fail(det_rep) =          cannot_fail_rep.
+detism_get_can_fail(semidet_rep) =      can_fail_rep.
+detism_get_can_fail(multidet_rep) =     cannot_fail_rep.
+detism_get_can_fail(nondet_rep) =       can_fail_rep.
+detism_get_can_fail(cc_multidet_rep) =  cannot_fail_rep.
+detism_get_can_fail(cc_nondet_rep) =    can_fail_rep.
+detism_get_can_fail(erroneous_rep) =    cannot_fail_rep.
+detism_get_can_fail(failure_rep) =      can_fail_rep.
+
+%----------------------------------------------------------------------------%
+
 :- func this_file = string.
 
 this_file = "program_representation_utils: ".
Index: deep_profiler/var_use_analysis.m
===================================================================
RCS file: /home/mercury1/repository/mercury/deep_profiler/var_use_analysis.m,v
retrieving revision 1.1
diff -u -p -b -r1.1 var_use_analysis.m
--- deep_profiler/var_use_analysis.m	5 Nov 2008 03:38:40 -0000	1.1
+++ deep_profiler/var_use_analysis.m	5 Nov 2008 22:57:52 -0000
@@ -531,6 +531,7 @@ switch_var_first_use(GoalPath, SwitchedO
             FoundFirstUse = have_not_found_first_use
         ;
             VarUseType = StaticInfo ^ fui_var_use,
+            % XXX: These are the wrong way around.
             (
                 VarUseType = var_use_consumption,
                 DefaultCost = CostBeforeSwitch
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mercurylang.org/archives/reviews/attachments/20081106/dffa1b20/attachment.sig>


More information about the reviews mailing list