From f672944356eaaf47b1cdb3a167431ec33a3f6b9c Mon Sep 17 00:00:00 2001 From: Stefano Lattarini Date: Sat, 8 Oct 2011 17:27:42 +0200 Subject: [PATCH] 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'. --- 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 299738f10..a5eaaefd2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,23 @@ +2011-10-08 Stefano Lattarini + + 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 automake: refactor, break up 'require_file_internal' diff --git a/automake.in b/automake.in index d75bc0b68..68a16daac 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 8980a6bc7..c0f1f0155 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 32dac78a4..4357b656d 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 \ -- 2.47.2