[m-rev.] for review: replace parallel conjunctions by seq conjunctions

Peter Wang wangp at students.cs.mu.oz.au
Thu Aug 31 16:46:45 AEST 2006


I'm making some changes to the parallel conjunction infrastructure and
it'd be nice not to worry about the situation where we generate parallel
conjunction instructions (for the Mercury abstract machine) in a
non-parallel grade.


Estimated hours taken: 0.5
Branches: main

compiler/dep_par_conj.m:
	Replace all parallel conjunctions by sequential conjunctions in grades
	other than lowlevel C, parallel grades (i.e. the ones that support
	parallel conjunctions).  Previously we only replaced _dependent_
	parallel conjunctions by sequential conjunctions.

Index: compiler/dep_par_conj.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/dep_par_conj.m,v
retrieving revision 1.10
diff -u -r1.10 dep_par_conj.m
--- compiler/dep_par_conj.m	22 Aug 2006 05:03:42 -0000	1.10
+++ compiler/dep_par_conj.m	31 Aug 2006 06:36:10 -0000
@@ -192,12 +192,12 @@
     add_pending_par_procs(DoneParProcs, PendingProcs,
         ModuleInfo0, !ModuleInfo, !IO).
 
-    % Dependent parallel conjunctions only supported on lowlevel C parallel
+    % Parallel conjunctions only supported on lowlevel C parallel
     % grades.
     %
-:- pred handle_dep_par_conj(module_info::in) is semidet.
+:- pred handle_par_conj(module_info::in) is semidet.
 
-handle_dep_par_conj(ModuleInfo) :-
+handle_par_conj(ModuleInfo) :-
     module_info_get_globals(ModuleInfo, Globals),
     globals.get_target(Globals, Target),
     globals.lookup_bool_option(Globals, highlevel_code, HighLevelCode),
@@ -250,7 +250,7 @@
 
         search_goal_for_par_conj(!Body, InstMap0, _, Info0, Info1),
 
-        (if handle_dep_par_conj(!.ModuleInfo) then
+        (if handle_par_conj(!.ModuleInfo) then
             replace_sequences_in_goal(!Body, Info1, Info2),
             Info2 = dep_par_info(!:ParProcs, !:ModuleInfo,
                 !:VarSet, !:VarTypes, _IgnoreVars),
@@ -543,24 +543,26 @@
     SharedVars = set.filter(isnt(set.contains(!.Info ^ dp_ignore_vars)),
         SharedVars0),
 
+    !.Info = dep_par_info(ParProcs0, ModuleInfo0,
+        VarSet0, VarTypes0, IgnoreVars),
     (if
-        set.empty(SharedVars)
+        handle_par_conj(ModuleInfo0)
     then
-        par_conj_list_to_goal(Conjuncts, GoalInfo, NewGoal)
-    else 
-        !.Info = dep_par_info(ParProcs0, ModuleInfo0,
-            VarSet0, VarTypes0, IgnoreVars),
         (if
-            handle_dep_par_conj(ModuleInfo0)
+            set.empty(SharedVars)
         then
+            % Independent parallel conjunctions need no transformation.
+            par_conj_list_to_goal(Conjuncts, GoalInfo, NewGoal)
+        else
             transform_conjunction(SharedVars, Conjuncts, GoalInfo, NewGoal,
                 InstMap, VarSet0, VarSet, VarTypes0, VarTypes,
                 ModuleInfo0, ModuleInfo, ParProcs0, ParProcs),
             !:Info = dep_par_info(ParProcs, ModuleInfo,
                 VarSet, VarTypes, IgnoreVars)
-        else
-            conj_list_to_goal(Conjuncts, GoalInfo, NewGoal)
         )
+    else
+        % Replace all parallel conjunctions by sequential conjunctions.
+        conj_list_to_goal(Conjuncts, GoalInfo, NewGoal)
     ).
 
     % Transforming the parallel conjunction.
--------------------------------------------------------------------------
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