[Mono-dev] Incremental C# compiler

Martin Baulig martin at ximian.com
Wed Jul 12 13:33:54 EDT 2006

On Wed, 2006-07-12 at 16:14 +0200, David Srbecky wrote:

> So semantic analysis is the part that takes vast majority of the time 
> and the problem is that gmcs can not easily invalidate previously added 
> metadata. Right?
> What if we add the constraint that only the bodies of methods can 
> change? The metadata of the new code would be determined on the first 
> run and then it would never change and thus it would not need to be 
> invalidated. Also the preciously done semantic analysis for any 
> unchanged functions would still be valid.


that's not gonna work that easy.

Metadata is not only about the types defined in an assembly, it's also
about the types referenced by that assembly.  The first time a method is
parsed, we resolve all the types referenced by that assembly and add
them to hashtables etc.  When creating the metadata, we also create
TypeRef/TypeSpec entries for them.  So if you parse the same method a
second time, the types previously referenced by that method are still in
the cache and thus your metadata could grow a lot in size if you do that
several times. 

Also, you will run into the problem that not all Expressions/Statement's
in gmcs are safe of being Resolved/Emitted more than once - most of them
will work, but you'll discover side-effects with some of them which have
to be fixed.

There is also the problem of figuring out which methods changed and
which did not.

However, I really like the idea - but I think it'd be a huge task and
require a lot of work.

Btw. you may also find some useful information about edit-and-continue
in Mike Stall's debugger blog:
just look for edit-and-continue in there.


More information about the Mono-devel-list mailing list