[m-rev.] diff: fix a bug in trail-usage analysis

Julien Fischer juliensf at cs.mu.OZ.AU
Mon May 29 17:53:46 AEST 2006


Estimated hours taken: 0.5
Branches: main, release

Fix a bug in trail-usage analysis.

compiler/trailing_analysis.m:
	Mark generic calls that are casts as not modifying the trail.

	s/procedue/procedure/

Julien.

Index: compiler/trailing_analysis.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/trailing_analysis.m,v
retrieving revision 1.12
diff -u -r1.12 trailing_analysis.m
--- compiler/trailing_analysis.m	29 Mar 2006 08:07:26 -0000	1.12
+++ compiler/trailing_analysis.m	29 May 2006 07:30:59 -0000
@@ -5,16 +5,16 @@
 % This file may only be copied under the terms of the GNU General
 % Public License - see the file COPYING in the Mercury distribution.
 %-----------------------------------------------------------------------------%
-
+%
 % File: trailing_analysis.m.
 % Author: juliensf.
-
+%
 % This module implements trail usage analysis.  It annotates the HLDS with
 % information about which procedures will not modify the trail.
 %
 % The compiler can use this information to omit redundant trailing operations
 % in trailing grades.  After running the analysis the trailing status of each
-% procedue is one of:
+% procedure is one of:
 %
 %   (1) will_not_modify_trail
 %   (2) may_modify_trail
@@ -39,7 +39,7 @@
 %
 % The predicates for determining if individual goals modify the trail
 % are in goal_form.m.
-
+%
 % TODO:
 %
 %   - Use the results of closure analysis to determine the trailing
@@ -47,7 +47,8 @@
 %   - Improve the analysis in the presence of solver types.
 %   - Create specialised versions of higher-order procedures based on
 %     whether or not their arguments modify the trail.
-
+%
+%----------------------------------------------------------------------------%
 %----------------------------------------------------------------------------%

 :- module transform_hlds.trailing_analysis.
@@ -413,7 +414,7 @@
     Goal = generic_call(Details, _Args, _ArgModes, _),
     (
         % XXX Use results of closure analysis to handle this.
-        Details = higher_order(_Var, _, _,  _),
+        Details = higher_order(_Var, _, _, _),
         Result = may_modify_trail,
         MaybeAnalysisStatus = yes(optimal)
     ;
@@ -886,8 +887,17 @@
     ).
 annotate_goal_2(_VarTypes, _, !Goal, Status, !ModuleInfo, !IO) :-
     % XXX Use closure analysis results here.
-    !.Goal = generic_call(_, _, _, _),
-    Status = may_modify_trail.
+    !.Goal = generic_call(Details, _, _, _),
+    (
+        Details = higher_order(_, _, _, _),
+        Status = may_modify_trail
+    ;
+        Details = class_method(_, _, _, _),
+        Status = may_modify_trail
+    ;
+        Details = cast(_),
+        Status = will_not_modify_trail
+    ).
 annotate_goal_2(VarTypes, _, !Goal, Status, !ModuleInfo, !IO) :-
     !.Goal = switch(Var, CanFail, Cases0),
     annotate_cases(VarTypes, Cases0, Cases, Status, !ModuleInfo, !IO),

--------------------------------------------------------------------------
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