[llvm-commits] [PATCH] MCJIT unit test bugs

Amara Emerson amara.emerson at arm.com
Wed Oct 31 10:24:49 PDT 2012


The issue is that the code memory must be invalidated not at the time of
allocation, but in the time between compilation and execution. If it isn't
invalidated in this interval, then memory modifications due to relocations
processing won't be propagated to the icaches on ARM systems.

This is why the memory manager can't automatically do it on its own at the
moment. A while ago I tried to fix this by adding the invalidation call to
MCJIT itself, but it broke the abstraction of client and JIT concerns.

I do think this isn't an ideal long term solution, as we have code
duplication leading to bugs like this. This isn't my area though, so Jim
will be able to expand more on this.

Amara

-----Original Message-----
From: Kaylor, Andrew [mailto:andrew.kaylor at intel.com] 
Sent: 31 October 2012 17:17
To: Amara Emerson; llvm-commits at cs.uiuc.edu
Subject: RE: [llvm-commits] [PATCH] MCJIT unit test bugs

Why is the explicit invalidating of the code cache necessary?  Is that
something that the memory manager could do automatically at some point?  I
know there are some attempts to do this in the allocation process, but I
guess it's not happening at the right time?

For the purpose of setting page protection, we're going to be adding some
sort of function to "finalize" the loading process.  Perhaps the code cache
invalidation could happen there.

-Andy

-----Original Message-----
From: llvm-commits-bounces at cs.uiuc.edu
[mailto:llvm-commits-bounces at cs.uiuc.edu] On Behalf Of Amara Emerson
Sent: Wednesday, October 31, 2012 8:12 AM
To: llvm-commits at cs.uiuc.edu
Subject: [llvm-commits] [PATCH] MCJIT unit test bugs

Hi,

We've discovered 2 problems in the MCJIT unit tests which have already been
fixed in lli.

The first is the cache invalidation bug, which can easily be fixed by adding
calls to invalidateInstructionCache() before executing each test function.
The second is the buggy memory alignment handling by allocateDataSection()
in the SectionMemoryManager. The fix from r166920 has been ported to the
unit test.

Review and commit appreciated.

Amara








More information about the llvm-commits mailing list