# Thursday, 28 February 2008
IKVM 0.36 Update 1 Release Candidate 4

More fixes and a couple of optimizations. The bytecode optimizations and the removal of assert statements resulted in IKVM.OpenJDK.ClassLibrary.dll actually becoming smaller for once:

Version IKVM.OpenJDK.ClassLibrary.dll size
0.36.0.5         26,808,320
0.36.0.9 26,697,728


The size difference is about evenly split between the bytecode optimizations and the assert statement removal.

The ikvmc option to remove assert statements is a bit of a cheat, but it turns out that in at least one case (java.util.BitSet) the assertions significantly affect performance (even when they are disabled) on .NET. This is the result of the CLR JIT not optimizing them away whereas HotSpot completely removes them when assertions aren't enabled. Given that this was affecting a real world scenario for an ikvm user I decided to add this option and compile the core class library with it. The option will only remove assert statements that it recognizes (i.e. the example code pattern mentioned in appendix IV of the assert spec).

Changes:

  • Changed version to 0.36.0.9.
  • Optimized codegen for lcmp, fcmp<x>, dcmp<x> and shift opcodes.
  • Added support to Class.forName() for loading Java types with assembly qualified type names.
  • Implemented field/method/parameter annotation support for .NET types.
  • Added workaround for .NET 1.1 bug in Directory.CreateDirectory(). (bug #1902154)
  • Added -removeassertions optimization option to ikvmc.
  • Added -removeassertions to IKVM.OpenJDK.ClassLibrary.dll build.
  • Fixed JVM_CreateJavaVM to initialize the class library.

Binaries available here: ikvmbin-0.36.0.9.zip
Sources (+ binaries):ikvm-0.36.0.9.zip

Thursday, 28 February 2008 08:01:31 (W. Europe Standard Time, UTC+01:00)  #    Comments [4]
# Tuesday, 19 February 2008
New Development Snapshot

More changes triggered by the changeover to .NET 2.0.I also did some C# 3.0 work which means that you can now do this:

using System;
using System.Collections;
using ikvm.extensions;
using java.util;

public class Program
{
  static void Main(string[] args)
  {
    try
    {
      var map = new HashMap {
        { "foo", args.getClass() },
        { "bar", 2.getClass() }
      };

      foreach (DictionaryEntry de in map)
        Console.WriteLine("{0} = {1}", de.Key, de.Value);
    }
    catch (System.Exception x)
    {
      x.printStackTrace();
    }
  }
}

BTW, to enable defining extension methods without taking a dependency on System.Core.dll, I've defined my own copy of System.Runtime.CompilerServices.ExtensionAttribute in IKVM.Runtime.dll (it's only public during the first compilation pass, so it does not interfere with the real one in System.Core.dll if your project references both IKVM.Runtime.dll and System.Core.dll).

Changes:

  • Renamed GetEnumerator method in implicit IEnumerable implementation to work around lame bug in Xml serialization.
  • Added support for defining non-virtual instance methods in map.xml.
  • Added "Add" method to java.util.AbstractCollection to make some of the .NET magic work on Java collections.
  • Reintroduced baked TypeBuilder scrubbing hack for .NET 2.0 SP1.
  • Made core assembly detection more robust.
  • Improved ikvmc error handling for -reference option.
  • Added support for defining extension methods in the core class library assembly (without taking a System.Core.dll dependency).
  • Added the first two extension methods (Object.getClass() and Exception.printStackTrace()).
  • Optimized codegen for lcmp, fcmp<x>, dcmp<x> and shift opcodes.
  • Construct custom attribute annotation proxies directly instead of going through the trouble to encode/decode them.
  • Added support for explicitly implementing an interface method with the <override /> element in map.xml.
  • Added new utility class to enumerate maps.
  • Made java.util.AbstractMap enumerable and added Add() method to support C# 3.0 collection initialization syntax.

WARNING: THIS IS A DEVELOPMENT SNAPSHOT, NOT AN OFFICIAL RELEASE.

Development snapshots are intended for evaluating and keeping track of where the project is going, not for production usage. The binaries have not been extensively tested and are not strong named.

This version does not currently work with Mono.

Binaries available here: ikvmbin-0.37.2970.zip

Tuesday, 19 February 2008 06:13:20 (W. Europe Standard Time, UTC+01:00)  #    Comments [0]
# Monday, 04 February 2008
IKVM 0.36 Update 1 Release Candidate 3

I screwed up the previous release candidate build by building it on .NET .2.0. So here's a new release candidate that's built on .NET 1.1 again (and I threw in a couple of small fixes as well.)

Changes:

  • Changed version to 0.36.0.8.
  • Fixed ikvmc to support referencing assemblies that contain .NET type named java.lang.Object.
  • Improved error handling for ikvmc -reference option.

Binaries available here: ikvmbin-0.36.0.8.zip
Sources (+ binaries):ikvm-0.36.0.8.zip

Monday, 04 February 2008 16:18:04 (W. Europe Standard Time, UTC+01:00)  #    Comments [0]