[m-rev.] diff: fix the ssdb transformation

Peter Ross pro at missioncriticalit.com
Wed May 5 13:29:13 AEST 2010


Hi,


===================================================================


Estimated hours taken: 4
Branches: main, 10.04

Fix the compilation of the following

  :- typeclass tc(T) where [
    pred p(T::in, int::out) is cc_multi,
    pred q(T::in, int::out) is semidet
  ]

in the .ssdebug grades

compiler/mercury_compile_middle_passes.m:
	Document why we call determinism_pass after the ssdb transformation.
	
compiler/ssdebug.m:
	Fix two goal infos which had the incorrect determinism, which
	the determinism_pass wasn't fixing up.

Index: compiler/mercury_compile_middle_passes.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mercury_compile_middle_passes.m,v
retrieving revision 1.1
diff -u -r1.1 mercury_compile_middle_passes.m
--- compiler/mercury_compile_middle_passes.m	14 Oct 2009 05:28:38 -0000	1.1
+++ compiler/mercury_compile_middle_passes.m	5 May 2010 03:21:44 -0000
@@ -861,9 +861,10 @@
         maybe_write_string(Verbose, "% done.\n", !IO),
         maybe_report_stats(Stats, !IO),
 
-        % XXX Must be remove to manage the determinism by hand
-        % XXX zs: what does the above comment mean?
-        determinism_pass(!HLDS, _Specs)
+        % this pass fixes up some incorrect determinisms after applying
+        % the transformations
+        determinism_pass(!HLDS, _),
+        true
     ;
         true
     ).
Index: compiler/ssdebug.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/ssdebug.m,v
retrieving revision 1.22
diff -u -r1.22 ssdebug.m
--- compiler/ssdebug.m	8 Sep 2009 02:43:39 -0000	1.22
+++ compiler/ssdebug.m	5 May 2010 03:21:44 -0000
@@ -449,7 +449,8 @@
             GoalsElse   = FailArgListGoals ++
                 [HandleEventFailGoal, SwitchFailPortGoal],
 
-            goal_info_set_determinism(detism_det, GoalInfoImpure, GoalInfoThen),
+            goal_info_set_determinism(detism_semi, GoalInfoImpure,
+                GoalInfoThen),
             goal_info_set_determinism(detism_semi, GoalInfoImpure,
                 GoalInfoElse),
 
@@ -783,7 +784,14 @@
     SymName = qualified(ModuleName, PredName),
     BuiltIn = builtin_state(ModuleInfo, PredId, PredId, ProcId),
     GoalExpr = plain_call(PredId, ProcId, HeadVars, BuiltIn, no, SymName),
-    goal_info_init(GoalInfoHG),
+
+        % We use the goal info of the top level goal in the proc info
+        % as this goal is the equivalent of what the recursive call
+        % is doing, ie binding the head vars.
+    pred_info_proc_info(PredInfo, ProcId, ProcInfo),
+    proc_info_get_goal(ProcInfo, BodyGoal0),
+    GoalInfoHG = get_hlds_goal_info(BodyGoal0),
+
     Goal = hlds_goal(GoalExpr, GoalInfoHG).
 
     % make_switch_goal(SwitchVar, SwitchCase1, SwitchCase2, GoalInfo, Goal).

--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list