[Mono-devel-list] Writing assembly
eric.durand-tremblay.1 at ulaval.ca
Thu Feb 12 13:09:29 EST 2004
Thank you for the quick response.
This is not a problem, we will eventually rewrite dynamically our base
class and merge it with the dynamic assembly. (I asked out of laziness
;) ) The only problem is that it cost a lot of compile time for each
regex. An other possibility is to dynamically compile the base class
only when saving to an assembly. Hence we will keep our compile time
when compiling usual regex.
Actually, MS use base class to achieve this ( RegexRunner ) It is
exactly why we have compatibility issues. Note that we use the IMachine
Interface like mono interpreter.
For now, we concentrate on getting it all to run. We will be happy to
introduce some tweaking later.
Ben Maurer a écrit :
>No, there is not a way to do this easily. Your best option is to use a Perl script that would take the compiled class and turn it into S.R.E code to emit the same IL.
>One other possibility is that the runtime guys could hack something up for you that would copy the code from one assembly into one that is being built. However, this prevents you from using your impl on the MS runtime (eg, you cant copy just your code and compile/run on MS). Although this seems unimportant, it actually opens some unique testing possibilities. For example, you can run a run a regex on a set of random string data under MS and your impl, and see if they come out the same. Or you can do some performance testing of how fast your compiler is. Not a big deal, but if you dont have to loose it you should not.
>Also, for code that will be going into many assemblies, you should optimize it a bit by hand for size. Eg, mcs does not emit short jumps, but you can code those in yourself. There are many other ways you can work on reducing size, and some pretty cool tricks you can do in IL.
>>>>Eric Durand-Tremblay <eric.durand-tremblay.1 at ulaval.ca> 02/12/04 11:34 AM >>>
>Does anyone know a way to emit (with reflection) an already existing
>class (compiled in C#). We looked at System.Reflection.Emit namespace
>but we are only able to save dynamicaly created assembly.
>It could be usefull to do this when it is time to make our assembly
>compatible with MS runtime. (Like saving some base class to assembly)
>Eric Durand Tremblay
>Blogging : http://aeglos.dyndns.org/tip-mono
>Mono-devel-list mailing list
>Mono-devel-list at lists.ximian.com
More information about the Mono-devel-list