[Mono-devel-list] reflection.emit in managed code

Paolo Molaro lupus at ximian.com
Sun May 11 09:20:00 EDT 2003

On 05/09/03 Varga Zoltan wrote:
>   I'm thinking about embarking on a project to rewrite parts of 
> reflection.c in managed code, especially the metadata
> emission part , 
> using PEAPI or something like that.
> Is this a good idea? What do you guys think?

After I got mcs bootstrapping in mono, many months ago, I though
about moving part of the reflection.c code to the managed world.
My plan was to do it after mono 1.0, though. A great deal of
optimizations and bug fixes went into reflection.c and I'm afraid a
rewrite at this point would mean losing a lot. Note that some of the
tweaks are needed to get the Reflection API to output a corlib
assembly, because the standard R.Emit stuff wouldn't allow for that.
Also, at this point, I don't think PEAPI is up to the task, last I
checked it didn't support custom attributes, IIRC.
I'm not sure how much moving the code to the managed world
interfers with the ability to emit and execute code at runtime:
you'd have to change ILGenerator to at least having two backends
(one for fixups for running the code and one for output to PEAPI).
This may have a noticeable overhead in the end, that we'd like to avoid.
Is there a particular reason you want to move the code to the managed
world? If there is no pressing need, I would hold on on this for the
next few months.



lupus at debian.org                                     debian/rules
lupus at ximian.com                             Monkeys do it better

More information about the Mono-devel-list mailing list