]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
threaded-am: better serialization for required config files
authorStefano Lattarini <stefano.lattarini@gmail.com>
Sat, 8 Oct 2011 15:27:42 +0000 (17:27 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Sat, 8 Oct 2011 19:46:07 +0000 (21:46 +0200)
With this change, we make serialization/de-serialization of
required config files installs more granular, and in the process
fix the bug introduced by commit `v1.11-1219-g326ecba'.

* automake.in ($required_conf_file_queue): Move its declaration
earlier.
(require_file_internal): Add a new argument telling whether the
function should act immediately or queue its action for the master
thread to handle.
(queue_required_conf_file): Renamed ...
(queue_required_file_check_or_copy): ... to this.
(require_queued_conf_file): Renamed ...
(require_queued_file_check_or_copy): ... to this, and make it call
`required_file_check_or_copy' instead of `require_file_internal'.
(require_conf_file, handle_makefiles_threaded): Adjust and simplify
accordingly.
* tests/Makefile.am (XFAIL_TESTS): Remove `parallel-am.test'.

ChangeLog
automake.in
tests/Makefile.am
tests/Makefile.in

index 299738f105fa73d19276cead2487d591d0f93caa..a5eaaefd21918e975137ffe377ac4bdd2e97732f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,23 @@
+2011-10-08  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       threaded-am: better serialization for required config files
+       With this change, we make serialization/de-serialization of
+       required config files installs more granular, and in the process
+       fix the bug introduced by commit `v1.11-1219-g326ecba'.
+       * automake.in ($required_conf_file_queue): Move its declaration
+       earlier.
+       (require_file_internal): Add a new argument telling whether the
+       function should act immediately or queue its action for the master
+       thread to handle.
+       (queue_required_conf_file): Renamed ...
+       (queue_required_file_check_or_copy): ... to this.
+       (require_queued_conf_file): Renamed ...
+       (require_queued_file_check_or_copy): ... to this, and make it call
+       `required_file_check_or_copy' instead of `require_file_internal'.
+       (require_conf_file, handle_makefiles_threaded): Adjust and simplify
+       accordingly.
+       * tests/Makefile.am (XFAIL_TESTS): Remove `parallel-am.test'.
+
 2011-10-08  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        automake: refactor, break up 'require_file_internal'
index d75bc0b68ae42f8a60576dd3b45358940f2c556c..68a16daac96ea43e7443372a6a3aaf1c7197ebea 100644 (file)
@@ -470,6 +470,9 @@ my %required_targets =
    'install-man' => 1,
   );
 
+# Queue to push require_conf_file requirements to.
+my $required_conf_file_queue;
+
 # The name of the Makefile currently being processed.
 my $am_file = 'BUG';
 \f
@@ -7775,13 +7778,15 @@ sub required_file_check_or_copy ($$$)
 }
 
 
-# &require_file_internal ($WHERE, $MYSTRICT, $DIRECTORY, @FILES)
-# --------------------------------------------------------------
+# &require_file_internal ($WHERE, $MYSTRICT, $DIRECTORY, $QUEUE, @FILES)
+# ----------------------------------------------------------------------
 # Verify that the file must exist in $DIRECTORY, or install it.
 # $MYSTRICT is the strictness level at which this file becomes required.
+# Worker threads may queue up the action to be serialized by the master,
+# if $QUEUE is true
 sub require_file_internal ($$$@)
 {
-  my ($where, $mystrict, $dir, @files) = @_;
+  my ($where, $mystrict, $dir, $queue, @files) = @_;
 
   return
     unless $strictness >= $mystrict;
@@ -7789,7 +7794,16 @@ sub require_file_internal ($$$@)
   foreach my $file (@files)
     {
       push_required_file ($dir, $file, "$dir/$file");
-      required_file_check_or_copy ($where, $dir, $file);
+      if ($queue)
+        {
+          queue_required_file_check_or_copy ($required_conf_file_queue,
+                                             QUEUE_CONF_FILE, $relative_dir,
+                                             $where, $mystrict, @files);
+        }
+      else
+        {
+          required_file_check_or_copy ($where, $dir, $file);
+        }
     }
 }
 
@@ -7798,7 +7812,7 @@ sub require_file_internal ($$$@)
 sub require_file ($$@)
 {
     my ($where, $mystrict, @files) = @_;
-    require_file_internal ($where, $mystrict, $relative_dir, @files);
+    require_file_internal ($where, $mystrict, $relative_dir, 0, @files);
 }
 
 # &require_file_with_macro ($COND, $MACRO, $MYSTRICT, @FILES)
@@ -7821,7 +7835,7 @@ sub require_libsource_with_macro ($$$@)
     if ($config_libobj_dir)
       {
        require_file_internal ($macro->rdef ($cond)->location, $mystrict,
-                              $config_libobj_dir, @files);
+                              $config_libobj_dir, 0, @files);
       }
     else
       {
@@ -7829,12 +7843,10 @@ sub require_libsource_with_macro ($$$@)
       }
 }
 
-# Queue to push require_conf_file requirements to.
-my $required_conf_file_queue;
-
-# &queue_required_conf_file ($QUEUE, $KEY, $DIR, $WHERE, $MYSTRICT, @FILES)
-# -------------------------------------------------------------------------
-sub queue_required_conf_file ($$$$@)
+# &queue_required_file_check_or_copy ($QUEUE, $KEY, $DIR, $WHERE,
+#                                     $MYSTRICT, @FILES)
+# ---------------------------------------------------------------
+sub queue_required_file_check_or_copy ($$$$@)
 {
     my ($queue, $key, $dir, $where, $mystrict, @files) = @_;
     my @serial_loc;
@@ -7849,9 +7861,9 @@ sub queue_required_conf_file ($$$$@)
     $queue->enqueue ($key, $dir, @serial_loc, $mystrict, 0 + @files, @files);
 }
 
-# &require_queued_conf_file ($QUEUE)
-# ----------------------------------
-sub require_queued_conf_file ($)
+# &require_queued_file_check_or_copy ($QUEUE)
+# -------------------------------------------
+sub require_queued_file_check_or_copy ($)
 {
     my ($queue) = @_;
     my $where;
@@ -7874,35 +7886,23 @@ sub require_queued_conf_file ($)
     my @files;
     push @files, $queue->dequeue ()
       foreach (1 .. $nfiles);
-
-    # Dequeuing happens outside of per-makefile context, so we have to
-    # set the variables used by require_file_internal and the functions
-    # it calls.  Gross!
-    $relative_dir = $dir;
-    require_file_internal ($where, $mystrict, $config_aux_dir, @files);
+    return
+      unless $strictness >= $mystrict;
+    foreach my $file (@files)
+      {
+        required_file_check_or_copy ($where, $config_aux_dir, $file);
+      }
 }
 
 # &require_conf_file ($WHERE, $MYSTRICT, @FILES)
 # ----------------------------------------------
-# Looks in configuration path, as specified by AC_CONFIG_AUX_DIR;
-# worker threads may queue up the action to be serialized by the master.
-#
-# FIXME: this seriously relies on the semantics of require_file_internal
-# and push_required_file, in that we exploit the fact that only the
-# contents of the last handled output file may be impacted (which in turn
-# is dealt with by the master thread).
+# Looks in configuration path, as specified by AC_CONFIG_AUX_DIR.
 sub require_conf_file ($$@)
 {
     my ($where, $mystrict, @files) = @_;
-    if (defined $required_conf_file_queue)
-      {
-       queue_required_conf_file ($required_conf_file_queue, QUEUE_CONF_FILE,
-                                 $relative_dir, $where, $mystrict, @files);
-      }
-    else
-      {
-       require_file_internal ($where, $mystrict, $config_aux_dir, @files);
-      }
+    my $queue = defined $required_conf_file_queue ? 1 : 0;
+    require_file_internal ($where, $mystrict, $config_aux_dir,
+                           $queue, @files);
 }
 
 
@@ -8532,7 +8532,7 @@ sub handle_makefiles_threaded ($)
            }
          elsif ($key eq QUEUE_CONF_FILE)
            {
-             require_queued_conf_file ($queue);
+             require_queued_file_check_or_copy ($queue);
            }
          else
            {
index 8980a6bc74690cd599a1aa5b92e302c8d5682953..c0f1f0155cc705e3be113689cb0fb3f446c31b5a 100644 (file)
@@ -29,7 +29,6 @@ auxdir2.test \
 cond17.test \
 gcj6.test \
 override-conditional-2.test \
-parallel-am.test \
 java-nobase.test \
 pr8365-remake-timing.test \
 yacc-dist-nobuild-subdir.test \
index 32dac78a4ccc748995b0a032b7272dee4def93f7..4357b656d19813d5d419576c0ec636735f17667f 100644 (file)
@@ -295,7 +295,7 @@ EXTRA_DIST = ChangeLog-old gen-parallel-tests instspc-tests.sh \
        extract-testsuite-summary tap-setup.sh tap-summary-aux.sh \
        distcheck-hook-m4.am
 XFAIL_TESTS = all.test auxdir2.test cond17.test gcj6.test \
-       override-conditional-2.test parallel-am.test java-nobase.test \
+       override-conditional-2.test java-nobase.test \
        pr8365-remake-timing.test yacc-dist-nobuild-subdir.test \
        vala-vpath.test txinfo5.test $(instspc_xfail_tests)
 parallel_tests = check-concurrency-bug9245-p.test \