Title: [291142] trunk/Source/_javascript_Core
Revision
291142
Author
e...@apple.com
Date
2022-03-10 18:35:06 -0800 (Thu, 10 Mar 2022)

Log Message

[XCBuild] Emit a discovered dependency file from offlineasm
https://bugs.webkit.org/show_bug.cgi?id=237329

Reviewed by Alexey Proskuryakov.

Xcode needs to know what files offlineasm uses and produces in order to schedule it
correctly in incremental builds. Rather than use generated xcfilelists like WebKit does
elsewhere in the project, emit a depfile from offlineasm based on the parse tree's source
files.

Discovered dependency files ("depfiles") are Makefile-formatted files which list the inputs
used to produce an output. They are emitting during the build to a temporary directory, and
ensure that subsequent incremental builds will re-run offlineasm when any of the included
sources change. This is the same mechanism clang uses to track header dependencies.

Unfortunately, the legacy build system will refuse to execute a script phase or rule that
emits a depfile. To work around this, convert the offlineasm pipeline to be based on build
rules, to be used by XCBuild only. The idea is that LowLevelInterpreter.asm is listed as a
source build file in JSCLLIntSettingsExtractor, JSCLLIntOffsetsExtractor, and
_javascript_Core. Each target uses a build rule to generate its respective header from
LowLevelInterpreter.asm. Xcode schedules these rule executions before any clang tasks.

The legacy build system avoids executing the rules via EXCLUDED_SOURCE_FILE_NAMES, and
instead uses the existing build phases, which have "(Legacy)" in their names and are now
no-ops under XCBuild.

Aside from working around the legacy build system's limitations, using build rules is
probably a superior way to express what we're doing, as it gives Xcode the opportunity to
compile other objects in parallel, and could be easily extended to compile multiple discrete
asm files should the need arise.

* Configurations/ToolExecutable.xcconfig: Build rules are XCBuild-only.
* _javascript_Core.xcodeproj/project.pbxproj: Add build rules, rename legacy scripts.
* offlineasm/asm.rb: Add --depfile flag.
* offlineasm/generate_offset_extractor.rb: Add --depfile flag.
* offlineasm/generate_settings_extractor.rb: Add --depfile flag.

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (291141 => 291142)


--- trunk/Source/_javascript_Core/ChangeLog	2022-03-11 02:04:19 UTC (rev 291141)
+++ trunk/Source/_javascript_Core/ChangeLog	2022-03-11 02:35:06 UTC (rev 291142)
@@ -1,3 +1,42 @@
+2022-03-10  Elliott Williams  <e...@apple.com>
+
+        [XCBuild] Emit a discovered dependency file from offlineasm
+        https://bugs.webkit.org/show_bug.cgi?id=237329
+
+        Reviewed by Alexey Proskuryakov.
+
+        Xcode needs to know what files offlineasm uses and produces in order to schedule it
+        correctly in incremental builds. Rather than use generated xcfilelists like WebKit does
+        elsewhere in the project, emit a depfile from offlineasm based on the parse tree's source
+        files.
+
+        Discovered dependency files ("depfiles") are Makefile-formatted files which list the inputs
+        used to produce an output. They are emitting during the build to a temporary directory, and
+        ensure that subsequent incremental builds will re-run offlineasm when any of the included
+        sources change. This is the same mechanism clang uses to track header dependencies.
+
+        Unfortunately, the legacy build system will refuse to execute a script phase or rule that
+        emits a depfile. To work around this, convert the offlineasm pipeline to be based on build
+        rules, to be used by XCBuild only. The idea is that LowLevelInterpreter.asm is listed as a
+        source build file in JSCLLIntSettingsExtractor, JSCLLIntOffsetsExtractor, and
+        _javascript_Core. Each target uses a build rule to generate its respective header from
+        LowLevelInterpreter.asm. Xcode schedules these rule executions before any clang tasks.
+
+        The legacy build system avoids executing the rules via EXCLUDED_SOURCE_FILE_NAMES, and
+        instead uses the existing build phases, which have "(Legacy)" in their names and are now
+        no-ops under XCBuild.
+
+        Aside from working around the legacy build system's limitations, using build rules is
+        probably a superior way to express what we're doing, as it gives Xcode the opportunity to
+        compile other objects in parallel, and could be easily extended to compile multiple discrete
+        asm files should the need arise.
+
+        * Configurations/ToolExecutable.xcconfig: Build rules are XCBuild-only.
+        * _javascript_Core.xcodeproj/project.pbxproj: Add build rules, rename legacy scripts.
+        * offlineasm/asm.rb: Add --depfile flag.
+        * offlineasm/generate_offset_extractor.rb: Add --depfile flag.
+        * offlineasm/generate_settings_extractor.rb: Add --depfile flag.
+
 2022-03-10  Michael Saboff  <msab...@apple.com>
 
         Catalyst _javascript_Core, WebCore, WebKitLegacy, and WebKit shouldn't be copied to the Secondary Path

Modified: trunk/Source/_javascript_Core/Configurations/_javascript_Core.xcconfig (291141 => 291142)


--- trunk/Source/_javascript_Core/Configurations/_javascript_Core.xcconfig	2022-03-11 02:04:19 UTC (rev 291141)
+++ trunk/Source/_javascript_Core/Configurations/_javascript_Core.xcconfig	2022-03-11 02:35:06 UTC (rev 291142)
@@ -61,4 +61,7 @@
 INSTALLHDRS_SCRIPT_PHASE = YES;
 APPLY_RULES_IN_COPY_HEADERS = $(WK_USE_NEW_BUILD_SYSTEM);
 
+EXCLUDED_SOURCE_FILE_NAMES = $(inherited) $(EXCLUDED_SOURCE_FILE_NAMES_$(WK_WHICH_BUILD_SYSTEM));
 EXCLUDED_SOURCE_FILE_NAMES[sdk=iphone*] = $(inherited) framework.sb;
