Unreviewed revert Fujii's revert in r237214 with new WinCairo build fix.
authorkeith_miller@apple.com <keith_miller@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 17 Oct 2018 14:10:44 +0000 (14:10 +0000)
committerkeith_miller@apple.com <keith_miller@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 17 Oct 2018 14:10:44 +0000 (14:10 +0000)
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@237219 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/JavaScriptCore/CMakeLists.txt
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
Source/JavaScriptCore/assembler/Printer.h
Source/JavaScriptCore/llint/LLIntOffsetsExtractor.cpp
Source/JavaScriptCore/llint/LLIntSettingsExtractor.cpp [new file with mode: 0644]
Source/JavaScriptCore/offlineasm/generate_offset_extractor.rb
Source/JavaScriptCore/offlineasm/generate_settings_extractor.rb [new file with mode: 0644]
Source/JavaScriptCore/offlineasm/offsets.rb
Source/JavaScriptCore/offlineasm/settings.rb

index 33609a5..2291b03 100644 (file)
@@ -238,10 +238,17 @@ else ()
 endif ()
 
 add_custom_command(
+    OUTPUT ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/LLIntDesiredSettings.h
+    MAIN_DEPENDENCY ${JAVASCRIPTCORE_DIR}/offlineasm/generate_settings_extractor.rb
+    DEPENDS ${LLINT_ASM} ${OFFLINE_ASM} ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/InitBytecodes.asm
+    COMMAND ${RUBY_EXECUTABLE} ${JAVASCRIPTCORE_DIR}/offlineasm/generate_settings_extractor.rb -I${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/ ${JAVASCRIPTCORE_DIR}/llint/LowLevelInterpreter.asm ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/LLIntDesiredSettings.h ${OFFLINE_ASM_BACKEND}
+    VERBATIM)
+
+add_custom_command(
     OUTPUT ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/LLIntDesiredOffsets.h
     MAIN_DEPENDENCY ${JAVASCRIPTCORE_DIR}/offlineasm/generate_offset_extractor.rb
-    DEPENDS ${LLINT_ASM} ${OFFLINE_ASM} ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/InitBytecodes.asm
-    COMMAND ${RUBY_EXECUTABLE} ${JAVASCRIPTCORE_DIR}/offlineasm/generate_offset_extractor.rb -I${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/ ${JAVASCRIPTCORE_DIR}/llint/LowLevelInterpreter.asm ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/LLIntDesiredOffsets.h ${OFFLINE_ASM_BACKEND}
+    DEPENDS LLIntSettingsExtractor ${LLINT_ASM} ${OFFLINE_ASM} ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/InitBytecodes.asm
+    COMMAND ${RUBY_EXECUTABLE} ${JAVASCRIPTCORE_DIR}/offlineasm/generate_offset_extractor.rb -I${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/ ${JAVASCRIPTCORE_DIR}/llint/LowLevelInterpreter.asm $<TARGET_FILE:LLIntSettingsExtractor> ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/LLIntDesiredOffsets.h ${OFFLINE_ASM_BACKEND}
     VERBATIM)
 
 # We add the header files directly to the ADD_EXECUTABLE call instead of setting the
@@ -253,10 +260,18 @@ add_custom_command(
 # Additionally, setting the OBJECT_DEPENDS property will make the .h files a Makefile
 # dependency of both LLIntOffsetsExtractor and LLIntOffsetsExtractor.cpp, so the command will
 # actually be run multiple times!
+add_executable(LLIntSettingsExtractor
+    ${JAVASCRIPTCORE_DIR}/llint/LLIntSettingsExtractor.cpp
+    ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/LLIntDesiredSettings.h ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/Bytecodes.h ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/BytecodeStructs.h
+)
+
 add_executable(LLIntOffsetsExtractor
     ${JAVASCRIPTCORE_DIR}/llint/LLIntOffsetsExtractor.cpp
     ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/LLIntDesiredOffsets.h ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/Bytecodes.h ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/BytecodeStructs.h
 )
+
+target_link_libraries(LLIntSettingsExtractor WTF)
+add_dependencies(LLIntSettingsExtractor JavaScriptCoreForwardingHeaders)
 target_link_libraries(LLIntOffsetsExtractor WTF)
 add_dependencies(LLIntOffsetsExtractor JavaScriptCoreForwardingHeaders)
 
@@ -1219,6 +1234,12 @@ WEBKIT_MAKE_FORWARDING_HEADERS(JavaScriptCore
     FLATTENED
 )
 
+target_include_directories(LLIntSettingsExtractor PRIVATE
+    ${JavaScriptCore_INCLUDE_DIRECTORIES}
+    ${JavaScriptCore_PRIVATE_INCLUDE_DIRECTORIES}
+)
+target_include_directories(LLIntSettingsExtractor SYSTEM PRIVATE ${JavaScriptCore_SYSTEM_INCLUDE_DIRECTORIES})
+
 target_include_directories(LLIntOffsetsExtractor PRIVATE
     ${JavaScriptCore_INCLUDE_DIRECTORIES}
     ${JavaScriptCore_PRIVATE_INCLUDE_DIRECTORIES}
index 1ce4c80..fe82449 100644 (file)
@@ -1,3 +1,7 @@
+2018-10-17  Keith Miller  <keith_miller@apple.com>
+
+        Unreviewed revert Fujii's revert in r237214 with new WinCairo build fix.
+
 2018-10-16  Mark Lam  <mark.lam@apple.com>
 
         GetIndexedPropertyStorage can GC.
index 8d50dc3..a60d671 100644 (file)
                        );
                        dependencies = (
                                65442D5018EBB744007AF92F /* PBXTargetDependency */,
+                               14BD68992151916D0050DAFF /* PBXTargetDependency */,
                        );
                        name = "LLInt Offsets";
                        productName = "Derived Sources";
                };
+               14BD688F215191450050DAFF /* LLInt Settings */ = {
+                       isa = PBXAggregateTarget;
+                       buildConfigurationList = 14BD6893215191450050DAFF /* Build configuration list for PBXAggregateTarget "LLInt Settings" */;
+                       buildPhases = (
+                               14BD6892215191450050DAFF /* Generate Derived Sources */,
+                       );
+                       dependencies = (
+                               14BD6890215191450050DAFF /* PBXTargetDependency */,
+                       );
+                       name = "LLInt Settings";
+                       productName = "Derived Sources";
+               };
                53B4BD041F68AF8900D2BEA3 /* Generate Unified Sources */ = {
                        isa = PBXAggregateTarget;
                        buildConfigurationList = 53B4BD0A1F68AF8900D2BEA3 /* Build configuration list for PBXAggregateTarget "Generate Unified Sources" */;
                14BA78F113AAB88F005B7C2C /* SlotVisitor.h in Headers */ = {isa = PBXBuildFile; fileRef = 14BA78F013AAB88F005B7C2C /* SlotVisitor.h */; settings = {ATTRIBUTES = (Private, ); }; };
                14BA7A9813AADFF8005B7C2C /* Heap.h in Headers */ = {isa = PBXBuildFile; fileRef = 14BA7A9613AADFF8005B7C2C /* Heap.h */; settings = {ATTRIBUTES = (Private, ); }; };
                14BD59C50A3E8F9F00BAF59C /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 932F5BD90822A1C700736975 /* JavaScriptCore.framework */; };
+               14BD689D215191C10050DAFF /* LLIntSettingsExtractor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 14BD689C215191B30050DAFF /* LLIntSettingsExtractor.cpp */; };
                14BE7D3317135CF400D1807A /* WeakInlines.h in Headers */ = {isa = PBXBuildFile; fileRef = 14BE7D3217135CF400D1807A /* WeakInlines.h */; settings = {ATTRIBUTES = (Private, ); }; };
                14BFCE6910CDB1FC00364CCE /* WeakGCMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 14BFCE6810CDB1FC00364CCE /* WeakGCMap.h */; settings = {ATTRIBUTES = (Private, ); }; };
                14CA958B16AB50DE00938A06 /* StaticPropertyAnalyzer.h in Headers */ = {isa = PBXBuildFile; fileRef = 14CA958A16AB50DE00938A06 /* StaticPropertyAnalyzer.h */; settings = {ATTRIBUTES = (Private, ); }; };
                        remoteGlobalIDString = 0F4680A914BA7FD900BFE272;
                        remoteInfo = "LLInt Offsets";
                };
