mirror of
https://github.com/corda/corda.git
synced 2025-01-07 13:38:47 +00:00
sync instruction cache after compiling a method
This commit is contained in:
parent
4347228585
commit
89a2739165
@ -4259,6 +4259,8 @@ finish(MyThread* t, Allocator* allocator, Context* context)
|
|||||||
trap();
|
trap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
syncInstructionCache(start, codeSize);
|
||||||
|
|
||||||
return start;
|
return start;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,6 +67,29 @@ loadMemoryBarrier()
|
|||||||
memoryBarrier();
|
memoryBarrier();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline void
|
||||||
|
syncInstructionCache(const void* start, unsigned size)
|
||||||
|
{
|
||||||
|
const unsigned CacheLineSize = 32;
|
||||||
|
const uintptr_t Mask = ~(CacheLineSize - 1);
|
||||||
|
|
||||||
|
uintptr_t cacheLineStart = reinterpret_cast<uintptr_t>(start) & Mask;
|
||||||
|
uintptr_t cacheLineEnd
|
||||||
|
= (reinterpret_cast<uintptr_t>(start) + size + CacheLineSize - 1) & Mask;
|
||||||
|
|
||||||
|
for (uintptr_t p = cacheLineStart; p < cacheLineEnd; p += CacheLineSize) {
|
||||||
|
__asm__ __volatile__("dcbf 0, %0" : : "r" (p));
|
||||||
|
}
|
||||||
|
|
||||||
|
__asm__ __volatile__("sync");
|
||||||
|
|
||||||
|
for (uintptr_t p = cacheLineStart; p < cacheLineEnd; p += CacheLineSize) {
|
||||||
|
__asm__ __volatile__("icbi 0, %0" : : "r" (p));
|
||||||
|
}
|
||||||
|
|
||||||
|
__asm__ __volatile__("isync");
|
||||||
|
}
|
||||||
|
|
||||||
inline uint64_t
|
inline uint64_t
|
||||||
dynamicCall(void* function, uintptr_t* arguments, uint8_t* argumentTypes,
|
dynamicCall(void* function, uintptr_t* arguments, uint8_t* argumentTypes,
|
||||||
unsigned argumentCount, unsigned argumentsSize,
|
unsigned argumentCount, unsigned argumentsSize,
|
||||||
|
@ -71,6 +71,11 @@ loadMemoryBarrier()
|
|||||||
memoryBarrier();
|
memoryBarrier();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline void
|
||||||
|
syncInstructionCache(const void*, unsigned)
|
||||||
|
{
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
|
|
||||||
inline uint64_t
|
inline uint64_t
|
||||||
dynamicCall(void* function, uintptr_t* arguments, uint8_t*,
|
dynamicCall(void* function, uintptr_t* arguments, uint8_t*,
|
||||||
|
Loading…
Reference in New Issue
Block a user