+// Offset and settings headers are built by separate targets and script phases in the legacy build system, not using build rules.
+EXCLUDED_SOURCE_FILE_NAMES_legacy = *.asm;

Modified: trunk/Source/_javascript_Core/Configurations/ToolExecutable.xcconfig (291141 => 291142)


--- trunk/Source/_javascript_Core/Configurations/ToolExecutable.xcconfig	2022-03-11 02:04:19 UTC (rev 291141)
+++ trunk/Source/_javascript_Core/Configurations/ToolExecutable.xcconfig	2022-03-11 02:35:06 UTC (rev 291142)
@@ -54,6 +54,12 @@
 OTHER_CFLAGS = $(inherited) -isystem icu;
 
 // Explicitly add the PrivateHeaders directory to the search path so that generated header files can be found in production builds.
-HEADER_SEARCH_PATHS = "${BUILT_PRODUCTS_DIR}/DerivedSources/_javascript_Core" "${BUILT_PRODUCTS_DIR}/LLIntOffsets/${ARCHS}" "$(_javascript_CORE_FRAMEWORKS_DIR)/_javascript_Core.framework/PrivateHeaders" $(inherited);
+HEADER_SEARCH_PATHS = "${BUILT_PRODUCTS_DIR}/DerivedSources/_javascript_Core" $(HEADER_SEARCH_PATHS_$(WK_WHICH_BUILD_SYSTEM)) "$(_javascript_CORE_FRAMEWORKS_DIR)/_javascript_Core.framework/PrivateHeaders" $(inherited);
+// XCBuild generates LLIntOffsets in TARGET_TEMP_DIR, which does not need to be manually specifed.
+HEADER_SEARCH_PATHS_legacy = "${BUILT_PRODUCTS_DIR}/LLIntOffsets/${ARCHS}";
 
+EXCLUDED_SOURCE_FILE_NAMES = $(EXCLUDED_SOURCE_FILE_NAMES_$(WK_WHICH_BUILD_SYSTEM));
+// Offset and settings headers are built by separate targets and script phases in the legacy build system, not using build rules.
+EXCLUDED_SOURCE_FILE_NAMES_legacy = *.asm;
+
 OTHER_LDFLAGS = $(inherited) $(SOURCE_VERSION_LDFLAGS);

Modified: trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj (291141 => 291142)


--- trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj	2022-03-11 02:04:19 UTC (rev 291141)
+++ trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj	2022-03-11 02:35:06 UTC (rev 291142)
@@ -3,32 +3,32 @@
 	archiveVersion = 1;
 	classes = {
 	};
