Fix build when the classic interpreter is enabled
authorddkilzer@apple.com <ddkilzer@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 4 Mar 2012 18:53:51 +0000 (18:53 +0000)
committerddkilzer@apple.com <ddkilzer@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 4 Mar 2012 18:53:51 +0000 (18:53 +0000)
Reviewed by Gavin Barraclough.

Fixes the following build error when running the "Generate
Derived Sources" build phase script:

    offlineasm: Parsing JavaScriptCore/llint/LowLevelInterpreter.asm and ../../JSCLLIntOffsetsExtractor and creating assembly file LLIntAssembly.h.
    ./JavaScriptCore/offlineasm/offsets.rb:145:in `offsetsAndConfigurationIndex': unhandled exception
            from JavaScriptCore/offlineasm/asm.rb:131
    Command /bin/sh failed with exit code 1

Gavin's fix in r109674 avoided the #error statement in
JITStubs.h when compiling LLIntOffsetsExtractor.cpp, but it
caused the "Generate Derived Sources" build phase script to fail
when JavaScriptCore/offlineasm/asm.rb was run.  The solution is
to detect when the classic interpreter is being built and simply
exit early from asm.rb in that case.

* llint/LLIntOffsetsExtractor.cpp:
(JSC::LLIntOffsetsExtractor::dummy): Return NULL pointer if the
JIT is disabled.  Note that offsets.rb doesn't care about the
return value here, but instead it cares about finding the magic
values in the binary.  The magic values are no longer present
when the JIT is disabled.
* offlineasm/asm.rb: Catch MissingMagicValuesException and exit
early with a status message.
* offlineasm/offsets.rb:
(MissingMagicValuesException): Add new exception class.
(offsetsAndConfigurationIndex): Throw
MissingMagicValuesException when no magic values are found.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@109678 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/llint/LLIntOffsetsExtractor.cpp
Source/JavaScriptCore/offlineasm/asm.rb
Source/JavaScriptCore/offlineasm/offsets.rb

index c0c8a6f..feb759c 100644 (file)
@@ -1,3 +1,37 @@
+2012-03-04  David Kilzer  <ddkilzer@apple.com>
+
+        Fix build when the classic interpreter is enabled
+
+        Reviewed by Gavin Barraclough.
+
+        Fixes the following build error when running the "Generate
+        Derived Sources" build phase script:
+
+            offlineasm: Parsing JavaScriptCore/llint/LowLevelInterpreter.asm and ../../JSCLLIntOffsetsExtractor and creating assembly file LLIntAssembly.h.
+            ./JavaScriptCore/offlineasm/offsets.rb:145:in `offsetsAndConfigurationIndex': unhandled exception
+                    from JavaScriptCore/offlineasm/asm.rb:131
+            Command /bin/sh failed with exit code 1
+
+        Gavin's fix in r109674 avoided the #error statement in
+        JITStubs.h when compiling LLIntOffsetsExtractor.cpp, but it
+        caused the "Generate Derived Sources" build phase script to fail
+        when JavaScriptCore/offlineasm/asm.rb was run.  The solution is
+        to detect when the classic interpreter is being built and simply
+        exit early from asm.rb in that case.
+
+        * llint/LLIntOffsetsExtractor.cpp:
+        (JSC::LLIntOffsetsExtractor::dummy): Return NULL pointer if the
+        JIT is disabled.  Note that offsets.rb doesn't care about the
+        return value here, but instead it cares about finding the magic
+        values in the binary.  The magic values are no longer present
+        when the JIT is disabled.
+        * offlineasm/asm.rb: Catch MissingMagicValuesException and exit
+        early with a status message.
+        * offlineasm/offsets.rb:
+        (MissingMagicValuesException): Add new exception class.
+        (offsetsAndConfigurationIndex): Throw
+        MissingMagicValuesException when no magic values are found.
+
 2012-03-04  Jurij Smakov  <jurij@wooyd.org>
 
         SPARC also needs aligned accesses.
index 5b76cd5..f863cb2 100644 (file)
@@ -61,6 +61,7 @@ public:
 
 const unsigned* LLIntOffsetsExtractor::dummy()
 {
+#if ENABLE(JIT)
 // This is a file generated by offlineasm/generate_offsets_extractor.rb, and contains code
 // to create a table of offsets, sizes, and a header identifying what combination of
 // Platform.h macros we have set. We include it inside of a method on LLIntOffsetsExtractor
@@ -69,6 +70,9 @@ const unsigned* LLIntOffsetsExtractor::dummy()
 // compiler to kindly step aside and yield to our best intentions.
 #include "LLIntDesiredOffsets.h"
     return extractorTable;
+#else
+    return 0;
+#endif
 }
 
 } // namespace JSC
index 493b63f..575c706 100644 (file)
@@ -128,7 +128,12 @@ outputFlnm = ARGV.shift
 
 $stderr.puts "offlineasm: Parsing #{asmFile} and #{offsetsFile} and creating assembly file #{outputFlnm}."
 
-configurationList = offsetsAndConfigurationIndex(offsetsFile)
+begin
+    configurationList = offsetsAndConfigurationIndex(offsetsFile)
+rescue MissingMagicValuesException
+    $stderr.puts "offlineasm: No magic values found. Skipping assembly file generation assuming the classic interpreter is enabled."
+    exit 0
+end
 
 inputHash =
     "// offlineasm input hash: " + parseHash(asmFile) +
index 21e1706..63af014 100644 (file)
@@ -27,6 +27,16 @@ OFFSET_HEADER_MAGIC_NUMBERS = [ 0x9e43fd66, 0x4379bfba ]
 OFFSET_MAGIC_NUMBERS = [ 0xec577ac7, 0x0ff5e755 ]
 
 #
+# MissingMagicValuesException
+#
+# Thrown when magic values are missing from the binary.
+# This is usually an indication that the classic interpreter is enabled.
+#
+
+class MissingMagicValuesException < Exception
+end
+
+#
 # offsetsList(ast)
 # sizesList(ast)
 #
@@ -142,7 +152,7 @@ def offsetsAndConfigurationIndex(file)
         end
     }
     
-    raise unless result.length >= 1
+    raise MissingMagicValuesException unless result.length >= 1
     raise if result.map{|v| v[1]}.uniq.size < result.map{|v| v[1]}.size
     
     result