Skip to content

Commit

Permalink
ensure cgmemmgr caches are consistent
Browse files Browse the repository at this point in the history
this ensures that the writes are completed before flushing the icache
otherwise, platforms like ARM would potentially fail to see some of the writes
and were especially likely to miss the relocations applied to the JIT code

fix #17577
  • Loading branch information
vtjnash committed Sep 15, 2016
1 parent fdf3748 commit 6f57c40
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/cgmemmgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -462,11 +462,12 @@ class ROAllocator {
virtual ~ROAllocator() {}
virtual void finalize()
{
if (exec) {
for (auto &alloc: allocations) {
sys::Memory::InvalidateInstructionCache(alloc.rt_addr,
alloc.sz);
}
for (auto &alloc: allocations) {
// ensure the mapped pages are consistent
sys::Memory::InvalidateInstructionCache(alloc.wr_addr,
alloc.sz);
sys::Memory::InvalidateInstructionCache(alloc.rt_addr,
alloc.sz);
}
completed.clear();
allocations.clear();
Expand Down

0 comments on commit 6f57c40

Please sign in to comment.