Title: [265178] trunk/Source/WebKit
Revision
265178
Author
[email protected]
Date
2020-08-01 10:54:44 -0700 (Sat, 01 Aug 2020)

Log Message

Prevent multiple invocations of generate-message-receiver.py
https://bugs.webkit.org/show_bug.cgi?id=215054

Reviewed by Darin Adler.

WebKit/DerivedSources.make is written such that
generate-message-receiver.py can be invoked N times, where N is the
value passed to -j. This results in the N invocations of
generate-message-receiver.py trying trying to generate the same set of
files at the same time, possibly leading to their being corrupted. We
have reports of generated files starting with a 4K block of NULs, and
this contention may be causing it. Address this by using a "pattern
rule" in the makefile, which is documented in GNU make's documentation
as the approach to take when there is one build rule that creates
multiple outputs, as is the case here.

See also <https://bugs.webkit.org/show_bug.cgi?id=166814> and
<http://trac.webkit.org/changeset/210507>.

No new tests -- no new or changed functionality.

* DerivedSources.make:

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (265177 => 265178)


--- trunk/Source/WebKit/ChangeLog	2020-08-01 17:51:17 UTC (rev 265177)
+++ trunk/Source/WebKit/ChangeLog	2020-08-01 17:54:44 UTC (rev 265178)
@@ -1,3 +1,28 @@
+2020-08-01  Keith Rollin  <[email protected]>
+
+        Prevent multiple invocations of generate-message-receiver.py
+        https://bugs.webkit.org/show_bug.cgi?id=215054
+
+        Reviewed by Darin Adler.
+
+        WebKit/DerivedSources.make is written such that
+        generate-message-receiver.py can be invoked N times, where N is the
+        value passed to -j. This results in the N invocations of
+        generate-message-receiver.py trying trying to generate the same set of
+        files at the same time, possibly leading to their being corrupted. We
+        have reports of generated files starting with a 4K block of NULs, and
+        this contention may be causing it. Address this by using a "pattern
+        rule" in the makefile, which is documented in GNU make's documentation
+        as the approach to take when there is one build rule that creates
+        multiple outputs, as is the case here.
+
+        See also <https://bugs.webkit.org/show_bug.cgi?id=166814> and
+        <http://trac.webkit.org/changeset/210507>.
+
+        No new tests -- no new or changed functionality.
+
+        * DerivedSources.make:
+
 2020-08-01  Darin Adler  <[email protected]>
 
         Remove Range::create and many more uses of live ranges

Modified: trunk/Source/WebKit/DerivedSources.make (265177 => 265178)


--- trunk/Source/WebKit/DerivedSources.make	2020-08-01 17:51:17 UTC (rev 265177)
+++ trunk/Source/WebKit/DerivedSources.make	2020-08-01 17:54:44 UTC (rev 265178)
@@ -253,16 +253,26 @@
 FRAMEWORK_FLAGS := $(shell echo $(BUILT_PRODUCTS_DIR) $(FRAMEWORK_SEARCH_PATHS) $(SYSTEM_FRAMEWORK_SEARCH_PATHS) | perl -e 'print "-F " . join(" -F ", split(" ", <>));')
 HEADER_FLAGS := $(shell echo $(BUILT_PRODUCTS_DIR) $(HEADER_SEARCH_PATHS) $(SYSTEM_HEADER_SEARCH_PATHS) | perl -e 'print "-I" . join(" -I", split(" ", <>));')
 
+MESSAGE_RECEIVER_FILES := $(addsuffix MessageReceiver.cpp,$(notdir $(MESSAGE_RECEIVERS)))
+MESSAGES_FILES := $(addsufix Messages.h,$(notdir $(MESSAGE_RECEIVERS)))
+MESSAGE_REPLIES_FILES := $(addsuffix MessagesReplies.h,$(notdir $(MESSAGE_RECEIVERS)))
+MESSAGES_IN_FILES := $(addsuffix .messages.in,$(MESSAGE_RECEIVERS))
+
+MESSAGE_RECEIVER_PATTERNS := $(subst .,%,$(MESSAGE_RECEIVER_FILES))
+MESSAGES_PATTERNS := $(subst .,%,$(MESSAGES_FILES))
+MESSAGE_REPLIES_PATTERNS := $(subst .,%,$(MESSAGE_REPLIES_FILES))
+
 .PHONY : all
 
-all : MessageNames.h MessageNames.cpp \
-    $(addsuffix MessageReceiver.cpp,$(notdir $(MESSAGE_RECEIVERS))) \
-    $(addsuffix Messages.h,$(notdir $(MESSAGE_RECEIVERS))) \
-    $(addsuffix MessagesReplies.h,$(notdir $(MESSAGE_RECEIVERS))) \
+all : \
+    $(MESSAGE_RECEIVER_FILES) \
+    $(MESSAGES_FILES) \
+    $(MESSAGE_REPLIES_FILES) \
+    MessageNames.h MessageNames.cpp \
 #
 
-$(addsuffix MessageReceiver.cpp,$(notdir $(MESSAGE_RECEIVERS))) $(addsufix Messages.h,$(notdir $(MESSAGE_RECEIVERS))) $(addsuffix MessagesReplies.h,$(notdir $(MESSAGE_RECEIVERS))) MessageNames.h MessageNames.cpp: $(addsuffix .messages.in,$(MESSAGE_RECEIVERS)) $(SCRIPTS)
-	@python $(WebKit2)/Scripts/generate-message-receiver.py $(WebKit2) $(MESSAGE_RECEIVERS)
+$(MESSAGE_RECEIVER_PATTERNS) $(MESSAGES_PATTERNS) $(MESSAGE_REPLIES_PATTERNS) MessageNames%h MessageNames%cpp : $(MESSAGES_IN_FILES) $(SCRIPTS)
+	python $(WebKit2)/Scripts/generate-message-receiver.py $(WebKit2) $(MESSAGE_RECEIVERS)
 
 TEXT_PREPROCESSOR_FLAGS=-E -P -w
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to