spacepaste

  1.  
  2. From 1ac17bea2273df0dfec21897b00efb8351648e1b Mon Sep 17 00:00:00 2001
  3. From: Kent Fredric <kentnl@gentoo.org>
  4. Date: Sun, 9 Apr 2017 04:10:52 +1200
  5. Subject: Remove need for threaded perl at expense of being single-threaded
  6. This could theoretically be implemented with forks, but I opted not
  7. to because its too hard, and the platform specifics are too messy.
  8. This could theoretically also have support for automatic detection
  9. as to which strategy to use based on OS/availability, but the
  10. implementation details of that are too much for my pateience today.
  11. In an ideal world, this file would support:
  12. 1. Single threaded builds for spartans
  13. 2. Forked builds for people who are on linux but don't want to rebuild
  14. their perl just to have threads ( which produce negligible benefit
  15. and measurable performance penalties to all code )
  16. 3. Threaded builds for people who are on windows where forks may not
  17. be entirely sane.
  18. But #1 is good enough atm.
  19. This is important for Gentoo, because end users decide on their own
  20. choices with regards to threading support for perl, and threading
  21. support is off by default due to the performance issues mentioned in #2
  22. in conjunction with the fact that "threads" is officially discouraged
  23. by Perl Upstream.
  24. And as Gentoo users have to have a system Perl to compile WebkitGTK,
  25. this means installing WebkitGTK requires rebuilding their system Perl
  26. with threads.
  27. And this *also* means that all packages presently compiled against Perl
  28. become broken, because non-threaded perl and threaded perl are not ABI
  29. compatible with each other, and this can scale into hundreds of
  30. packages and significant transient breakage.
  31. This ends up in practice being *far* *worse* in terms of time wasted
  32. than the mediocre time inefficiency created by needing a single
  33. threaded build.
  34. ---
  35. Source/WebCore/bindings/scripts/generate-bindings-all.pl | 15 +++++----------
  36. 1 file changed, 5 insertions(+), 10 deletions(-)
  37. diff --git a/Source/WebCore/bindings/scripts/generate-bindings-all.pl b/Source/WebCore/bindings/scripts/generate-bindings-all.pl
  38. index 37b27cc74..b3a378df0 100755
  39. --- a/Source/WebCore/bindings/scripts/generate-bindings-all.pl
  40. +++ b/Source/WebCore/bindings/scripts/generate-bindings-all.pl
  41. @@ -32,9 +32,6 @@ use File::Basename;
  42. use File::Spec;
  43. use File::Find;
  44. use Getopt::Long;
  45. -use threads;
  46. -use threads::shared;
  47. -use Thread::Queue;
  48. my $perl = $^X;
  49. my $scriptDir = $FindBin::Bin;
  50. @@ -121,13 +118,11 @@ my @idlFilesToUpdate = grep &{sub {
  51. implicitDependencies($depFile));
  52. needsUpdate(\@output, \@deps);
  53. }}, @idlFiles;
  54. -my $queue = Thread::Queue->new(@idlFilesToUpdate);
  55. -my $abort :shared = 0;
  56. -my $totalCount = @idlFilesToUpdate;
  57. -my $currentCount :shared = 0;
  58. -my @threadPool = map { threads->create(\&worker) } (1 .. $numOfJobs);
  59. -$_->join for @threadPool;
  60. +my $abort = 0;
  61. +my $totalCount = @idlFilesToUpdate;
  62. +my $currentCount = 0;
  63. +worker();
  64. exit $abort;
  65. sub needsUpdate
  66. @@ -158,7 +153,7 @@ sub mtime
  67. }
  68. sub worker {
  69. - while (my $file = $queue->dequeue_nb()) {
  70. + while (my $file = shift @idlFilesToUpdate) {
  71. last if $abort;
  72. eval {
  73. $currentCount++;
  74. --
  75. 2.12.2
  76.