[m-rev.] for review: fix bug #252 - mmc -jN --make for build_all targets

Julien Fischer juliensf at csse.unimelb.edu.au
Fri Feb 10 16:01:58 AEDT 2012


For review by Peter Wang or Peter Ross.

Branches: main, 11.07

Fix bug #252: support parallel builds for the various build_all targets with
mmc --make.

compiler/make.program_target.m:
 	As above.
Julien.

Index: compiler/make.program_target.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/make.program_target.m,v
retrieving revision 1.115
diff -u -r1.115 make.program_target.m
--- compiler/make.program_target.m	2 Sep 2011 05:53:09 -0000	1.115
+++ compiler/make.program_target.m	10 Feb 2012 04:58:19 -0000
@@ -849,15 +849,24 @@
          get_target_modules(Globals, ModuleTargetType, AllModules,
              TargetModules, !Info, !IO),
          globals.lookup_bool_option(Globals, keep_going, KeepGoing),
-        ( Succeeded0 = no, KeepGoing = no ->
+        ( Succeeded0 = no, KeepGoing = no ->
              Succeeded = no
          ;
-            maybe_with_analysis_cache_dir(Globals,
-                foldl2_maybe_stop_at_error(KeepGoing, make_module_target,
-                    Globals,
-                    make_dependency_list(TargetModules, ModuleTargetType)),
-                Succeeded1, !Info, !IO),
-            Succeeded = Succeeded0 `and` Succeeded1
+            % Ensure all interface files are present before continuing.
+            % This prevents a problem when two parallel branches try to generate
+            % the same missing interface file later.
+            make_all_interface_files(Globals, AllModules, Succeeded1,
+                !Info, !IO),
+            ( Succeeded1 = no, KeepGoing = no ->
+                Succeeded = no
+            ;
+                maybe_with_analysis_cache_dir(Globals,
+                    foldl2_maybe_stop_at_error_maybe_parallel(KeepGoing,
+                        make_module_target, Globals, 
+                        make_dependency_list(TargetModules, ModuleTargetType)),
+                    Succeeded2, !Info, !IO),
+                Succeeded = Succeeded0 `and` Succeeded1 `and` Succeeded2
+            )
          )
      ;
          TargetType = misc_target_build_analyses,

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