[Mono-dev] Incremental build for mono compiler

Marek Safar marek.safar at seznam.cz
Fri Apr 10 15:39:59 EDT 2009


Hello,
> I am planning to implement background compilation for
> SharpDevelop<http://www.icsharpcode.net/OpenSource/SD/Default.aspx>.
> It requires to modify mono compiler to have an incremental build feature.
>
> I am thinking about this and from my point of view it requires from
> mcs to (correct me if I'm wrong):
> * The naive implementation of this just modify frontend of compiler to
> have parser stage completed - quick prototype
> * save metadata of compilation and internal state of compiler
> * allow to compile only one modified file (If modification requires to
> compile more than one e.g. change of interfaces or name of public
> member additional recompilation should be made)
> * Next step of this task will be to allow recompilation of only one
> method for E&C feature
>
> So I  am asking for Your help with my few questions:
> * Which is the best place to start ?
> * Potential problems ?
> * Some guidelines to do this in the "Mono" way for future integration.
>   
I think this could be easier to implement than you may think. All what 
you need is to create an instance of mcs compiler (keep it in memory) 
and then use REPL interface to compile modified code using same mcs 
instance. You will have to tweak our REPL to compile in correct context 
but that should be almost all what needs to be changed.

The bad news is that mcs does work properly on Mono runtime only. But as 
Miguel wrote I am working on a solution and it should be ready in next 
few months. You can play with current mcs as the new version should only 
make things easier for you, e.g. you could get compiled method body as 
byte array.

Marek


More information about the Mono-devel-list mailing list