[llvm-commits] [llvm] [Patch] Add RuntimeDyld.invalidateEmittedSectionsCache()

Danil Malyshev dmalyshev at accesssoftek.com
Tue May 15 13:48:04 PDT 2012


Hi Jim,

I apologize that I have not clearly explained.
MCJITMemoryManager does not allocate the memory himself and uses the JITMemoryManager for this. So, it's my mistake add the clearCache to the MCJITMemoryManager.


Regards,
Danil


________________________________
From: Jim Grosbach [grosbach at apple.com]
Sent: Tuesday, May 15, 2012 1:09 PM
To: Danil Malyshev
Cc: llvm-commits at cs.uiuc.edu
Subject: Re: [llvm-commits] [llvm] [Patch] Add RuntimeDyld.invalidateEmittedSectionsCache()

Hi Danil,

JITMemoryManager != TrivialMemoryManager. This logic belongs in the client application. The JITMemoryManager runs in the same process as the JIT compiler. The target code may not.

The bits of JITMemoryManager that currently reference things like this are purely vestiges of the old JIT and are not appropriate for the new MCJIT model where the host is not assumed to be the same as the target.

-Jim

On May 15, 2012, at 11:50 AM, Danil Malyshev <dmalyshev at accesssoftek.com<mailto:dmalyshev at accesssoftek.com>> wrote:

Hi Jim,

I see, it's should be in the JITMemoryManager instead of the RTDyldMemoryManager.

Please review attached the patch. It's adds LLIMCJITMemoryManager to lli.
The another way is add the clear cache to the DefaultJITMemoryManager, but attached way is more flexible for MCJIT tasks.


Regards,
Danil

________________________________
From: Jim Grosbach [grosbach at apple.com<mailto:grosbach at apple.com>]
Sent: Monday, May 14, 2012 9:55 AM
To: Danil Malyshev
Cc: llvm-commits at cs.uiuc.edu<mailto:llvm-commits at cs.uiuc.edu>
Subject: Re: [llvm-commits] [llvm] [Patch] Add RuntimeDyld.invalidateEmittedSectionsCache()

Hi Danil,

I'm not sure what additional information you're looking for. The logic you're wanting to add belongs in the memory manager of the client application, not the MCJIT. For example, in the case of lli, it should be part of the TrivialMemoryManager there.

Note that the old JIT did this differently, as it assumed it wasn't ever going to deal with a remote target. It could, and did, make lots of assumptions about that. As such, be wary of using its code paths as a guide for how the MCJIT should work.

-Jim


On May 14, 2012, at 9:49 AM, Danil Malyshev <dmalyshev at accesssoftek.com<mailto:dmalyshev at accesssoftek.com>> wrote:

Ping.


Regards,
Danil


________________________________
From: llvm-commits-bounces at cs.uiuc.edu<mailto:llvm-commits-bounces at cs.uiuc.edu> [llvm-commits-bounces at cs.uiuc.edu<mailto:llvm-commits-bounces at cs.uiuc.edu>] On Behalf Of Danil Malyshev [dmalyshev at accesssoftek.com<mailto:dmalyshev at accesssoftek.com>]
Sent: Tuesday, May 08, 2012 5:50 PM
To: Jim Grosbach
Cc: llvm-commits at cs.uiuc.edu<mailto:llvm-commits at cs.uiuc.edu>
Subject: Re: [llvm-commits] [llvm] [Patch] Add RuntimeDyld.invalidateEmittedSectionsCache()

Hi Jim,

Yes, I agree that it's client application job. But the MCJIT hard linked with hosted platform. It loads hosted library, it executes code on the host machine and etc. JIT and MCJIT was hidden from appication by EngineBuilder, their memory managers hidden too. The JIT does it for own code, I believe the MCJIT should do it too.
The remote JIT will not be based by MCJIT, it's will be something new, with own memory manager inherited from RTDyldMemoryManager and in this case the remote client application will be cares about their cache.

Regards,
Danil

________________________________
From: Jim Grosbach [grosbach at apple.com<mailto:grosbach at apple.com>]
Sent: Tuesday, May 08, 2012 4:24 PM
To: Danil Malyshev
Cc: llvm-commits at cs.uiuc.edu<mailto:llvm-commits at cs.uiuc.edu>
Subject: Re: [llvm-commits] [llvm] [Patch] Add RuntimeDyld.invalidateEmittedSectionsCache()

Hi Danil,

This is closer, but not quite. By the client's memory manager, I mean the application. This functionality shouldn't be in the core MC-JIT at all. For example, it belongs in the TrivialMemoryManager in llvm-rtdyld.cpp. That includes keeping the list of allocations and sections. Consider a remote client. The MemoryBlock map you're creating here will refer to the local copy, not the memory that's actually on the target where it'll be executed. The code that knows how to map between the two is the client's memory manager, so that's where this logic belongs as well.

-Jim

On May 8, 2012, at 4:09 PM, Danil Malyshev <dmalyshev at accesssoftek.com<mailto:dmalyshev at accesssoftek.com>> wrote:

Hi,

Please review changed the patch.
This patch adds finalize() to RTDyldMemoryManager, and implements it for MCJITMemoryManager as invalidate instruction cache.


Regards,
Danil


________________________________
From: Jim Grosbach [grosbach at apple.com<mailto:grosbach at apple.com>]
Sent: Monday, May 07, 2012 4:16 PM
To: Danil Malyshev
Cc: llvm-commits at cs.uiuc.edu<mailto:llvm-commits at cs.uiuc.edu>
Subject: Re: [llvm-commits] [llvm] [Patch] Add RuntimeDyld.invalidateEmittedSectionsCache()

Hi Danil,

That's not the RuntimeDyld's job. That functionality belongs in elsewhere, probably in the client's memory manager implementation where it's hooked into copying the compiled code into the target's address space. For a hosted platform, something similar just w/o the copying.

-Jim

On May 7, 2012, at 2:09 PM, Danil Malyshev <dmalyshev at accesssoftek.com<mailto:dmalyshev at accesssoftek.com>> wrote:

Hi everyone,



Please review attached the patch.
This patch adds invalidateEmmittedSectionsCache() to the RuntimeDyld and uses it in the MCJIT after resolve relocations.
The MCJIT works unstable on the ARM platforms without it.
This patch haven't any tests because I want to commit the common ExecutionEngine/MCJIT tests after attached the patch will be committed. These tests will cover it.
Regards,
Danil
<RuntimeDyld_invalidateEmittedSectionsCache-01.patch>_______________________________________________
llvm-commits mailing list
llvm-commits at cs.uiuc.edu<mailto:llvm-commits at cs.uiuc.edu>
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

<RTDyldMemoryManager_finalize-01.patch>

<LLIMCJITMemoryManager.patch>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120515/09e2228a/attachment.html>


More information about the llvm-commits mailing list