[LLVMdev] Lazy compilation in MCJIT (was RE: Old JIT Status (i.e., can we delete it?))

Kaylor, Andrew andrew.kaylor at intel.com
Mon Nov 26 13:35:08 PST 2012


So when you say 'lazy compilation' you mean 'deferred compilation of individual functions within a module until that function is needed,' right?  That's certainly what 'lazy compilation' meant in the legacy JIT.

I don't think that will ever be possible in MCJIT.  If you look at the MCJIT engine you'll see that it delegates absolutely everything.  In particular, compilation is done by the MC code, and it is done in exactly the same way that static compilation of objects is done.  Rather than producing a collection of loosely coupled pieces of executable memory containing machine code for functions, MCJIT produces executable object images and prepares those for execution.  I don't see any way for a 'partial' object to be produced without drastically changing the design of the MCJIT engine.

I'd like to suggest that instead of talking about how we can get MCJIT to do 'lazy compilation' in the old way, we should be talking about how to solve the same problem within the constraints of what MCJIT does.  I'm not sure I understand the constraints of the client side well enough to address this problem thoroughly, but I'll take a stab at first steps.  

I think the way to approach this problem is to deconstruct large modules into smaller modules which we can afford to re-JIT, and then optimize the process of linking modules together.  Currently, a single instance of MCJIT only supports handling of a single module, but I did recently add a mechanism to delay compilation of the module so that it doesn't happen when the MCJIT engine is constructed.

Once MCJIT supports multiple modules, if it had a mechanism for determining dependencies between modules and managing lazy compilation of those dependencies would that be acceptable?

This still leaves a bit of a problem with regard to function replacement, but I think it suggests a direction for making that happen too.

-Andy

-----Original Message-----
From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] On Behalf Of Albert Graef
Sent: Saturday, November 24, 2012 6:47 AM
To: LLVM Developers Mailing List
Subject: Re: [LLVMdev] Old JIT Status (i.e., can we delete it?)

On 11/24/2012 11:05 AM, Benjamin Kramer wrote:
> The last major roadblock is lazy compilation. I don't think we can remove the old JIT until MCJIT supports that.

I agree. But that alone may not be enough to support dynamic languages.
In the Pure JIT I often need to be able to replace the IR of the body of an already lowered function and generate new code for it. This also needs to be fast, so recompiling the entire module when this happens is not an option. Will this be possible with MCJIT?

--
Dr. Albert Gr"af
Dept. of Music-Informatics, University of Mainz, Germany
Email:  Dr.Graef at t-online.de, ag at muwiinfa.geschichte.uni-mainz.de
WWW:    http://www.musikinformatik.uni-mainz.de/ag
_______________________________________________
LLVM Developers mailing list
LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev




More information about the llvm-dev mailing list