Skip to content
Permalink
Browse files
Fix CPU(ARM_TRADITIONAL) build after r157690.
https://bugs.webkit.org/show_bug.cgi?id=123247

Patch by Julien Brianceau <jbriance@cisco.com> on 2013-10-29
Reviewed by Michael Saboff.

Since r157690, the executableCopy function has been removed from AssemblerBuffer.h
and the copy of executable code occurs in the linkCode function (in LinkBuffer.cpp).
As the constant pool for jumps is updated in the executableCopy function of ARM_TRADITIONAL,
this part of code still needs to be called and absolute jumps must be corrected to anticipate
the copy of the executable code through memcpy.

* assembler/ARMAssembler.cpp:
(JSC::ARMAssembler::prepareExecutableCopy): Rename executableCopy to prepareExecutableCopy
and correct absolute jump values using the delta between the source and destination buffers.
* assembler/ARMAssembler.h:
* assembler/LinkBuffer.cpp:
(JSC::LinkBuffer::linkCode): Call prepareExecutableCopy just before the memcpy.

Canonical link: https://commits.webkit.org/141577@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@158205 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
jbrianceau authored and webkit-commit-queue committed Oct 29, 2013
1 parent 4bf8208 commit 2a76ccca367bc6ced6a8266469d0b965e12fefee
Showing 4 changed files with 28 additions and 7 deletions.
@@ -1,3 +1,23 @@
2013-10-29 Julien Brianceau <jbriance@cisco.com>

Fix CPU(ARM_TRADITIONAL) build after r157690.
https://bugs.webkit.org/show_bug.cgi?id=123247

Reviewed by Michael Saboff.

Since r157690, the executableCopy function has been removed from AssemblerBuffer.h
and the copy of executable code occurs in the linkCode function (in LinkBuffer.cpp).
As the constant pool for jumps is updated in the executableCopy function of ARM_TRADITIONAL,
this part of code still needs to be called and absolute jumps must be corrected to anticipate
the copy of the executable code through memcpy.

* assembler/ARMAssembler.cpp:
(JSC::ARMAssembler::prepareExecutableCopy): Rename executableCopy to prepareExecutableCopy
and correct absolute jump values using the delta between the source and destination buffers.
* assembler/ARMAssembler.h:
* assembler/LinkBuffer.cpp:
(JSC::LinkBuffer::linkCode): Call prepareExecutableCopy just before the memcpy.

2013-10-28 Filip Pizlo <fpizlo@apple.com>

OSRExit::m_watchpointIndex should be in OSRExitCompilationInfo
@@ -391,15 +391,15 @@ void ARMAssembler::baseIndexTransferFloat(DataTransferTypeFloat transferType, FP
dataTransferFloat(transferType, srcDst, ARMRegisters::S1, offset);
}

PassRefPtr<ExecutableMemoryHandle> ARMAssembler::executableCopy(VM& vm, void* ownerUID, JITCompilationEffort effort)
void ARMAssembler::prepareExecutableCopy(void* to)
{
// 64-bit alignment is required for next constant pool and JIT code as well
m_buffer.flushWithoutBarrier(true);
if (!m_buffer.isAligned(8))
bkpt(0);

RefPtr<ExecutableMemoryHandle> result = m_buffer.executableCopy(vm, ownerUID, effort);
char* data = reinterpret_cast<char*>(result->start());
char* data = reinterpret_cast<char*>(m_buffer.data());
ptrdiff_t delta = reinterpret_cast<char*>(to) - data;

for (Jumps::Iterator iter = m_jumps.begin(); iter != m_jumps.end(); ++iter) {
// The last bit is set if the constant must be placed on constant pool.
@@ -415,11 +415,9 @@ PassRefPtr<ExecutableMemoryHandle> ARMAssembler::executableCopy(VM& vm, void* ow
continue;
}
}
*addr = reinterpret_cast<ARMWord>(data + *addr);
*addr = reinterpret_cast<ARMWord>(data + delta + *addr);
}
}

return result;
}

#if OS(LINUX) && COMPILER(RVCT)
@@ -808,7 +808,7 @@ namespace JSC {
return loadBranchTarget(ARMRegisters::pc, cc, useConstantPool);
}

PassRefPtr<ExecutableMemoryHandle> executableCopy(VM&, void* ownerUID, JITCompilationEffort);
void prepareExecutableCopy(void* to);

unsigned debugOffset() { return m_buffer.debugOffset(); }

@@ -147,6 +147,9 @@ void LinkBuffer::linkCode(void* ownerUID, JITCompilationEffort effort)
if (!m_didAllocate)
return;
ASSERT(m_code);
#if CPU(ARM_TRADITIONAL)
m_assembler->m_assembler.prepareExecutableCopy(m_code);
#endif
memcpy(m_code, buffer.data(), buffer.codeSize());
#elif CPU(ARM_THUMB2)
copyCompactAndLinkCode<uint16_t>(ownerUID, effort);

0 comments on commit 2a76ccc

Please sign in to comment.