[m-rev.] diff: Update coverage profiling transformation.

Paul Bone pbone at csse.unimelb.edu.au
Sat Oct 11 13:37:45 AEDT 2008


Estimated hours taken: 0.5 
Branches: main

Update coverage profiling transformation to match the most recent change to
the coverage propagation algorithm.

compiler/deep_profiling.m:
	Coverage after a scope that cuts solutions away is never known, even when
	the entire goal is deterministic.
	A similar change has been made for negations.
	Code preventing coverage points from being inserted after a conjunction
	rather than in the last conjunct has been removed, it's no-longer required
	since the goals within the conjunction are transformed first.
	Adjust a comment making it more readable.

Index: compiler/deep_profiling.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/deep_profiling.m,v
retrieving revision 1.90
diff -u -p -b -r1.90 deep_profiling.m
--- compiler/deep_profiling.m	28 Sep 2008 07:52:31 -0000	1.90
+++ compiler/deep_profiling.m	11 Oct 2008 01:21:44 -0000
@@ -2146,8 +2146,7 @@ coverage_prof_second_pass_goal(Goal0, Go
             CoverageBeforeKnown, _, !Info, AddedImpurityInner),
         % The coverage after a negated goal cannot be inferred from its inner
         % goals.
-        coverage_known_after_goal_with_detism(Detism,
-            CoverageBeforeKnown, NextCoverageBeforeKnown0),
+        NextCoverageBeforeKnown0 = coverage_before_unknown,
         GoalExpr1 = negation(NegGoal)
     ;
         GoalExpr0 = scope(Reason, ScopeGoal0),
@@ -2161,8 +2160,7 @@ coverage_prof_second_pass_goal(Goal0, Go
         ( ScopedGoalDetism = Detism ->
             NextCoverageBeforeKnown0 = CoverageAfterScopedGoalKnown
         ;
-            coverage_known_after_goal_with_detism(Detism,
-                CoverageBeforeKnown, NextCoverageBeforeKnown0)
+            NextCoverageBeforeKnown0 = coverage_before_unknown
         ),
         GoalExpr1 = scope(Reason, ScopeGoal)
     ;
@@ -2188,12 +2186,6 @@ coverage_prof_second_pass_goal(Goal0, Go
             % We already have execution counts for the program point after this
             % goal; adding a counter would be redundant.
             NextCoverageBeforeKnown0 = coverage_before_known
-        ;
-            % Never insert coverage points after conjunctions; wait until
-            % the algorithm recurses to inside the conjunction and make a
-            % better decision about the last conjunct. This can reduce the
-            % number of coverage points inserted in some cases.
-            GoalExpr0 = conj(_, _)
         )
     ->
         MaybeAddCP = no,
@@ -2302,11 +2294,11 @@ coverage_prof_second_pass_disj(DPInfo, C
         goal_info_get_determinism(SecondDisjunct ^ hlds_goal_info) =
             detism_failure
         % XXX: zs: Would this be a better test here?
+        % goal_has_feature(SecondDisjunct, feature_preserve_backtrack_into)
         % pbone: I don't think so, the deep profiler doesn't seem to add this
         % feature to disjuncts that end in failure, it is probably a good idea
         % to add this annotation to prevent later compiler passes from breaking
         % the deep profiler. 
-        % goal_has_feature(SecondDisjunct, feature_preserve_backtrack_into)
     ->
         coverage_prof_second_pass_goal(FirstDisjunct0, FirstDisjunct,
             CoverageBeforeKnown, NextCoverageBeforeKnown, !Info,
-------------- 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/20081011/1f4fcf23/attachment.sig>


More information about the reviews mailing list