-	objectVersion = 51;
+	objectVersion = 52;
 	objects = {
 
 /* Begin PBXAggregateTarget section */
-		0F4680A914BA7FD900BFE272 /* LLInt Offsets */ = {
+		0F4680A914BA7FD900BFE272 /* (Legacy) LLInt Offsets */ = {
 			isa = PBXAggregateTarget;
-			buildConfigurationList = 0F4680AC14BA7FD900BFE272 /* Build configuration list for PBXAggregateTarget "LLInt Offsets" */;
+			buildConfigurationList = 0F4680AC14BA7FD900BFE272 /* Build configuration list for PBXAggregateTarget "(Legacy) LLInt Offsets" */;
 			buildPhases = (
-				0F4680AA14BA7FD900BFE272 /* Generate Derived Sources */,
+				0F4680AA14BA7FD900BFE272 /* (Legacy) Generate Derived Sources */,
 			);
 			dependencies = (
 				14BD68992151916D0050DAFF /* PBXTargetDependency */,
 			);
-			name = "LLInt Offsets";
+			name = "(Legacy) LLInt Offsets";
 			productName = "Derived Sources";
 		};
-		14BD688F215191450050DAFF /* LLInt Settings */ = {
+		14BD688F215191450050DAFF /* (Legacy) LLInt Settings */ = {
 			isa = PBXAggregateTarget;
-			buildConfigurationList = 14BD6893215191450050DAFF /* Build configuration list for PBXAggregateTarget "LLInt Settings" */;
+			buildConfigurationList = 14BD6893215191450050DAFF /* Build configuration list for PBXAggregateTarget "(Legacy) LLInt Settings" */;
 			buildPhases = (
-				14BD6892215191450050DAFF /* Generate Derived Sources */,
+				14BD6892215191450050DAFF /* (Legacy) Generate Derived Sources */,
 			);
 			dependencies = (
 				14BD6890215191450050DAFF /* PBXTargetDependency */,
 			);
-			name = "LLInt Settings";
+			name = "(Legacy) LLInt Settings";
 			productName = "Derived Sources";
 		};
 		5325BDBF21DFF2B100A0DEE1 /* Apply Configuration to XCFileLists */ = {
@@ -73,18 +73,18 @@
 			name = "Test Tools";
 			productName = "Test Tools";
 		};
-		65788A9D18B409EB00C189FF /* Offline Assembler */ = {
+		65788A9D18B409EB00C189FF /* (Legacy) Offline Assembler */ = {
 			isa = PBXAggregateTarget;
-			buildConfigurationList = 65788AA218B409EB00C189FF /* Build configuration list for PBXAggregateTarget "Offline Assembler" */;
+			buildConfigurationList = 65788AA218B409EB00C189FF /* Build configuration list for PBXAggregateTarget "(Legacy) Offline Assembler" */;
 			buildPhases = (
 				DDE9930C278D083D00F60D26 /* Product Dependencies */,
-				65788AA018B409EB00C189FF /* Offline Assemble */,
+				65788AA018B409EB00C189FF /* (Legacy) Offline Assemble */,
 			);
 			dependencies = (
 				65244BD318ECB5000010B708 /* PBXTargetDependency */,
 				65788A9E18B409EB00C189FF /* PBXTargetDependency */,
 			);
-			name = "Offline Assembler";
+			name = "(Legacy) Offline Assembler";
 			productName = "Offline Assembler";
 		};
 		65FB3F6609D11E9100F49DEB /* Derived Sources */ = {
@@ -1829,6 +1829,9 @@
 		DCF3D56D1CD29476003D5C65 /* LazyPropertyInlines.h in Headers */ = {isa = PBXBuildFile; fileRef = DCF3D5681CD29468003D5C65 /* LazyPropertyInlines.h */; };
 		DCFDFBD91D1F5D9B00FE3D72 /* B3BottomProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = DCFDFBD71D1F5D9800FE3D72 /* B3BottomProvider.h */; };
 		DCFDFBDA1D1F5D9E00FE3D72 /* B3TypeMap.h in Headers */ = {isa = PBXBuildFile; fileRef = DCFDFBD81D1F5D9800FE3D72 /* B3TypeMap.h */; };
+		DD41FA8627CDAD3200394D95 /* LowLevelInterpreter.asm in Sources */ = {isa = PBXBuildFile; fileRef = 86A054461556451B00445157 /* LowLevelInterpreter.asm */; };
+		DD41FA8727CDAD4300394D95 /* LowLevelInterpreter.asm in Sources */ = {isa = PBXBuildFile; fileRef = 86A054461556451B00445157 /* LowLevelInterpreter.asm */; };
+		DD41FA8927CDDDEF00394D95 /* LowLevelInterpreter.asm in Sources */ = {isa = PBXBuildFile; fileRef = 86A054461556451B00445157 /* LowLevelInterpreter.asm */; };
 		DDB04F41278E569A008D3678 /* libWTF.a in Product Dependencies */ = {isa = PBXBuildFile; fileRef = 1498CAD3214656C400710879 /* libWTF.a */; };
 		DDB04F42278E56A2008D3678 /* libWTF.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1498CAD3214656C400710879 /* libWTF.a */; };
 		DDE99310278D087D00F60D26 /* libWebKitAdditions.a in Product Dependencies */ = {isa = PBXBuildFile; fileRef = DDE9930E278D086600F60D26 /* libWebKitAdditions.a */; };
@@ -2158,6 +2161,56 @@
 			);
 			script = "exec \"${SRCROOT}/Scripts/postprocess-header-rule\"\n";
 		};
+		DD41FA7D27CDA6FE00394D95 /* PBXBuildRule */ = {
+			isa = PBXBuildRule;
+			compilerSpec = com.apple.compilers.proxy.script;
+			dependencyFile = "$(TARGET_TEMP_DIR)/$(INPUT_FILE_BASE).d";
+			filePatterns = "*.asm";
+			fileType = pattern.proxy;
+			inputFiles = (
+				"$(BUILT_PRODUCTS_DIR)/JSCLLIntOffsetsExtractor",
+				"$(SRCROOT)/offlineasm",
+			);
+			isEditable = 1;
+			outputFiles = (
+				"$(BUILT_PRODUCTS_DIR)/DerivedSources/_javascript_Core/LLIntAssembly.h",
+			);
+			runOncePerArchitecture = 0;
+			script = "OFFLINEASM_ARGS=\"\"\nif [[ \"${DEPLOYMENT_LOCATION}\" == \"YES\" ]]; then\n    OFFLINEASM_ARGS=\"${OFFLINEASM_ARGS} --webkit-additions-path=${WK_WEBKITADDITIONS_HEADERS_FOLDER_PATH}\"\nfi\n\ncd \"${BUILT_PRODUCTS_DIR}/DerivedSources/_javascript_Core\"\n\n/usr/bin/env ruby _javascript_Core/offlineasm/asm.rb \"-I${BUILT_PRODUCTS_DIR}/DerivedSources/_javascript_Core\" \"${INPUT_FILE_PATH}\" \"${SCRIPT_INPUT_FILE_0}\" \"${SCRIPT_OUTPUT_FILE_0}\" \"${BUILD_VARIANTS}\" ${OFFLINEASM_ARGS} --depfile=\"${TARGET_TEMP_DIR}/${INPUT_FILE_BASE}.d\"\n";
+		};
+		DD41FA7E27CDA89D00394D95 /* PBXBuildRule */ = {
+			isa = PBXBuildRule;
+			compilerSpec = com.apple.compilers.proxy.script;
+			dependencyFile = "$(TARGET_TEMP_DIR)/$(INPUT_FILE_BASE).d";
+			filePatterns = "*.asm";
+			fileType = pattern.proxy;
+			inputFiles = (
+				"$(BUILT_PRODUCTS_DIR)/JSCLLIntSettingsExtractor",
+				"$(SRCROOT)/offlineasm",
+			);
+			isEditable = 1;
+			outputFiles = (
+				"$(BUILT_PRODUCTS_DIR)/LLIntOffsets/$(ARCHS)/LLIntDesiredOffsets.h",
+			);
+			runOncePerArchitecture = 0;
+			script = "set -e\n\nOFFLINEASM_ARGS=\"\"\nif [[ \"${DEPLOYMENT_LOCATION}\" == \"YES\" ]]; then\n    OFFLINEASM_ARGS=\"${OFFLINEASM_ARGS} --webkit-additions-path=${WK_WEBKITADDITIONS_HEADERS_FOLDER_PATH}\"\nfi\n\n/usr/bin/env ruby \"${SRCROOT}/offlineasm/generate_offset_extractor.rb\" \"-I${BUILT_PRODUCTS_DIR}/DerivedSources/_javascript_Core\" \"${INPUT_FILE_PATH}\"  \"${BUILT_PRODUCTS_DIR}/JSCLLIntSettingsExtractor\" \"${SCRIPT_OUTPUT_FILE_0}\" \"${ARCHS} C_LOOP\" \"${BUILD_VARIANTS}\" ${OFFLINEASM_ARGS} --depfile=\"${TARGET_TEMP_DIR}/${INPUT_FILE_BASE}.d\"\n\n";
+		};
+		DD41FA8127CDAA5400394D95 /* PBXBuildRule */ = {
+			isa = PBXBuildRule;
+			compilerSpec = com.apple.compilers.proxy.script;
+			dependencyFile = "$(TARGET_TEMP_DIR)/$(INPUT_FILE_BASE).d";
+			filePatterns = "*.asm";
+			fileType = pattern.proxy;
+			inputFiles = (
+				"$(SRCROOT)/offlineasm",
+			);
+			isEditable = 1;
+			outputFiles = (
+				"$(BUILT_PRODUCTS_DIR)/LLIntOffsets/$(ARCHS)/LLIntDesiredSettings.h",
+			);
+			runOncePerArchitecture = 0;
+			script = "set -e\n\nOFFLINEASM_ARGS=\"\"\nif [[ \"${DEPLOYMENT_LOCATION}\" == \"YES\" ]]; then\n    OFFLINEASM_ARGS=\"${OFFLINEASM_ARGS} --webkit-additions-path=${WK_WEBKITADDITIONS_HEADERS_FOLDER_PATH}\"\nfi\n\n/usr/bin/env ruby \"${SRCROOT}/offlineasm/generate_settings_extractor.rb\" \"-I${BUILT_PRODUCTS_DIR}/DerivedSources/_javascript_Core\" \"${INPUT_FILE_PATH}\" \"${SCRIPT_OUTPUT_FILE_0}\" \"${ARCHS} C_LOOP\" ${OFFLINEASM_ARGS} --depfile=\"${TARGET_TEMP_DIR}/${INPUT_FILE_BASE}.d\"\n";
+		};
 /* End PBXBuildRule section */
 
 /* Begin PBXContainerItemProxy section */
@@ -2371,13 +2424,6 @@
 			remoteGlobalIDString = 65FB3F6609D11E9100F49DEB;
 			remoteInfo = "Derived Sources";
 		};
