automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 7/8] threaded-am: better serialization for required config files


From: Stefano Lattarini
Subject: [PATCH 7/8] threaded-am: better serialization for required config files
Date: Sun, 9 Oct 2011 10:53:03 +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         |   20 ++++++++++++++
 automake.in       |   76 ++++++++++++++++++++++++++--------------------------
 tests/Makefile.am |    1 -
 tests/Makefile.in |    2 +-
 4 files changed, 59 insertions(+), 40 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 299738f..a5eaaef 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,25 @@
 2011-10-08  Stefano Lattarini  <address@hidden>
 
+       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  <address@hidden>
+
        automake: refactor, break up 'require_file_internal'
        This refactoring is only required in view of future changes.
        * automake.in (require_file_internal): Move the guts of this
diff --git a/automake.in b/automake.in
index d75bc0b..68a16da 100644
--- a/automake.in
+++ b/automake.in
@@ -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';
 
@@ -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
            {
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 8980a6b..c0f1f01 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -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 \
diff --git a/tests/Makefile.in b/tests/Makefile.in
index 32dac78..4357b65 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -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 \
-- 
1.7.2.3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]