# Wednesday, 27 August 2008
« Using Mono.Cecil instead of Reflection.E... | Main | New Development Snapshot »
Cecil Conclusion

I finished the Cecil.Reflection.Emit prototype of ikvmc. As I, unfortunately, expected the performance isn't acceptable. Compiling tools.jar takes approx. 18 seconds with the Ref.Emit backend, but takes 51 seconds with the Cecil based backend.

Now, I'm not knocking Mono.Cecil because of its performance, because I think the design was based on making it easy to load an assembly, tweak it and write it back out again. For that application the design makes a lot of sense, but it is less efficient for a write only task.

However, I did have to conclude that Mono.Cecil is not mature enough for usage with ikvmc. I had to write my own custom attribute encoder to work around Mono.Cecil's brokenness and I found that it doesn't properly support custom modifiers.

What Next

Given that neither Ref.Emit nor Cecil look like viable short term strategies for multi target support in ikvmc, I think it makes sense to start working on the 0.38 release now and put off the splitting of IKVM.OpenJDK.ClassLibrary.dll until the next release. I know this will disappoint some people, especially since it grew by about 4.7MB again (mostly due to the inclusion of the charsets.jar character encodings).

I don't have a timetable, but don't expect the release tomorrow. It'll be a while. First OpenJDK6 b12 needs to be released (and integrated) and then a whole lot of testing needs to be done.

Wednesday, 27 August 2008 06:11:46 (W. Europe Daylight Time, UTC+02:00)  #    Comments [3]
Wednesday, 27 August 2008 17:12:23 (W. Europe Daylight Time, UTC+02:00)
Jeroen,

We are evaluating to switch mcs to use Cecil instead of SRE.

The usage of cecil for this end sounds very similar to yours, do you mind sends the changes to IKVM and how to reproduce your test to one of our mailing list? Please, include the the bugs as well.

We (the mono team) would love to work with you to see if it's possible to optimize CECIL to match SRE performance.

Rodrigo Kumpera
Wednesday, 27 August 2008 18:43:12 (W. Europe Daylight Time, UTC+02:00)
The custom attribute issues are definitely annoying. I ended up working around them by changing the Mono.Cecil API and submitting a patch.

Also, the lack of portable PDB support is a little frustrating. Still... it works, and it's clear that a lot of effort has gone into it, despite the bugs.

Microsoft has another reflection library that may be more appropriate for tasks that involve assembly rewriting: Microsoft.ExtendedReflection. Pex uses it. Unfortunately I'm not sure whether this library is publicly available or redistributable.
Thursday, 28 August 2008 06:12:51 (W. Europe Daylight Time, UTC+02:00)
Rodrigo: I've updated http://www.frijters.net/ikvm-cecil.zip
Name
E-mail
Home page

I apologize for the lameness of this, but the comment spam was driving me nuts. In order to be able to post a comment, you need to answer a simple question. Hopefully this question is easy enough not to annoy serious commenters, but hard enough to keep the spammers away.

Anti-Spam Question: What method on java.lang.System returns an object's original hashcode (i.e. the one that would be returned by java.lang.Object.hashCode() if it wasn't overridden)? (case is significant)

Answer:  
Comment (HTML not allowed)  

Live Comment Preview