+               14BD6883215191310050DAFF /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = 65FB3F6609D11E9100F49DEB;
+                       remoteInfo = "Derived Sources";
+               };
+               14BD6891215191450050DAFF /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = 65FB3F6609D11E9100F49DEB;
+                       remoteInfo = "Derived Sources";
+               };
+               14BD68982151916D0050DAFF /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = 14BD6881215191310050DAFF;
+                       remoteInfo = JSCLLIntSettingsExtractor;
+               };
+               14BD689A215191740050DAFF /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = 14BD688F215191450050DAFF;
+                       remoteInfo = "LLInt Settings";
+               };
                53B4BD131F68C2AA00D2BEA3 /* PBXContainerItemProxy */ = {
                        isa = PBXContainerItemProxy;
                        containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
                14BD5A2A0A3E91F600BAF59C /* JSContextRef.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSContextRef.h; sourceTree = "<group>"; };
                14BD5A2B0A3E91F600BAF59C /* JSValueRef.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSValueRef.cpp; sourceTree = "<group>"; };
                14BD5A2D0A3E91F600BAF59C /* testapi.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = testapi.c; path = API/tests/testapi.c; sourceTree = "<group>"; };
+               14BD688E215191310050DAFF /* JSCLLIntSettingsExtractor */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = JSCLLIntSettingsExtractor; sourceTree = BUILT_PRODUCTS_DIR; };
+               14BD689C215191B30050DAFF /* LLIntSettingsExtractor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LLIntSettingsExtractor.cpp; path = llint/LLIntSettingsExtractor.cpp; sourceTree = "<group>"; };
                14BE7D3217135CF400D1807A /* WeakInlines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WeakInlines.h; sourceTree = "<group>"; };
                14BFCE6810CDB1FC00364CCE /* WeakGCMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WeakGCMap.h; sourceTree = "<group>"; };
                14CA958A16AB50DE00938A06 /* StaticPropertyAnalyzer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StaticPropertyAnalyzer.h; sourceTree = "<group>"; };
                5C4E8E951DBEBDA20036F1FC /* JSONParseTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSONParseTest.h; path = API/tests/JSONParseTest.h; sourceTree = "<group>"; };
                5D5D8AD00E0D0EBE00F9C692 /* libedit.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libedit.dylib; path = /usr/lib/libedit.dylib; sourceTree = "<absolute>"; };
                5DAFD6CB146B686300FBEFB4 /* JSC.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = JSC.xcconfig; sourceTree = "<group>"; };
-               5DDDF44614FEE72200B4FB4D /* LLIntDesiredOffsets.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LLIntDesiredOffsets.h; path = LLIntOffsets/LLIntDesiredOffsets.h; sourceTree = BUILT_PRODUCTS_DIR; };
                5DE3D0F40DD8DDFB00468714 /* WebKitAvailability.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebKitAvailability.h; sourceTree = "<group>"; };
                623A37EB1B87A7BD00754209 /* RegisterMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RegisterMap.h; sourceTree = "<group>"; };
                627673211B680C1E00FD9F2E /* CallMode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CallMode.cpp; sourceTree = "<group>"; };
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
+               14BD6888215191310050DAFF /* Frameworks */ = {
+                       isa = PBXFrameworksBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
                651122FC14046A4C002B101D /* Frameworks */ = {
                        isa = PBXFrameworksBuildPhase;
                        buildActionMask = 2147483647;
                                0F9327591C20BCBA00CF6564 /* dynbench */,
                                932F5BE10822A1C700736975 /* jsc */,
                                0FF922CF14F46B130041A24E /* JSCLLIntOffsetsExtractor */,
+                               14BD688E215191310050DAFF /* JSCLLIntSettingsExtractor */,
                                141211200A48793C00480255 /* minidom */,
                                0F6183431C45F62A0072450B /* testair */,
                                14BD59BF0A3E8F9000BAF59C /* testapi */,
                                0F4680C514BBB16900BFE272 /* LLIntCommon.h */,
                                0F4680CE14BBB3D100BFE272 /* LLIntData.cpp */,
                                0F4680CF14BBB3D100BFE272 /* LLIntData.h */,
-                               5DDDF44614FEE72200B4FB4D /* LLIntDesiredOffsets.h */,
                                0F38B00F17CF077F00B144D3 /* LLIntEntrypoint.cpp */,
                                0F38B01017CF077F00B144D3 /* LLIntEntrypoint.h */,
                                0F46809D14BA7F8200BFE272 /* LLIntExceptions.cpp */,
                                0F4680A114BA7F8200BFE272 /* LLIntOffsetsExtractor.cpp */,
                                FED287B115EC9A5700DA8161 /* LLIntOpcode.h */,
                                79CFC6EF1C33B10000C768EA /* LLIntPCRanges.h */,
+                               14BD689C215191B30050DAFF /* LLIntSettingsExtractor.cpp */,
                                0F46809F14BA7F8200BFE272 /* LLIntSlowPaths.cpp */,
                                0F4680A014BA7F8200BFE272 /* LLIntSlowPaths.h */,
                                0F0B839714BCF45A00885B4F /* LLIntThunks.cpp */,
                        productReference = 14BD59BF0A3E8F9000BAF59C /* testapi */;
                        productType = "com.apple.product-type.tool";
                };
+               14BD6881215191310050DAFF /* JSCLLIntSettingsExtractor */ = {
+                       isa = PBXNativeTarget;
+                       buildConfigurationList = 14BD6889215191310050DAFF /* Build configuration list for PBXNativeTarget "JSCLLIntSettingsExtractor" */;
+                       buildPhases = (
+                               14BD6886215191310050DAFF /* Sources */,
+                               14BD6888215191310050DAFF /* Frameworks */,
+                       );
+                       buildRules = (
+                       );
+                       dependencies = (
+                               14BD6882215191310050DAFF /* PBXTargetDependency */,
+                               14BD689B215191740050DAFF /* PBXTargetDependency */,
+                       );
+                       name = JSCLLIntSettingsExtractor;
+                       productInstallPath = /usr/local/bin;
+                       productName = jsc;
+                       productReference = 14BD688E215191310050DAFF /* JSCLLIntSettingsExtractor */;
+                       productType = "com.apple.product-type.tool";
+               };
                651122F714046A4C002B101D /* testRegExp */ = {
                        isa = PBXNativeTarget;
                        buildConfigurationList = 6511230014046A4C002B101D /* Build configuration list for PBXNativeTarget "testRegExp" */;
                        targets = (
                                932F5BE30822A1C700736975 /* All */,
                                932F5B3E0822A1C700736975 /* JavaScriptCore */,
-                               0F4680A914BA7FD900BFE272 /* LLInt Offsets */,
                                65FB3F6609D11E9100F49DEB /* Derived Sources */,
+                               14BD688F215191450050DAFF /* LLInt Settings */,
+                               14BD6881215191310050DAFF /* JSCLLIntSettingsExtractor */,
+                               0F4680A914BA7FD900BFE272 /* LLInt Offsets */,
                                0FF922C314F46B130041A24E /* JSCLLIntOffsetsExtractor */,
                                65788A9D18B409EB00C189FF /* Offline Assembler */,
                                53B4BD041F68AF8900D2BEA3 /* Generate Unified Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                        shellPath = /bin/sh;
-                       shellScript = "set -e\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/JavaScriptCore\" \"${SRCROOT}/llint/LowLevelInterpreter.asm\" \"${BUILT_PRODUCTS_DIR}/LLIntOffsets/${ARCHS}/LLIntDesiredOffsets.h\" \"${ARCHS} C_LOOP\"\n";
+                       shellScript = "set -e\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/JavaScriptCore\" \"${SRCROOT}/llint/LowLevelInterpreter.asm\"  \"${BUILT_PRODUCTS_DIR}/JSCLLIntSettingsExtractor\" \"${BUILT_PRODUCTS_DIR}/LLIntOffsets/${ARCHS}/LLIntDesiredOffsets.h\" \"${ARCHS} C_LOOP\"\n";
+               };
+               14BD6892215191450050DAFF /* Generate Derived Sources */ = {
+                       isa = PBXShellScriptBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       inputPaths = (
+                       );
+                       name = "Generate Derived Sources";
+                       outputPaths = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+                       shellPath = /bin/sh;
+                       shellScript = "set -e\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/JavaScriptCore\" \"${SRCROOT}/llint/LowLevelInterpreter.asm\" \"${BUILT_PRODUCTS_DIR}/LLIntOffsets/${ARCHS}/LLIntDesiredSettings.h\" \"${ARCHS} C_LOOP\"\n";
                };
                1A02D9A81B34A882000D1522 /* Add Symlink in /System/Library/PrivateFrameworks */ = {
                        isa = PBXShellScriptBuildPhase;
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
+               14BD6886215191310050DAFF /* Sources */ = {
+                       isa = PBXSourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               14BD689D215191C10050DAFF /* LLIntSettingsExtractor.cpp in Sources */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
                651122FA14046A4C002B101D /* Sources */ = {
                        isa = PBXSourcesBuildPhase;
                        buildActionMask = 2147483647;
                        target = 0F4680A914BA7FD900BFE272 /* LLInt Offsets */;
                        targetProxy = 0FF922D214F46B2F0041A24E /* PBXContainerItemProxy */;
                };
+               14BD6882215191310050DAFF /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 65FB3F6609D11E9100F49DEB /* Derived Sources */;
+                       targetProxy = 14BD6883215191310050DAFF /* PBXContainerItemProxy */;
+               };
+               14BD6890215191450050DAFF /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 65FB3F6609D11E9100F49DEB /* Derived Sources */;
+                       targetProxy = 14BD6891215191450050DAFF /* PBXContainerItemProxy */;
+               };
+               14BD68992151916D0050DAFF /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 14BD6881215191310050DAFF /* JSCLLIntSettingsExtractor */;
+                       targetProxy = 14BD68982151916D0050DAFF /* PBXContainerItemProxy */;
+               };
+               14BD689B215191740050DAFF /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 14BD688F215191450050DAFF /* LLInt Settings */;
+                       targetProxy = 14BD689A215191740050DAFF /* PBXContainerItemProxy */;
+               };
                53B4BD141F68C2AA00D2BEA3 /* PBXTargetDependency */ = {
                        isa = PBXTargetDependency;
                        target = 53B4BD041F68AF8900D2BEA3 /* Generate Unified Sources */;
                        };
                        name = Production;
                };