-		65788AAC18B40A7B00C189FF /* PBXContainerItemProxy */ = {
-			isa = PBXContainerItemProxy;
-			containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
-			proxyType = 1;
-			remoteGlobalIDString = 65788A9D18B409EB00C189FF;
-			remoteInfo = "Offline Assembler";
-		};
 		65FB3F7D09D11EF300F49DEB /* PBXContainerItemProxy */ = {
 			isa = PBXContainerItemProxy;
 			containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
@@ -2399,6 +2445,13 @@
 			remoteGlobalIDString = 932F5B3E0822A1C700736975;
 			remoteInfo = "_javascript_Core (Upgraded)";
 		};
+		DD41FA8A27CDE1C400394D95 /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 65788A9D18B409EB00C189FF;
+			remoteInfo = "(Legacy) Offline Assembler";
+		};
 		FE533CAE1F217EC60016A1FE /* PBXContainerItemProxy */ = {
 			isa = PBXContainerItemProxy;
 			containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
@@ -11417,6 +11470,7 @@
 				0FF922C614F46B130041A24E /* Frameworks */,
 			);
 			buildRules = (
+				DD41FA7E27CDA89D00394D95 /* PBXBuildRule */,
 			);
 			dependencies = (
 				14CFB10923035F1300F0048C /* PBXTargetDependency */,
@@ -11475,6 +11529,7 @@
 				14BD6888215191310050DAFF /* Frameworks */,
 			);
 			buildRules = (
+				DD41FA8127CDAA5400394D95 /* PBXBuildRule */,
 			);
 			dependencies = (
 				14CFB10723035F0F00F0048C /* PBXTargetDependency */,
@@ -11559,10 +11614,11 @@
 				6517571427C9860C00D9FE40 /* Copy Frameworks to Secondary Path */,
 			);
 			buildRules = (
+				DD41FA7D27CDA6FE00394D95 /* PBXBuildRule */,
 				535E08C222545AC800DF00CA /* PBXBuildRule */,
 			);
 			dependencies = (
-				65788AAD18B40A7B00C189FF /* PBXTargetDependency */,
+				DD41FA8B27CDE1C400394D95 /* PBXTargetDependency */,
 				65FB3F7E09D11EF300F49DEB /* PBXTargetDependency */,
 				53B4BD141F68C2AA00D2BEA3 /* PBXTargetDependency */,
 			);
@@ -11641,11 +11697,11 @@
 				932F5BE30822A1C700736975 /* All */,
 				932F5B3E0822A1C700736975 /* _javascript_Core */,
 				65FB3F6609D11E9100F49DEB /* Derived Sources */,
-				14BD688F215191450050DAFF /* LLInt Settings */,
+				14BD688F215191450050DAFF /* (Legacy) LLInt Settings */,
 				14BD6881215191310050DAFF /* JSCLLIntSettingsExtractor */,
-				0F4680A914BA7FD900BFE272 /* LLInt Offsets */,
+				0F4680A914BA7FD900BFE272 /* (Legacy) LLInt Offsets */,
 				0FF922C314F46B130041A24E /* JSCLLIntOffsetsExtractor */,
-				65788A9D18B409EB00C189FF /* Offline Assembler */,
+				65788A9D18B409EB00C189FF /* (Legacy) Offline Assembler */,
 				53B4BD041F68AF8900D2BEA3 /* Generate Unified Sources */,
 				E1AC2E2720F7B94C00B0897D /* Unlock Keychain */,
 				1412111F0A48793C00480255 /* minidom */,
@@ -11676,7 +11732,7 @@
 /* End PBXResourcesBuildPhase section */
 
 /* Begin PBXShellScriptBuildPhase section */
