Changeset 44884 in webkit for trunk/JavaScriptCore


Ignore:
Timestamp:
Jun 19, 2009, 5:49:36 PM (16 years ago)
Author:
[email protected]
Message:

2009-06-19 Gavin Barraclough <[email protected]>

Reviewed by Oliver Hunt.

Fix armv7 JIT build issues.

Unfortunate the arm compiler does not like the use of offsetof on JITStackFrame (since it now contains non POD types),
and the FIELD_OFFSET macro does not appear constantish enough for it to be happy with its use in COMPILE_ASSERT macros.

  • Replace offsetofs with FIELD_OFFSETs (safe on C++ objects).
  • Move COMPILE_ASSERTs defending layout of JITStackFrame structure on armv7 into JITThunks constructor.
  • jit/JIT.cpp:
  • jit/JIT.h:
  • jit/JITInlineMethods.h: (JSC::JIT::restoreArgumentReference):
  • jit/JITOpcodes.cpp: (JSC::JIT::emit_op_catch):
  • jit/JITStubs.cpp: (JSC::JITThunks::JITThunks):
Location:
trunk/JavaScriptCore
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r44873 r44884  
     12009-06-19  Gavin Barraclough  <[email protected]>
     2
     3        Reviewed by Oliver Hunt.
     4
     5        Fix armv7 JIT build issues.
     6
     7        Unfortunate the arm compiler does not like the use of offsetof on JITStackFrame (since it now contains non POD types),
     8        and the FIELD_OFFSET macro does not appear constantish enough for it to be happy with its use in COMPILE_ASSERT macros.
     9
     10        * Replace offsetofs with FIELD_OFFSETs (safe on C++ objects).
     11        * Move COMPILE_ASSERTs defending layout of JITStackFrame structure on armv7 into JITThunks constructor.
     12
     13        * jit/JIT.cpp:
     14        * jit/JIT.h:
     15        * jit/JITInlineMethods.h:
     16        (JSC::JIT::restoreArgumentReference):
     17        * jit/JITOpcodes.cpp:
     18        (JSC::JIT::emit_op_catch):
     19        * jit/JITStubs.cpp:
     20        (JSC::JITThunks::JITThunks):
     21
    1222009-06-19  Adam Treat  <[email protected]>
    223
  • trunk/JavaScriptCore/jit/JIT.cpp

    r44844 r44884  
    836836    move(ImmPtr(reinterpret_cast<void*>(ctiVMThrowTrampoline)), regT2);
    837837    emitGetFromCallFrameHeaderPtr(RegisterFile::CallerFrame, callFrameRegister);
    838     poke(callFrameRegister, offsetof(struct JITStackFrame, callFrame) / sizeof (void*));
     838    poke(callFrameRegister, FIELD_OFFSET(struct JITStackFrame, callFrame) / sizeof (void*));
    839839    restoreReturnAddressBeforeReturn(regT2);
    840840    ret();
  • trunk/JavaScriptCore/jit/JIT.h

    r44797 r44884  
    2828
    2929#include <wtf/Platform.h>
     30
     31// FIELD_OFFSET: Like the C++ offsetof macro, but you can use it with classes.
     32// The magic number 0x4000 is insignificant. We use it to avoid using NULL, since
     33// NULL can cause compiler problems, especially in cases of multiple inheritance.
     34#define FIELD_OFFSET(class, field) (reinterpret_cast<ptrdiff_t>(&(reinterpret_cast<class*>(0x4000)->field)) - 0x4000)
    3035
    3136#if ENABLE(JIT)
  • trunk/JavaScriptCore/jit/JITInlineMethods.h

    r44523 r44884  
    3535#endif
    3636
    37 // FIELD_OFFSET: Like the C++ offsetof macro, but you can use it with classes.
    38 // The magic number 0x4000 is insignificant. We use it to avoid using NULL, since
    39 // NULL can cause compiler problems, especially in cases of multiple inheritance.
    40 #define FIELD_OFFSET(class, field) (reinterpret_cast<ptrdiff_t>(&(reinterpret_cast<class*>(0x4000)->field)) - 0x4000)
    41 
    4237namespace JSC {
    4338
     
    226221ALWAYS_INLINE void JIT::restoreArgumentReference()
    227222{
    228     poke(callFrameRegister, offsetof(struct JITStackFrame, callFrame) / sizeof (void*));
     223    poke(callFrameRegister, FIELD_OFFSET(struct JITStackFrame, callFrame) / sizeof (void*));
    229224}
    230225ALWAYS_INLINE void JIT::restoreArgumentReferenceForTrampoline() {}
     
    233228{
    234229    move(stackPointerRegister, firstArgumentRegister);
    235     poke(callFrameRegister, offsetof(struct JITStackFrame, callFrame) / sizeof (void*));
     230    poke(callFrameRegister, FIELD_OFFSET(struct JITStackFrame, callFrame) / sizeof (void*));
    236231}
    237232ALWAYS_INLINE void JIT::restoreArgumentReferenceForTrampoline()
  • trunk/JavaScriptCore/jit/JITOpcodes.cpp

    r44838 r44884  
    690690{
    691691    killLastResultRegister(); // FIXME: Implicitly treat op_catch as a labeled statement, and remove this line of code.
    692     peek(callFrameRegister, offsetof(struct JITStackFrame, callFrame) / sizeof (void*));
     692    peek(callFrameRegister, FIELD_OFFSET(struct JITStackFrame, callFrame) / sizeof (void*));
    693693    emitPutVirtualRegister(currentInstruction[1].u.operand);
    694694}
  • trunk/JavaScriptCore/jit/JITStubs.cpp

    r44844 r44884  
    196196#endif
    197197
    198 COMPILE_ASSERT(offsetof(struct JITStackFrame, preservedReturnAddress) == 0x20, JITStackFrame_outerReturnAddress_offset_matches_ctiTrampoline);
    199 COMPILE_ASSERT(offsetof(struct JITStackFrame, preservedR4) == 0x24, JITStackFrame_outerReturnAddress_offset_matches_ctiTrampoline);
    200 COMPILE_ASSERT(offsetof(struct JITStackFrame, preservedR5) == 0x28, JITStackFrame_outerReturnAddress_offset_matches_ctiTrampoline);
    201 COMPILE_ASSERT(offsetof(struct JITStackFrame, preservedR6) == 0x2c, JITStackFrame_outerReturnAddress_offset_matches_ctiTrampoline);
    202 
    203 COMPILE_ASSERT(offsetof(struct JITStackFrame, registerFile) == 0x30, JITStackFrame_registerFile_offset_matches_ctiTrampoline);
    204 COMPILE_ASSERT(offsetof(struct JITStackFrame, callFrame) == 0x34, JITStackFrame_callFrame_offset_matches_ctiTrampoline);
    205 COMPILE_ASSERT(offsetof(struct JITStackFrame, exception) == 0x38, JITStackFrame_exception_offset_matches_ctiTrampoline);
    206 // The fifth argument is the first item already on the stack.
    207 COMPILE_ASSERT(offsetof(struct JITStackFrame, enabledProfilerReference) == 0x3c, JITStackFrame_enabledProfilerReference_offset_matches_ctiTrampoline);
    208 
    209198asm volatile (
    210199".text" "\n"
     
    339328{
    340329    JIT::compileCTIMachineTrampolines(globalData, &m_executablePool, &m_ctiArrayLengthTrampoline, &m_ctiStringLengthTrampoline, &m_ctiVirtualCallPreLink, &m_ctiVirtualCallLink, &m_ctiVirtualCall, &m_ctiNativeCallThunk);
     330
     331#if PLATFORM(ARM_V7)
     332    // Unfortunate the arm compiler does not like the use of offsetof on JITStackFrame (since it contains non POD types),
     333    // and the FIELD_OFFSET macro does not appear constantish enough for it to be happy with its use in COMPILE_ASSERT
     334    // macros.
     335    ASSERT(FIELD_OFFSET(struct JITStackFrame, preservedReturnAddress) == 0x20);
     336    ASSERT(FIELD_OFFSET(struct JITStackFrame, preservedR4) == 0x24);
     337    ASSERT(FIELD_OFFSET(struct JITStackFrame, preservedR5) == 0x28);
     338    ASSERT(FIELD_OFFSET(struct JITStackFrame, preservedR6) == 0x2c);
     339
     340    ASSERT(FIELD_OFFSET(struct JITStackFrame, registerFile) == 0x30);
     341    ASSERT(FIELD_OFFSET(struct JITStackFrame, callFrame) == 0x34);
     342    ASSERT(FIELD_OFFSET(struct JITStackFrame, exception) == 0x38);
     343    // The fifth argument is the first item already on the stack.
     344    ASSERT(FIELD_OFFSET(struct JITStackFrame, enabledProfilerReference) == 0x3c);
     345
     346    ASSERT(FIELD_OFFSET(struct JITStackFrame, thunkReturnAddress) == 0x1C);
     347#endif
    341348}
    342349
     
    564571
    565572#if PLATFORM(ARM_V7)
    566 
    567 COMPILE_ASSERT(offsetof(struct JITStackFrame, thunkReturnAddress) == 0x1C, JITStackFrame_outerReturnAddress_offset_matches_ctiTrampoline);
    568573
    569574#define DEFINE_STUB_FUNCTION(rtype, op) \
Note: See TracChangeset for help on using the changeset viewer.