+               14BD688A215191310050DAFF /* Debug */ = {
+                       isa = XCBuildConfiguration;
+                       baseConfigurationReference = BC021BF2136900C300FC5467 /* ToolExecutable.xcconfig */;
+                       buildSettings = {
+                               HEADER_SEARCH_PATHS = (
+                                       "\"${BUILT_PRODUCTS_DIR}/DerivedSources/JavaScriptCore\"",
+                                       "\"${BUILT_PRODUCTS_DIR}/LLIntOffsets/${ARCHS}\"",
+                                       "\"$(JAVASCRIPTCORE_FRAMEWORKS_DIR)/JavaScriptCore.framework/PrivateHeaders\"",
+                                       "$(inherited)",
+                               );
+                               PRODUCT_NAME = "$(TARGET_NAME)";
+                       };
+                       name = Debug;
+               };
+               14BD688B215191310050DAFF /* Release */ = {
+                       isa = XCBuildConfiguration;
+                       baseConfigurationReference = BC021BF2136900C300FC5467 /* ToolExecutable.xcconfig */;
+                       buildSettings = {
+                               HEADER_SEARCH_PATHS = (
+                                       "\"${BUILT_PRODUCTS_DIR}/DerivedSources/JavaScriptCore\"",
+                                       "\"${BUILT_PRODUCTS_DIR}/LLIntOffsets/${ARCHS}\"",
+                                       "\"$(JAVASCRIPTCORE_FRAMEWORKS_DIR)/JavaScriptCore.framework/PrivateHeaders\"",
+                                       "$(inherited)",
+                               );
+                               PRODUCT_NAME = "$(TARGET_NAME)";
+                       };
+                       name = Release;
+               };
+               14BD688C215191310050DAFF /* Profiling */ = {
+                       isa = XCBuildConfiguration;
+                       baseConfigurationReference = BC021BF2136900C300FC5467 /* ToolExecutable.xcconfig */;
+                       buildSettings = {
+                               HEADER_SEARCH_PATHS = (
+                                       "\"${BUILT_PRODUCTS_DIR}/DerivedSources/JavaScriptCore\"",
+                                       "\"${BUILT_PRODUCTS_DIR}/LLIntOffsets/${ARCHS}\"",
+                                       "\"$(JAVASCRIPTCORE_FRAMEWORKS_DIR)/JavaScriptCore.framework/PrivateHeaders\"",
+                                       "$(inherited)",
+                               );
+                               PRODUCT_NAME = "$(TARGET_NAME)";
+                       };
+                       name = Profiling;
+               };
+               14BD688D215191310050DAFF /* Production */ = {
+                       isa = XCBuildConfiguration;
+                       baseConfigurationReference = BC021BF2136900C300FC5467 /* ToolExecutable.xcconfig */;
+                       buildSettings = {
+                               HEADER_SEARCH_PATHS = (
+                                       "\"${BUILT_PRODUCTS_DIR}/DerivedSources/JavaScriptCore\"",
+                                       "\"${BUILT_PRODUCTS_DIR}/LLIntOffsets/${ARCHS}\"",
+                                       "\"$(JAVASCRIPTCORE_FRAMEWORKS_DIR)/JavaScriptCore.framework/PrivateHeaders\"",
+                                       "$(inherited)",
+                               );
+                               PRODUCT_NAME = "$(TARGET_NAME)";
+                       };
+                       name = Production;
+               };
+               14BD6894215191450050DAFF /* Debug */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               PRODUCT_NAME = "$(TARGET_NAME)";
+                       };
+                       name = Debug;
+               };
+               14BD6895215191450050DAFF /* Release */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               PRODUCT_NAME = "$(TARGET_NAME)";
+                       };
+                       name = Release;
+               };
+               14BD6896215191450050DAFF /* Profiling */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               PRODUCT_NAME = "$(TARGET_NAME)";
+                       };
+                       name = Profiling;
+               };
+               14BD6897215191450050DAFF /* Production */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               PRODUCT_NAME = "$(TARGET_NAME)";
+                       };
+                       name = Production;
+               };
                53B4BD0B1F68AF8900D2BEA3 /* Debug */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
                        defaultConfigurationIsVisible = 0;
                        defaultConfigurationName = Production;
                };