-		0F4680AA14BA7FD900BFE272 /* Generate Derived Sources */ = {
+		0F4680AA14BA7FD900BFE272 /* (Legacy) Generate Derived Sources */ = {
 			isa = PBXShellScriptBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
@@ -11683,14 +11739,14 @@
 			);
 			inputPaths = (
 			);
-			name = "Generate Derived Sources";
+			name = "(Legacy) Generate Derived Sources";
 			outputPaths = (
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 			shellPath = /bin/sh;
-			shellScript = "set -e\n\nOFFLINEASM_ARGS=\"\"\nif [[ \"${DEPLOYMENT_LOCATION}\" == \"YES\" ]]; then\n    OFFLINEASM_ARGS=\"${OFFLINEASM_ARGS} --webkit-additions-path=${WK_WEBKITADDITIONS_HEADERS_FOLDER_PATH}\"\nfi\n\nmkdir -p \"${BUILT_PRODUCTS_DIR}/LLIntOffsets/${ARCHS}\"\n\n/usr/bin/env ruby \"${SRCROOT}/offlineasm/generate_offset_extractor.rb\" \"-I${BUILT_PRODUCTS_DIR}/DerivedSources/_javascript_Core\" \"${SRCROOT}/llint/LowLevelInterpreter.asm\"  \"${BUILT_PRODUCTS_DIR}/JSCLLIntSettingsExtractor\" \"${BUILT_PRODUCTS_DIR}/LLIntOffsets/${ARCHS}/LLIntDesiredOffsets.h\" \"${ARCHS} C_LOOP\" \"${BUILD_VARIANTS}\" ${OFFLINEASM_ARGS}\n";
+			shellScript = "[ \"${WK_USE_NEW_BUILD_SYSTEM}\" = \"YES\" ] && exit 0\nset -e\n\nOFFLINEASM_ARGS=\"\"\nif [[ \"${DEPLOYMENT_LOCATION}\" == \"YES\" ]]; then\n    OFFLINEASM_ARGS=\"${OFFLINEASM_ARGS} --webkit-additions-path=${WK_WEBKITADDITIONS_HEADERS_FOLDER_PATH}\"\nfi\n\nmkdir -p \"${BUILT_PRODUCTS_DIR}/LLIntOffsets/${ARCHS}\"\n\n/usr/bin/env ruby \"${SRCROOT}/offlineasm/generate_offset_extractor.rb\" \"-I${BUILT_PRODUCTS_DIR}/DerivedSources/_javascript_Core\" \"${SRCROOT}/llint/LowLevelInterpreter.asm\"  \"${BUILT_PRODUCTS_DIR}/JSCLLIntSettingsExtractor\" \"${BUILT_PRODUCTS_DIR}/LLIntOffsets/${ARCHS}/LLIntDesiredOffsets.h\" \"${ARCHS} C_LOOP\" \"${BUILD_VARIANTS}\" ${OFFLINEASM_ARGS}\n";
 		};
-		14BD6892215191450050DAFF /* Generate Derived Sources */ = {
+		14BD6892215191450050DAFF /* (Legacy) Generate Derived Sources */ = {
 			isa = PBXShellScriptBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
@@ -11697,12 +11753,12 @@
 			);
 			inputPaths = (
 			);
-			name = "Generate Derived Sources";
+			name = "(Legacy) Generate Derived Sources";
 			outputPaths = (
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 			shellPath = /bin/sh;
-			shellScript = "set -e\n\nOFFLINEASM_ARGS=\"\"\nif [[ \"${DEPLOYMENT_LOCATION}\" == \"YES\" ]]; then\n    OFFLINEASM_ARGS=\"${OFFLINEASM_ARGS} --webkit-additions-path=${WK_WEBKITADDITIONS_HEADERS_FOLDER_PATH}\"\nfi\n\nmkdir -p \"${BUILT_PRODUCTS_DIR}/LLIntOffsets/${ARCHS}\"\n\n/usr/bin/env ruby \"${SRCROOT}/offlineasm/generate_settings_extractor.rb\" \"-I${BUILT_PRODUCTS_DIR}/DerivedSources/_javascript_Core\" \"${SRCROOT}/llint/LowLevelInterpreter.asm\" \"${BUILT_PRODUCTS_DIR}/LLIntOffsets/${ARCHS}/LLIntDesiredSettings.h\" \"${ARCHS} C_LOOP\" ${OFFLINEASM_ARGS}\n";
+			shellScript = "[ \"${WK_USE_NEW_BUILD_SYSTEM}\" = \"YES\" ] && exit 0\nset -e\n\nOFFLINEASM_ARGS=\"\"\nif [[ \"${DEPLOYMENT_LOCATION}\" == \"YES\" ]]; then\n    OFFLINEASM_ARGS=\"${OFFLINEASM_ARGS} --webkit-additions-path=${WK_WEBKITADDITIONS_HEADERS_FOLDER_PATH}\"\nfi\n\nmkdir -p \"${BUILT_PRODUCTS_DIR}/LLIntOffsets/${ARCHS}\"\n\n/usr/bin/env ruby \"${SRCROOT}/offlineasm/generate_settings_extractor.rb\" \"-I${BUILT_PRODUCTS_DIR}/DerivedSources/_javascript_Core\" \"${SRCROOT}/llint/LowLevelInterpreter.asm\" \"${BUILT_PRODUCTS_DIR}/LLIntOffsets/${ARCHS}/LLIntDesiredSettings.h\" \"${ARCHS} C_LOOP\" ${OFFLINEASM_ARGS}\n";
 		};
 		1A02D9A81B34A882000D1522 /* Add Symlink in /System/Library/PrivateFrameworks */ = {
 			isa = PBXShellScriptBuildPhase;
@@ -11959,7 +12015,7 @@
 			shellPath = /bin/zsh;
 			shellScript = "\"${SRCROOT}/Scripts/create-symlink-to-altroot.sh\"\n";
 		};
-		65788AA018B409EB00C189FF /* Offline Assemble */ = {
+		65788AA018B409EB00C189FF /* (Legacy) Offline Assemble */ = {
 			isa = PBXShellScriptBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
@@ -11966,12 +12022,12 @@
 			);
 			inputPaths = (
 			);
-			name = "Offline Assemble";
+			name = "(Legacy) Offline Assemble";
 			outputPaths = (
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 			shellPath = /bin/sh;
-			shellScript = "if [[ \"${ACTION}\" == \"installhdrs\" ]]; then\n    exit 0\nfi\n\nOFFLINEASM_ARGS=\"\"\nif [[ \"${DEPLOYMENT_LOCATION}\" == \"YES\" ]]; then\n    OFFLINEASM_ARGS=\"${OFFLINEASM_ARGS} --webkit-additions-path=${WK_WEBKITADDITIONS_HEADERS_FOLDER_PATH}\"\nfi\n\ncd \"${BUILT_PRODUCTS_DIR}/DerivedSources/_javascript_Core\"\n\n/usr/bin/env ruby _javascript_Core/offlineasm/asm.rb \"-I${BUILT_PRODUCTS_DIR}/DerivedSources/_javascript_Core\" _javascript_Core/llint/LowLevelInterpreter.asm \"${BUILT_PRODUCTS_DIR}/JSCLLIntOffsetsExtractor\" LLIntAssembly.h \"${BUILD_VARIANTS}\" ${OFFLINEASM_ARGS} || exit 1\n";
+			shellScript = "[ \"${WK_USE_NEW_BUILD_SYSTEM}\" = \"YES\" ] && exit 0\n\nif [[ \"${ACTION}\" == \"installhdrs\" ]]; then\n    exit 0\nfi\n\nOFFLINEASM_ARGS=\"\"\nif [[ \"${DEPLOYMENT_LOCATION}\" == \"YES\" ]]; then\n    OFFLINEASM_ARGS=\"${OFFLINEASM_ARGS} --webkit-additions-path=${WK_WEBKITADDITIONS_HEADERS_FOLDER_PATH}\"\nfi\n\ncd \"${BUILT_PRODUCTS_DIR}/DerivedSources/_javascript_Core\"\n\n/usr/bin/env ruby _javascript_Core/offlineasm/asm.rb \"-I${BUILT_PRODUCTS_DIR}/DerivedSources/_javascript_Core\" _javascript_Core/llint/LowLevelInterpreter.asm \"${BUILT_PRODUCTS_DIR}/JSCLLIntOffsetsExtractor\" LLIntAssembly.h \"${BUILD_VARIANTS}\" ${OFFLINEASM_ARGS} || exit 1\n";
 		};
 		65FB3F6509D11E9100F49DEB /* Generate Derived Sources */ = {
 			isa = PBXShellScriptBuildPhase;
@@ -12103,6 +12159,7 @@
 			isa = PBXSourcesBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
+				DD41FA8727CDAD4300394D95 /* LowLevelInterpreter.asm in Sources */,
 				0FF922D414F46B410041A24E /* LLIntOffsetsExtractor.cpp in Sources */,
 				DD41FA8727CDAD4300394D95 /* LowLevelInterpreter.asm in Sources */,
 			);
@@ -12151,6 +12208,7 @@
 			isa = PBXSourcesBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
+				DD41FA8627CDAD3200394D95 /* LowLevelInterpreter.asm in Sources */,
 				14BD689D215191C10050DAFF /* LLIntSettingsExtractor.cpp in Sources */,
 				DD41FA8627CDAD3200394D95 /* LowLevelInterpreter.asm in Sources */,
 			);
@@ -12246,6 +12304,7 @@
 				536B31341F71C5990037FC33 /* UnifiedSource40.cpp in Sources */,
 				536B31311F71C5990037FC33 /* UnifiedSource41.cpp in Sources */,
 				536B313B1F71C5990037FC33 /* UnifiedSource42.cpp in Sources */,
+				DD41FA8927CDDDEF00394D95 /* LowLevelInterpreter.asm in Sources */,
 				536B313E1F71C5990037FC33 /* UnifiedSource43.cpp in Sources */,
 				536B314C1F71C5990037FC33 /* UnifiedSource44.cpp in Sources */,
 				536B31511F71C5990037FC33 /* UnifiedSource45.cpp in Sources */,
@@ -12420,7 +12479,7 @@
 		};
 		0FF922D314F46B2F0041A24E /* PBXTargetDependency */ = {
 			isa = PBXTargetDependency;
-			target = 0F4680A914BA7FD900BFE272 /* LLInt Offsets */;
+			target = 0F4680A914BA7FD900BFE272 /* (Legacy) LLInt Offsets */;
 			targetProxy = 0FF922D214F46B2F0041A24E /* PBXContainerItemProxy */;
 		};
 		14BD6882215191310050DAFF /* PBXTargetDependency */ = {
@@ -12440,7 +12499,7 @@
 		};
 		14BD689B215191740050DAFF /* PBXTargetDependency */ = {
 			isa = PBXTargetDependency;
-			target = 14BD688F215191450050DAFF /* LLInt Settings */;
+			target = 14BD688F215191450050DAFF /* (Legacy) LLInt Settings */;
 			targetProxy = 14BD689A215191740050DAFF /* PBXContainerItemProxy */;
 		};
 		14CFB10023035EF300F0048C /* PBXTargetDependency */ = {
@@ -12553,11 +12612,6 @@
 			target = 65FB3F6609D11E9100F49DEB /* Derived Sources */;
 			targetProxy = 65788AAA18B40A3B00C189FF /* PBXContainerItemProxy */;
 		};
-		65788AAD18B40A7B00C189FF /* PBXTargetDependency */ = {
-			isa = PBXTargetDependency;
-			target = 65788A9D18B409EB00C189FF /* Offline Assembler */;
-			targetProxy = 65788AAC18B40A7B00C189FF /* PBXContainerItemProxy */;
-		};
 		65FB3F7E09D11EF300F49DEB /* PBXTargetDependency */ = {
 			isa = PBXTargetDependency;
 			target = 65FB3F6609D11E9100F49DEB /* Derived Sources */;
@@ -12573,6 +12627,11 @@
 			target = 932F5B3E0822A1C700736975 /* _javascript_Core */;
 			targetProxy = 932F5BE60822A1C700736975 /* PBXContainerItemProxy */;
 		};
+		DD41FA8B27CDE1C400394D95 /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 65788A9D18B409EB00C189FF /* (Legacy) Offline Assembler */;
+			targetProxy = DD41FA8A27CDE1C400394D95 /* PBXContainerItemProxy */;
+		};
 		FE533CAF1F217EC60016A1FE /* PBXTargetDependency */ = {
 			isa = PBXTargetDependency;
 			target = FE533CA11F217DB30016A1FE /* testmasm */;
@@ -13272,7 +13331,7 @@
 /* End XCBuildConfiguration section */
 
 /* Begin XCConfigurationList section */
-		0F4680AC14BA7FD900BFE272 /* Build configuration list for PBXAggregateTarget "LLInt Offsets" */ = {
+		0F4680AC14BA7FD900BFE272 /* Build configuration list for PBXAggregateTarget "(Legacy) LLInt Offsets" */ = {
 			isa = XCConfigurationList;
 			buildConfigurations = (
 				0F4680AD14BA7FD900BFE272 /* Debug */,
@@ -13404,7 +13463,7 @@
 			defaultConfigurationIsVisible = 0;
 			defaultConfigurationName = Production;
 		};
-		14BD6893215191450050DAFF /* Build configuration list for PBXAggregateTarget "LLInt Settings" */ = {
+		14BD6893215191450050DAFF /* Build configuration list for PBXAggregateTarget "(Legacy) LLInt Settings" */ = {
 			isa = XCConfigurationList;
 			buildConfigurations = (
 				14BD6894215191450050DAFF /* Debug */,
@@ -13481,7 +13540,7 @@
 			defaultConfigurationIsVisible = 0;
 			defaultConfigurationName = Production;
 		};
-		65788AA218B409EB00C189FF /* Build configuration list for PBXAggregateTarget "Offline Assembler" */ = {
+		65788AA218B409EB00C189FF /* Build configuration list for PBXAggregateTarget "(Legacy) Offline Assembler" */ = {
 			isa = XCConfigurationList;
 			buildConfigurations = (
 				65788AA318B409EB00C189FF /* Debug */,

Modified: trunk/Source/_javascript_Core/offlineasm/asm.rb (291141 => 291142)


--- trunk/Source/_javascript_Core/offlineasm/asm.rb	2022-03-11 02:04:19 UTC (rev 291141)
+++ trunk/Source/_javascript_Core/offlineasm/asm.rb	2022-03-11 02:35:06 UTC (rev 291142)
@@ -33,6 +33,7 @@
 require "parser"
 require "self_hash"
 require "settings"
+require "shellwords"
 require "transform"
 
 class Assembler
@@ -347,7 +348,7 @@
 
 $options = {}
 OptionParser.new do |opts|
-    opts.banner = "Usage: asm.rb asmFile offsetsFile outputFileName [--assembler=<ASM>] [--webkit-additions-path=<path>] [--binary-format=<format>]"
+    opts.banner = "Usage: asm.rb asmFile offsetsFile outputFileName [--assembler=<ASM>] [--webkit-additions-path=<path>] [--binary-format=<format>] [--depfile=<depfile>]"
     # This option is currently only used to specify the masm assembler
     opts.on("--assembler=[ASM]", "Specify an assembler to use.") do |assembler|
         $options[:assembler] = assembler
@@ -358,6 +359,9 @@
     opts.on("--binary-format=FORMAT", "Specify the binary format used by the target system.") do |format|
         $options[:binary_format] = format
     end
+    opts.on("--depfile=DEPFILE", "Path to write Makefile-style discovered dependencies to.") do |path|
+        $options[:depfile] = path
+    end
 end.parse!
 
 begin
@@ -384,7 +388,7 @@
     " " + selfHash +
     " " + Digest::SHA1.hexdigest($options.has_key?(:assembler) ? $options[:assembler] : "")
 
-if FileTest.exist? outputFlnm
+if FileTest.exist?(outputFlnm) and (not $options[:depfile] or FileTest.exist?($options[:depfile]))
     lastLine = nil
     File.open(outputFlnm, "r") {
         | file |
@@ -407,9 +411,16 @@
     $output = outp
 
     $asm = Assembler.new($output)
+
+    sources = Set.new
+    ast = parse(asmFile, $options, sources)
+    settingsCombinations = computeSettingsCombinations(ast)
     
-    ast = parse(asmFile, $options)
-    settingsCombinations = computeSettingsCombinations(ast)
+    if $options[:depfile]
+        depfile = File.open($options[:depfile], "w")
+        depfile.print(Shellwords.escape(outputFlnm), ": ")
+        depfile.puts(Shellwords.join(sources.sort))
+    end
 
     configurationList.each {
         | configuration |

Modified: trunk/Source/_javascript_Core/offlineasm/generate_offset_extractor.rb (291141 => 291142)


--- trunk/Source/_javascript_Core/offlineasm/generate_offset_extractor.rb	2022-03-11 02:04:19 UTC (rev 291141)
+++ trunk/Source/_javascript_Core/offlineasm/generate_offset_extractor.rb	2022-03-11 02:35:06 UTC (rev 291142)
@@ -33,6 +33,7 @@
 require "parser"
 require "self_hash"
 require "settings"
+require "shellwords"
 require "transform"
 
 IncludeFile.processIncludeOptions()
@@ -48,10 +49,13 @@
 
 $options = {}
 OptionParser.new do |opts|
-    opts.banner = "Usage: generate_offset_extractor.rb asmFile settingFile outputFileName backends variants [--webkit-additions-path=<path>]"
+    opts.banner = "Usage: generate_offset_extractor.rb asmFile settingFile outputFileName backends variants [--webkit-additions-path=<path>] [--depfile=<depfile>]"
     opts.on("--webkit-additions-path=PATH", "WebKitAdditions path.") do |path|
         $options[:webkit_additions_path] = path
     end
+    opts.on("--depfile=DEPFILE", "path to write Makefile-style discovered dependencies to.") do |path|
+        $options[:depfile] = path
+    end
 end.parse!
 
 begin
@@ -71,7 +75,7 @@
 configurationHash = Digest::SHA1.hexdigest(configurationList.join(' '))
 inputHash = "// OffsetExtractor input hash: #{parseHash(inputFlnm, $options)} #{configurationHash} #{selfHash}"
 
-if FileTest.exist? outputFlnm
+if FileTest.exist?(outputFlnm) and (not $options[:depfile] or FileTest.exist?($options[:depfile]))
     File.open(outputFlnm, "r") {
         | inp |
         firstLine = inp.gets
@@ -82,9 +86,16 @@
     }
 end
 
-ast = parse(inputFlnm, $options)
+sources = Set.new
+ast = parse(inputFlnm, $options, sources)
 settingsCombinations = computeSettingsCombinations(ast)
 
+if $options[:depfile]
+    depfile = File.open($options[:depfile], "w")
+    depfile.print(Shellwords.escape(outputFlnm), ": ")
+    depfile.puts(Shellwords.join(sources.sort))
+end
+
 File.open(outputFlnm, "w") {
     | outp |
     $output = outp

Modified: trunk/Source/_javascript_Core/offlineasm/generate_settings_extractor.rb (291141 => 291142)


--- trunk/Source/_javascript_Core/offlineasm/generate_settings_extractor.rb	2022-03-11 02:04:19 UTC (rev 291141)
+++ trunk/Source/_javascript_Core/offlineasm/generate_settings_extractor.rb	2022-03-11 02:35:06 UTC (rev 291142)
@@ -33,6 +33,7 @@
 require "parser"
 require "self_hash"
 require "settings"
+require "shellwords"
 require "transform"
 
 IncludeFile.processIncludeOptions()
@@ -45,15 +46,18 @@
 
 $options = {}
 OptionParser.new do |opts|
-    opts.banner = "Usage: generate_settings_extractor.rb asmFile settingFile [--webkit-additions-path=<path>]"
+    opts.banner = "Usage: generate_settings_extractor.rb asmFile settingFile [--webkit-additions-path=<path>] [--depfile=<depfile>]"
     opts.on("--webkit-additions-path=PATH", "WebKitAdditions path.") do |path|
         $options[:webkit_additions_path] = path
     end
+    opts.on("--depfile=DEPFILE", "path to write Makefile-style discovered dependencies to.") do |path|
+        $options[:depfile] = path
+    end
 end.parse!
 
 inputHash = "// SettingsExtractor input hash: #{parseHash(inputFlnm, $options)} #{selfHash}"
 
-if FileTest.exist? outputFlnm
+if FileTest.exist?(outputFlnm) and (not $options[:depfile] or FileTest.exist?($options[:depfile]))
     File.open(outputFlnm, "r") {
         | inp |
         firstLine = inp.gets
@@ -64,9 +68,16 @@
     }
 end
 
-originalAST = parse(inputFlnm, $options)
+sources = Set.new
+originalAST = parse(inputFlnm, $options, sources)
 prunedAST = Sequence.new(originalAST.codeOrigin, originalAST.filter(Setting))
 
+if $options[:depfile]
+    depfile = File.open($options[:depfile], "w")
+    depfile.print(Shellwords.escape(outputFlnm), ": ")
+    depfile.puts(Shellwords.join(sources.sort))
+end
+
 File.open(outputFlnm, "w") {
     | outp |
     $output = outp

Modified: trunk/Source/_javascript_Core/offlineasm/parser.rb (291141 => 291142)


--- trunk/Source/_javascript_Core/offlineasm/parser.rb	2022-03-11 02:04:19 UTC (rev 291141)
+++ trunk/Source/_javascript_Core/offlineasm/parser.rb	2022-03-11 02:35:06 UTC (rev 291142)
@@ -260,7 +260,7 @@
 #
 
 class Parser
-    def initialize(data, fileName, options)
+    def initialize(data, fileName, options, sources=nil)
         @tokens = lex(data, fileName)
         @idx = 0
         @annotation = nil
@@ -268,6 +268,7 @@
         # https://bugs.webkit.org/show_bug.cgi?id=229340
         @buildProductsDirectory = ENV['BUILT_PRODUCTS_DIR'];
         @options = options
+        @sources = sources
     end
     
     def parseError(*comment)
@@ -843,7 +844,7 @@
                 end
                 fileExists = File.exists?(fileName)
                 raise "File not found: #{fileName}" if not fileExists and not isOptional
-                list << parse(fileName, @options) if fileExists
+                list << parse(fileName, @options, @sources) if fileExists
             else
                 parseError "Expecting terminal #{final} #{comment}"
             end
@@ -900,13 +901,14 @@
     return data
 end
 
-def parseData(data, fileName, options)
-    parser = Parser.new(data, SourceFile.new(fileName), options)
+def parseData(data, fileName, options, sources)
+    parser = Parser.new(data, SourceFile.new(fileName), options, sources)
     parser.parseSequence(nil, "")
 end
 
-def parse(fileName, options)
-    parseData(readTextFile(fileName), fileName, options)
+def parse(fileName, options, sources=nil)
+    sources << fileName if sources
+    parseData(readTextFile(fileName), fileName, options, sources)
 end
 
 def parseHash(fileName, options)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to