Bug 129839 - Build failure on OpenBSD/sparc64 within JSCJSValueInlines.h
Summary: Build failure on OpenBSD/sparc64 within JSCJSValueInlines.h
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: Other Other
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks: 124941
  Show dependency treegraph
 
Reported: 2014-03-06 15:34 PST by Landry Breuil
Modified: 2014-03-07 10:15 PST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Landry Breuil 2014-03-06 15:34:30 PST
Loosely related to https://bugs.webkit.org/show_bug.cgi?id=113638, even if adding CPU(SPARC64) in the relevant places in wtf/Platform.h:


-#if CPU(ARM) || CPU(MIPS) || CPU(SH4)
+#if CPU(ARM) || CPU(MIPS) || CPU(SH4) || CPU(MIPS64) || CPU(SPARC64)
 #define WTF_CPU_NEEDS_ALIGNED_ACCESS 1
 #endif
 
@@ -641,6 +646,8 @@
     || CPU(ALPHA) \
     || CPU(ARM64) \
     || CPU(S390X) \
+    || CPU(SPARC64) \
+    || CPU(MIPS64) \
     || CPU(PPC64)
 #define WTF_USE_JSVALUE64 1
 #else


the build of 2.3.91 fails with:

                 from Source/JavaScriptCore/llint/LLIntOffsetsExtractor.cpp:29:
./Source/JavaScriptCore/runtime/JSCJSValueInlines.h: In constructor 'JSC::JSValue::JSValue(JSC::JSCell*)':
./Source/JavaScriptCore/runtime/JSCJSValueInlines.h:201:75: error: cast from 'JSC::JSCell*' to 'int32_t {aka int}' loses precision [-fpermissive]
     u.asBits.payload = reinterpret_cast<int32_t>(ptr);
                                                                           ^
./Source/JavaScriptCore/runtime/JSCJSValueInlines.h: In constructor 'JSC::JSValue::JSValue(const JSC::JSCell*)':
./Source/JavaScriptCore/runtime/JSCJSValueInlines.h:210:74: error: cast from 'JSC::JSCell*' to 'int32_t {aka int}' loses precision [-fpermissive]
     u.asBits.payload = reinterpret_cast<int32_t>(const_cast<JSCell*>(ptr));

Here, there seems to be an assumption that a pointer can fit in an int32_t, which i doubt is possible on 64-bits platforms..

Next error message:

In file included from ./Source/WTF/wtf/FastMalloc.h:28:0,
                 from ./Source/JavaScriptCore/config.h:60,
                 from Source/JavaScriptCore/llint/LLIntOffsetsExtractor.cpp:26:
./Source/WTF/wtf/StdLibExtras.h: In instantiation of 'ToType WTF::bitwise_cast(FromType) [with ToType = JSC::JSCell*; FromType = int]':
./Source/JavaScriptCore/interpreter/Register.h:185:47:   required from here
./Source/WTF/wtf/StdLibExtras.h:137:5: error: static assertion failed: bitwise_cast size of FromType and ToType must be equal!
     static_assert(sizeof(FromType) == sizeof(ToType), "bitwise_cast size of FromType and ToType must be equal!");
     ^
./Source/WTF/wtf/StdLibExtras.h: In instantiation of 'ToType WTF::bitwise_cast(FromType) [with ToType = JSC::Instruction*; FromType = int]':
./Source/JavaScriptCore/interpreter/CallFrame.h:192:81:   required from here
./Source/WTF/wtf/StdLibExtras.h:137:5: error: static assertion failed: bitwise_cast size of FromType and ToType must be equal!
./Source/WTF/wtf/StdLibExtras.h: In instantiation of 'ToType WTF::bitwise_cast(FromType) [with ToType = int; FromType = JSC::Instruction*]':
./Source/JavaScriptCore/interpreter/CallFrame.h:197:75:   required from here
./Source/WTF/wtf/StdLibExtras.h:137:5: error: static assertion failed: bitwise_cast size of FromType and ToType must be equal!

Probably the same thing, casting a JSCell* to an int?

2.2.4 used to build fine on sparc64 (ok, it blewd at runtime, but at least it built)
Comment 1 Landry Breuil 2014-03-07 01:58:05 PST
After readding the #define goos that were removed in https://bugs.webkit.org/show_bug.cgi?id=124941 (people are still trying to use this hw..) the JSVALUE64 codepath is properly taken, and the failure is now different:

Source/JavaScriptCore/runtime/VM.cpp: In constructor 'JSC::VM::VM(JSC::VM::VMType, JSC::HeapType)':
Source/JavaScriptCore/runtime/VM.cpp:213:25: error: 'm_canUseAssembler' was not declared in this scope
     , m_canUseRegExpJIT(m_canUseAssembler && Options::useRegExpJIT())

Not surprising... too many assumptions are made on the fact that every arch has an asm implem.
Comment 2 Landry Breuil 2014-03-07 07:51:50 PST
(In reply to comment #1)
> After readding the #define goos that were removed in https://bugs.webkit.org/show_bug.cgi?id=124941 (people are still trying to use this hw..) the JSVALUE64 codepath is properly taken, and the failure is now different:
> 
> Source/JavaScriptCore/runtime/VM.cpp: In constructor 'JSC::VM::VM(JSC::VM::VMType, JSC::HeapType)':
> Source/JavaScriptCore/runtime/VM.cpp:213:25: error: 'm_canUseAssembler' was not declared in this scope
>      , m_canUseRegExpJIT(m_canUseAssembler && Options::useRegExpJIT())
> 
> Not surprising... too many assumptions are made on the fact that every arch has an asm implem.

So this is likely because yarr jit is enabled (because llint cloop is enabled) and the code in VM.cpp assumes that assembler is on if yarr jit is on.

If i leave assembler enabled on sparc64, it blows horribly:

./Source/JavaScriptCore/assembler/MacroAssembler.h:66:2: error: #error "The MacroAssembler is not supported on this platform."
 #error "The MacroAssembler is not supported on this platform."

This is just https://bugs.webkit.org/show_bug.cgi?id=113638 over and over again
Comment 3 Landry Breuil 2014-03-07 10:15:23 PST
Another possibility seem to disable yarr jit enabling if llintcloop is enabled, the build seems to go much further within the js engine:

-#if !defined(ENABLE_YARR_JIT) && (ENABLE(JIT) || ENABLE(LLINT_C_LOOP))
+#if !defined(ENABLE_YARR_JIT) && ENABLE(JIT)
#define ENABLE_YARR_JIT 1