+               14BD6889215191310050DAFF /* Build configuration list for PBXNativeTarget "JSCLLIntSettingsExtractor" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               14BD688A215191310050DAFF /* Debug */,
+                               14BD688B215191310050DAFF /* Release */,
+                               14BD688C215191310050DAFF /* Profiling */,
+                               14BD688D215191310050DAFF /* Production */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Production;
+               };
+               14BD6893215191450050DAFF /* Build configuration list for PBXAggregateTarget "LLInt Settings" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               14BD6894215191450050DAFF /* Debug */,
+                               14BD6895215191450050DAFF /* Release */,
+                               14BD6896215191450050DAFF /* Profiling */,
+                               14BD6897215191450050DAFF /* Production */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Production;
+               };
                53B4BD0A1F68AF8900D2BEA3 /* Build configuration list for PBXAggregateTarget "Generate Unified Sources" */ = {
                        isa = XCConfigurationList;
                        buildConfigurations = (
index 6d46cd9..3318dfc 100644 (file)
@@ -25,6 +25,8 @@
 
 #pragma once
 
+#include "CPU.h"
+
 #include <wtf/PrintStream.h>
 #include <wtf/StringPrintStream.h>
 #include <wtf/Vector.h>
index 4bfd6e9..6174b94 100644 (file)
@@ -60,6 +60,7 @@
 #include "VM.h"
 #include "ValueProfile.h"
 #include "Watchdog.h"
+#include <stdio.h>
 #include <wtf/text/StringImpl.h>
 
 namespace JSC {
@@ -80,7 +81,7 @@ const int64_t* LLIntOffsetsExtractor::dummy()
 // classes friends with LLIntOffsetsExtractor, and include the header here, to get the C++
 // compiler to kindly step aside and yield to our best intentions.
 #include "LLIntDesiredOffsets.h"
-    return extractorTable;
+    return offsetExtractorTable;
 }
 
 } // namespace JSC
diff --git a/Source/JavaScriptCore/llint/LLIntSettingsExtractor.cpp b/Source/JavaScriptCore/llint/LLIntSettingsExtractor.cpp
new file mode 100644 (file)
index 0000000..145303d
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2012-2018 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#include "LLIntOfflineAsmConfig.h"
+#include <stdio.h>
+
+int main(int, char**)
+{
+#include "LLIntDesiredSettings.h"
+    printf("%p\n", settingsExtractorTable);
+    return 0;
+}
index fff3982..ce3b54d 100644 (file)
@@ -1,6 +1,6 @@
 #!/usr/bin/env ruby
 
-# Copyright (C) 2011 Apple Inc. All rights reserved.
+# Copyright (C) 2011-2018 Apple Inc. All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
 # modification, are permitted provided that the following conditions
@@ -37,11 +37,19 @@ require "transform"
 IncludeFile.processIncludeOptions()
 
 inputFlnm = ARGV.shift
+settingsFlnm = ARGV.shift
 outputFlnm = ARGV.shift
 
 validBackends = canonicalizeBackendNames(ARGV.shift.split(/[,\s]+/))
 includeOnlyBackends(validBackends)
 
+begin
+    configurationList = configurationIndices(settingsFlnm)
+rescue MissingMagicValuesException
+    $stderr.puts "OffsetExtractor: No magic values found. Skipping offsets extractor file generation."
+    exit 1
+end
+
 def emitMagicNumber
     OFFSET_MAGIC_NUMBERS.each {
         | number |
@@ -49,123 +57,68 @@ def emitMagicNumber
     }
 end
 
-inputHash = "// offlineasm input hash: #{parseHash(inputFlnm)} #{selfHash}"
+configurationHash = Digest::SHA1.hexdigest(configurationList.join(' '))
+inputHash = "// OffsetExtractor input hash: #{parseHash(inputFlnm)} #{configurationHash} #{selfHash}"
 
 if FileTest.exist? outputFlnm
     File.open(outputFlnm, "r") {
         | inp |
         firstLine = inp.gets
         if firstLine and firstLine.chomp == inputHash
-            $stderr.puts "offlineasm: Nothing changed."
+            $stderr.puts "OffsetExtractor: Nothing changed."
             exit 0
         end
     }
 end
 
-originalAST = parse(inputFlnm)
-
-#
-# Optimize the AST to make configuration extraction faster. This reduces the AST to a form
-# that only contains the things that matter for our purposes: offsets, sizes, and if
-# statements.
-#
-
-class Node
-    def offsetsPruneTo(sequence)
-        children.each {
-            | child |
-            child.offsetsPruneTo(sequence)
-        }
-    end
-    
-    def offsetsPrune
-        result = Sequence.new(codeOrigin, [])
-        offsetsPruneTo(result)
-        result
-    end
-end
-
-class IfThenElse
-    def offsetsPruneTo(sequence)
-        ifThenElse = IfThenElse.new(codeOrigin, predicate, thenCase.offsetsPrune)
-        ifThenElse.elseCase = elseCase.offsetsPrune
-        sequence.list << ifThenElse
-    end
-end
-
-class StructOffset
-    def offsetsPruneTo(sequence)
-        sequence.list << self
-    end
-end
-
-class Sizeof
-    def offsetsPruneTo(sequence)
-        sequence.list << self
-    end
-end
-
-class ConstExpr
-    def offsetsPruneTo(sequence)
-        sequence.list << self
-    end
-end
-
-prunedAST = originalAST.offsetsPrune
+ast = parse(inputFlnm)
+settingsCombinations = computeSettingsCombinations(ast)
 
 File.open(outputFlnm, "w") {
     | outp |
     $output = outp
     outp.puts inputHash
-    length = 0
-
-    emitCodeInAllConfigurations(prunedAST) {
-        | settings, ast, backend, index |
-        constsList = ast.filter(ConstExpr).uniq.sort
-
-        constsList.each_with_index {
-            | const, index |
-            outp.puts "constexpr int64_t constValue#{index} = static_cast<int64_t>(#{const.value});"
-        }
-    }
 
-    emitCodeInAllConfigurations(prunedAST) {
-        | settings, ast, backend, index |
-        offsetsList = ast.filter(StructOffset).uniq.sort
-        sizesList = ast.filter(Sizeof).uniq.sort
-        constsList = ast.filter(ConstExpr).uniq.sort
-        length += OFFSET_HEADER_MAGIC_NUMBERS.size + (OFFSET_MAGIC_NUMBERS.size + 1) * (1 + offsetsList.size + sizesList.size + constsList.size)
-    }
-    outp.puts "static const int64_t extractorTable[#{length}] = {"
-    emitCodeInAllConfigurations(prunedAST) {
-        | settings, ast, backend, index |
-        OFFSET_HEADER_MAGIC_NUMBERS.each {
-            | number |
-            $output.puts "unsigned(#{number}),"
-        }
-
-        offsetsList = ast.filter(StructOffset).uniq.sort
-        sizesList = ast.filter(Sizeof).uniq.sort
-        constsList = ast.filter(ConstExpr).uniq.sort
-
-        emitMagicNumber
-        outp.puts "#{index},"
-        offsetsList.each {
-            | offset |
-            emitMagicNumber
-            outp.puts "OFFLINE_ASM_OFFSETOF(#{offset.struct}, #{offset.field}),"
-        }
-        sizesList.each {
-            | sizeof |
-            emitMagicNumber
-            outp.puts "sizeof(#{sizeof.struct}),"
-        }
-        constsList.each_index {
-            | index |
-            emitMagicNumber
-            outp.puts "constValue#{index},"
+    configurationList.each {
+        | configIndex |
+        forSettings(settingsCombinations[configIndex], ast) {
+            | concreteSettings, lowLevelAST, backend |
+
+            offsetsList = offsetsList(lowLevelAST)
+            sizesList = sizesList(lowLevelAST)
+            constsList = constsList(lowLevelAST)
+
+            emitCodeInConfiguration(concreteSettings, lowLevelAST, backend) {
+                constsList.each_with_index {
+                    | const, index |
+                    outp.puts "constexpr int64_t constValue#{index} = static_cast<int64_t>(#{const.value});"
+                }
+                outp.puts "static const int64_t offsetExtractorTable[] = {"
+                OFFSET_HEADER_MAGIC_NUMBERS.each {
+                    | number |
+                    outp.puts "unsigned(#{number}),"
+                }
+
+                emitMagicNumber
+                outp.puts "#{configIndex},"
+                offsetsList.each {
+                    | offset |
+                    emitMagicNumber
+                    outp.puts "OFFLINE_ASM_OFFSETOF(#{offset.struct}, #{offset.field}),"
+                }
+                sizesList.each {
+                    | sizeof |
+                    emitMagicNumber
+                    outp.puts "sizeof(#{sizeof.struct}),"
+                }
+                constsList.each_with_index {
+                    | const, index |
+                    emitMagicNumber
+                    outp.puts "constValue#{index},"
+                }
+                outp.puts "};"
+            }
         }
     }
-    outp.puts "};"
 
 }
diff --git a/Source/JavaScriptCore/offlineasm/generate_settings_extractor.rb b/Source/JavaScriptCore/offlineasm/generate_settings_extractor.rb
new file mode 100644 (file)
index 0000000..7f4cd12
--- /dev/null
@@ -0,0 +1,80 @@
+#!/usr/bin/env ruby
+
+# Copyright (C) 2011-2018 Apple Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+# THE POSSIBILITY OF SUCH DAMAGE.
+
+$: << File.dirname(__FILE__)
+
+require "config"
+require "backends"
+require "digest/sha1"
+require "offsets"
+require "parser"
+require "self_hash"
+require "settings"
+require "transform"
+
+IncludeFile.processIncludeOptions()
+
+inputFlnm = ARGV.shift
+outputFlnm = ARGV.shift
+
+validBackends = canonicalizeBackendNames(ARGV.shift.split(/[,\s]+/))
+includeOnlyBackends(validBackends)
+
+inputHash = "// SettingsExtractor input hash: #{parseHash(inputFlnm)} #{selfHash}"
+
+if FileTest.exist? outputFlnm
+    File.open(outputFlnm, "r") {
+        | inp |
+        firstLine = inp.gets
+        if firstLine and firstLine.chomp == inputHash
+            $stderr.puts "SettingsExtractor: Nothing changed."
+            exit 0
+        end
+    }
+end
+
+originalAST = parse(inputFlnm)
+prunedAST = Sequence.new(originalAST.codeOrigin, originalAST.filter(Setting))
+
+File.open(outputFlnm, "w") {
+    | outp |
+    $output = outp
+    outp.puts inputHash
+
+    settingsCombinations = computeSettingsCombinations(prunedAST)
+    length = settingsCombinations.size * (1 + OFFSET_HEADER_MAGIC_NUMBERS.size)
+
+    outp.puts "static const int64_t settingsExtractorTable[#{length}] = {"
+    emitCodeInAllConfigurations(prunedAST) {
+        | settings, ast, backend, index |
+        OFFSET_HEADER_MAGIC_NUMBERS.each {
+            | number |
+            $output.puts "unsigned(#{number}),"
+        }
+        outp.puts "#{index},"
+    }
+    outp.puts "};"
+
+}
index 2c1c1b7..8d6383b 100644 (file)
@@ -56,65 +56,53 @@ def constsList(ast)
     ast.filter(ConstExpr).uniq.sort
 end
 
-#
-# offsetsAndConfigurationIndex(ast, file) ->
-#     [[offsets, index], ...]
-#
-# Parses the offsets from a file and returns a list of offsets and the
-# index of the configuration that is valid in this build target.
-#
-
-def offsetsAndConfigurationIndex(file)
-    endiannessMarkerBytes = nil
-    result = {}
-    
-    def readInt(endianness, bytes)
-        if endianness == :little
-            # Little endian
-            number = (bytes[0] << 0  |
-                      bytes[1] << 8  |
-                      bytes[2] << 16 |
-                      bytes[3] << 24 |
-                      bytes[4] << 32 |
-                      bytes[5] << 40 |
-                      bytes[6] << 48 |
-                      bytes[7] << 56)
-        else
-            # Big endian
-            number = (bytes[0] << 56 |
-                      bytes[1] << 48 |
-                      bytes[2] << 40 |
-                      bytes[3] << 32 |
-                      bytes[4] << 24 |
-                      bytes[5] << 16 |
-                      bytes[6] << 8  |
-                      bytes[7] << 0)
-        end
-        if number > 0x7fffffff_ffffffff
-            number -= 1 << 64
-        end
-        number
+def readInt(endianness, bytes)
+    if endianness == :little
+        # Little endian
+        number = (bytes[0] << 0  |
+                  bytes[1] << 8  |
+                  bytes[2] << 16 |
+                  bytes[3] << 24 |
+                  bytes[4] << 32 |
+                  bytes[5] << 40 |
+                  bytes[6] << 48 |
+                  bytes[7] << 56)
+    else
+        # Big endian
+        number = (bytes[0] << 56 |
+                  bytes[1] << 48 |
+                  bytes[2] << 40 |
+                  bytes[3] << 32 |
+                  bytes[4] << 24 |
+                  bytes[5] << 16 |
+                  bytes[6] << 8  |
+                  bytes[7] << 0)
     end
-    
-    def prepareMagic(endianness, numbers)
-        magicBytes = []
-        numbers.each {
-            | number |
-            currentBytes = []
-            8.times {
-                currentBytes << (number & 0xff)
-                number >>= 8
-            }
-            if endianness == :big
-                currentBytes.reverse!
-            end
-            magicBytes += currentBytes
-        }
-        magicBytes
+    if number > 0x7fffffff_ffffffff
+        number -= 1 << 64
     end
-    
+    number
+end
+
+def prepareMagic(endianness, numbers)
+    magicBytes = []
+    numbers.each {
+        | number |
+        currentBytes = []
+        8.times {
+            currentBytes << (number & 0xff)
+            number >>= 8
+        }
+        if endianness == :big
+            currentBytes.reverse!
+        end
+        magicBytes += currentBytes
+    }
+    magicBytes
+end
+
+def fileBytes(file)
     fileBytes = []
-    
     File.open(file, "rb") {
         | inp |
         loop {
@@ -123,36 +111,50 @@ def offsetsAndConfigurationIndex(file)
             fileBytes << byte
         }
     }
-    
-    def sliceByteArrays(byteArray, pattern)
-        result = []
-        lastSlicePoint = 0
-        (byteArray.length - pattern.length + 1).times {
-            | index |
-            foundOne = true
-            pattern.length.times {
-                | subIndex |
-                if byteArray[index + subIndex] != pattern[subIndex]
-                    foundOne = false
-                    break
-                end
-            }
-            if foundOne
-                result << byteArray[lastSlicePoint...index]
-                lastSlicePoint = index + pattern.length
+    fileBytes
+end
+
+def sliceByteArrays(byteArray, pattern)
+    result = []
+    lastSlicePoint = 0
+    (byteArray.length - pattern.length + 1).times {
+        | index |
+        foundOne = true
+        pattern.length.times {
+            | subIndex |
+            if byteArray[index + subIndex] != pattern[subIndex]
+                foundOne = false
+                break
             end
         }
-        
-        result << byteArray[lastSlicePoint...(byteArray.length)]
-        
-        result
-    end
-    
+        if foundOne
+            result << byteArray[lastSlicePoint...index]
+            lastSlicePoint = index + pattern.length
+        end
+    }
+
+    result << byteArray[lastSlicePoint...(byteArray.length)]
+
+    result
+end
+
+#
+# offsetsAndConfigurationIndex(ast, file) ->
+#     [[offsets, index], ...]
+#
+# Parses the offsets from a file and returns a list of offsets and the
+# index of the configuration that is valid in this build target.
+#
+
+def offsetsAndConfigurationIndex(file)
+    fileBytes = fileBytes(file)
+    result = {}
+
     [:little, :big].each {
         | endianness |
         headerMagicBytes = prepareMagic(endianness, OFFSET_HEADER_MAGIC_NUMBERS)
         magicBytes = prepareMagic(endianness, OFFSET_MAGIC_NUMBERS)
-        
+
         bigArray = sliceByteArrays(fileBytes, headerMagicBytes)
         unless bigArray.size <= 1
             bigArray[1..-1].each {
@@ -168,9 +170,9 @@ def offsetsAndConfigurationIndex(file)
             }
         end
     }
-    
+
     raise MissingMagicValuesException unless result.length >= 1
-    
+
     # result is {index1=>offsets1, index2=>offsets2} but we want to return
     # [[offsets1, index1], [offsets2, index2]].
     return result.map {
@@ -180,6 +182,36 @@ def offsetsAndConfigurationIndex(file)
 end
 
 #
+# configurationIndices(ast, file) ->
+#     [[offsets, index], ...]
+#
+# Parses the configurations from a file and returns a list of the indices of
+# the configurations that are valid in this build target.
+#
+
+def configurationIndices(file)
+    fileBytes = fileBytes(file)
+    result = []
+
+    [:little, :big].each {
+        | endianness |
+        headerMagicBytes = prepareMagic(endianness, OFFSET_HEADER_MAGIC_NUMBERS)
+
+        bigArray = sliceByteArrays(fileBytes, headerMagicBytes)
+        unless bigArray.size <= 1
+            bigArray[1..-1].each {
+                | configArray |
+                result << readInt(endianness, configArray)
+            }
+        end
+    }
+
+    raise MissingMagicValuesException unless result.length >= 1
+
+    return result
+end
+
+#
 # buildOffsetsMap(ast, extractedConstants) -> map
 #
 # Builds a mapping between StructOffset, Sizeof, and ConstExpr nodes and their values.
index eec0925..ef57140 100644 (file)
@@ -90,7 +90,6 @@ end
 
 def forSettings(concreteSettings, ast)
     # Check which architectures this combinator claims to support.
-    numClaimedBackends = 0
     selectedBackend = nil
     BACKENDS.each {
         | backend |
@@ -166,7 +165,7 @@ end
 #
 
 def isASTErroneous(ast)
-    not ast.filter(Error).empty?
+    not ast.demacroify({}).filter(Error).empty?
 end
 
 #
@@ -204,7 +203,7 @@ def emitCodeInConfiguration(concreteSettings, ast, backend)
     end
     
     if isASTErroneous(ast)
-        $output.puts "#error \"Invalid configuration.\""
+        $output.puts "#error \"Invalid configuration. Error at: #{ast.filter(Error)[0].codeOrigin}\""
     elsif not WORKING_BACKENDS.include? backend
         $output.puts "#error \"This backend is not supported yet.\""
     else