[m-rev.] trivial diff: Coverage profiling refactoring

Paul Bone pbone at csse.unimelb.edu.au
Sun Sep 28 20:56:08 AEST 2008


Estimated hours taken: 0.1
Branches: main

Coverage profiling refactoring.  Remove some unnecessary code.

deep_profiler/program_representation_utils.m:
	As above.

Index: deep_profiler/program_representation_utils.m
===================================================================
RCS file: /home/mercury1/repository/mercury/deep_profiler/program_representation_utils.m,v
retrieving revision 1.9
diff -u -p -b -r1.9 program_representation_utils.m
--- deep_profiler/program_representation_utils.m	28 Sep 2008 07:52:32 -0000	1.9
+++ deep_profiler/program_representation_utils.m	28 Sep 2008 09:22:44 -0000
@@ -791,35 +791,10 @@ disj_annotate_coverage_2(Info, GoalPath,
 switch_annotate_coverage(Info, CanFail, GoalPath, !Coverage, Cases0, Cases) :-
     Coverage0 = !.Coverage,
     switch_annotate_coverage_2(Info, CanFail, GoalPath, 1,
-        coverage_known_det(0), SwitchCoverage, !.Coverage, Cases0, Cases),
-    % Use the newly computed coverage if it's more informed than the current
-    % coverage.
-    (
-        !.Coverage = coverage_known_det(_)
-    ;
-        !.Coverage = coverage_known(_, _)
-    ;
-        !.Coverage = coverage_known_before(Before),
-        (
-            coverage_count_after(SwitchCoverage, After)
-        ->
-            !:Coverage = coverage_known(Before, After)
-        ;
-            true
-        )
-    ;
-        !.Coverage = coverage_known_after(After),
-        (
-            coverage_count_before(SwitchCoverage, Before)
-        ->
-            !:Coverage = coverage_known(Before, After)
-        ;
-            true
-        )
-    ;
-        !.Coverage = coverage_unknown,
-        !:Coverage = SwitchCoverage
-    ),
+        coverage_known_det(0), CoverageFromSwitch, !.Coverage, Cases0, Cases),
+    CoverageBeforeSwitch = get_coverage_before(!.Coverage),
+    CoverageAfterSwitch = get_coverage_after(CoverageFromSwitch),
+    !:Coverage = merge_coverage(CoverageBeforeSwitch, CoverageAfterSwitch),
 
     trace [compile_time(flag("debug_coverage_propagation")), io(!IO)] (
         io.format("Switch: Coverage0: %s\n", [s(string(Coverage0))], !IO)
-------------- 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/20080928/563ce273/attachment.sig>


More information about the reviews mailing list