James Molloy
2012-Mar-06 16:09 UTC
[LLVMdev] Performance degradation when repeatedly exchanging JITted functions
Surely you need to patch *all* functions, not just the initial? The point is with the current solution no matter which version of the function another function is linked to, it will hit a sled of JMPs and eventually end up at the newest. If you only patched the first, that sled wouldn't work. So you'd have to patch all instances. That still shouldn't be too hard. Cheers, James -----Original Message----- From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] On Behalf Of Joerg Sonnenberger Sent: 06 March 2012 15:45 To: llvmdev at cs.uiuc.edu Subject: Re: [LLVMdev] Performance degradation when repeatedly exchanging JITted functions On Tue, Mar 06, 2012 at 04:29:28PM +0100, Clemens Hammacher wrote:> I think a solution would be to always call a function through it's > stub, so that there is a single location to update when the function > is exchanged. This would mean that there is always exactly one level > of indirection, which is worse for programs that don't exchange > functions at runtime, but is much better in our scenario.Actually, you just have to make sure that you always patch the initial function. You don't have to force it to be a stub. Joerg _______________________________________________ LLVM Developers mailing list LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev -- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
Joerg Sonnenberger
2012-Mar-06 16:28 UTC
[LLVMdev] Performance degradation when repeatedly exchanging JITted functions
On Tue, Mar 06, 2012 at 04:09:36PM +0000, James Molloy wrote:> Surely you need to patch *all* functions, not just the initial?Depends on whether you always link to the original address or not. If you use link with the latest address, you have to patch all versions to point to the latest, otherwise you can just patch the first. Advantage of using the latest address: one saved jmp per call. Advantage of using the initial address: easier G/C of intermediate versions, less things to keep track of. Joerg
Clemens Hammacher
2012-Mar-06 16:39 UTC
[LLVMdev] Performance degradation when repeatedly exchanging JITted functions
On 3/6/12 5:28 PM, Joerg Sonnenberger wrote:> Advantage of using the latest address: one saved jmp per call.Per newly JITted call ;)> Advantage of using the initial address: easier G/C of intermediate > versions, less things to keep track of.I still think both versions require larger changes. When using the latest address, you have to keep track of all JITted functions per Function in order to update them. And their number increases linearly, so the time needed for exchanging a function increases as well. When using the initial address, you also have to patch all places in LLVM that rely on the global mapping being updated, which are more than I initially thought. That's why I stopped working on that. I don't think that a patch implementing any of those approaches would be accepted, that's why I am tending towards implementing it outside of LLVM. Cheers, Clemens -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 6392 bytes Desc: S/MIME Cryptographic Signature URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120306/7ba10b6c/attachment.bin>
Maybe Matching Threads
- [LLVMdev] Performance degradation when repeatedly exchanging JITted functions
- [LLVMdev] [PATCH] Performance degradation when repeatedly exchanging JITted functions
- [LLVMdev] Performance degradation when repeatedly exchanging JITted functions
- [LLVMdev] Performance degradation when repeatedly exchanging JITted functions
- [LLVMdev] Performance degradation when repeatedly exchanging JITted functions