JitCodeBuffer: Fix compilation on AArch64

This commit is contained in:
Connor McLaughlin 2019-12-27 20:36:55 +10:00
parent 29355bc44d
commit 9f45c67b1d

View file

@ -7,7 +7,6 @@
#include <sys/mman.h> #include <sys/mman.h>
#endif #endif
JitCodeBuffer::JitCodeBuffer(u32 size /* = 64 * 1024 * 1024 */, u32 far_code_size /* = 0 */) JitCodeBuffer::JitCodeBuffer(u32 size /* = 64 * 1024 * 1024 */, u32 far_code_size /* = 0 */)
{ {
m_total_size = size + far_code_size; m_total_size = size + far_code_size;
@ -49,7 +48,7 @@ void JitCodeBuffer::CommitCode(u32 length)
#if defined(Y_CPU_ARM) || defined(Y_CPU_AARCH64) #if defined(Y_CPU_ARM) || defined(Y_CPU_AARCH64)
// ARM instruction and data caches are not coherent, we need to flush after every block. // ARM instruction and data caches are not coherent, we need to flush after every block.
DoCacheFlush(m_free_code_ptr, length); FlushInstructionCache(m_free_code_ptr, length);
#endif #endif
Assert(length <= (m_code_size - m_code_used)); Assert(length <= (m_code_size - m_code_used));
@ -64,7 +63,7 @@ void JitCodeBuffer::CommitFarCode(u32 length)
#if defined(Y_CPU_ARM) || defined(Y_CPU_AARCH64) #if defined(Y_CPU_ARM) || defined(Y_CPU_AARCH64)
// ARM instruction and data caches are not coherent, we need to flush after every block. // ARM instruction and data caches are not coherent, we need to flush after every block.
DoCacheFlush(m_free_far_code_ptr, length); FlushInstructionCache(m_free_far_code_ptr, length);
#endif #endif
Assert(length <= (m_far_code_size - m_far_code_used)); Assert(length <= (m_far_code_size - m_far_code_used));
@ -105,8 +104,8 @@ void JitCodeBuffer::FlushInstructionCache(void* address, u32 size)
#if defined(Y_PLATFORM_WINDOWS) #if defined(Y_PLATFORM_WINDOWS)
::FlushInstructionCache(GetCurrentProcess(), address, size); ::FlushInstructionCache(GetCurrentProcess(), address, size);
#elif defined(Y_COMPILER_GCC) || defined(Y_COMPILER_CLANG) #elif defined(Y_COMPILER_GCC) || defined(Y_COMPILER_CLANG)
__builtin___clear_cache(reinterpret_cast<char*>(address), reinterpret_cast<char*>(address + size)); __builtin___clear_cache(reinterpret_cast<char*>(address), reinterpret_cast<char*>(address) + size);
#else #else
#error Unknown platform. #error Unknown platform.
#endif #endif
} }