[m-rev.] diff: fix compiler abort with solver initialisation

Julien Fischer juliensf at csse.unimelb.edu.au
Thu Nov 29 15:11:05 AEDT 2007


(This is still pending a bootcheck.)

Estimated hours taken: 0.5
Branches: main

compiler/modes.m:
 	Fix a bug where the compiler was trying to insert automatic solver
 	initialisation calls when that is not supported, either because
 	that feature is disabled or the solver type definition does not
 	specify an initialisation predicate.

 	Remove some excess module qualification.

Julien.

Index: compiler/modes.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/modes.m,v
retrieving revision 1.363
diff -u -r1.363 modes.m
--- compiler/modes.m	23 Nov 2007 07:35:16 -0000	1.363
+++ compiler/modes.m	29 Nov 2007 04:08:11 -0000
@@ -1343,9 +1343,14 @@
          Disjs0 = [_ | _],
          NonLocals = goal_info_get_nonlocals(GoalInfo0),
          modecheck_disj_list(Disjs0, Disjs1, InstMapList0, !ModeInfo, !IO),
-        mode_info_get_var_types(!.ModeInfo, VarTypes),
-        handle_solver_vars_in_disjs(set.to_sorted_list(NonLocals),
-            VarTypes, Disjs1, Disjs2, InstMapList0, InstMapList, !ModeInfo),
+        ( mode_info_solver_init_is_supported(!.ModeInfo) ->
+            mode_info_get_var_types(!.ModeInfo, VarTypes),
+            handle_solver_vars_in_disjs(set.to_sorted_list(NonLocals),
+                VarTypes, Disjs1, Disjs2, InstMapList0, InstMapList, !ModeInfo)
+        ;
+            InstMapList = InstMapList0,
+            Disjs2 = Disjs1
+        ),
          Disjs = flatten_disjs(Disjs2),
          instmap_merge(NonLocals, InstMapList, disj, !ModeInfo),
          disj_list_to_goal(Disjs, GoalInfo0, hlds_goal(GoalExpr, _GoalInfo))
@@ -1861,7 +1866,7 @@

  solver_var_must_be_initialised(VarTypes, ModuleInfo, InstMaps, Var) :-
      map.lookup(VarTypes, Var, VarType),
-    type_util.type_is_solver_type(ModuleInfo, VarType),
+    type_is_solver_type_with_auto_init(ModuleInfo, VarType),
      list.member(InstMap, InstMaps),
      instmap.lookup_var(InstMap, Var, Inst),
      not inst_match.inst_is_free(ModuleInfo, Inst).
@@ -1870,7 +1875,7 @@

  is_solver_var(VarTypes, ModuleInfo, Var) :-
      map.lookup(VarTypes, Var, VarType),
-    type_util.type_is_solver_type(ModuleInfo, VarType).
+    type_is_solver_type(ModuleInfo, VarType).

  :- pred add_necessary_disj_init_calls(list(hlds_goal)::in,
      list(hlds_goal)::out, list(instmap)::in, list(instmap)::out,
@@ -2532,7 +2537,7 @@

  non_solver_var(ModuleInfo, VarTypes, Var) :-
      VarType = VarTypes ^ det_elem(Var),
-    not type_util.type_is_solver_type(ModuleInfo, VarType).
+    not type_is_solver_type(ModuleInfo, VarType).

      % Update !NonFree and !CandidateVars given the args and modes for a call.
      %

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