# Tuesday, 05 December 2006
New Snapshot

Final snapshot before the 0.32 release candidate (due after GNU Classpath 0.93 is released).

  • Integrated GNU Classpath 0.93 cvs branch.
  • Fixed type sealing optimization to take -privatepackage option into account.
  • Fixed line number table encoding bug (for line number deltas > 8191).
  • Fixed array to support internal accessibility (@ikvm.lang.Internal annotation or ikvmc -privatepackage option).
  • Switched to using NAnt-0.85 (release) for building.
  • Unforked gnu.classpath.Pointer. GNU Classpath native code that uses Pointer can now be used as-is.
  • Removed various gnu.classpath.Pointer hacks from compiler and runtime.
  • Removed handcoded DirectByteBufferImpl methods from map.xml
  • Forked DirectByteBufferImpl and merged in MappedByteBufferImpl functionality. DirectByteBufferImpl now uses .NET type System.Runtime.InteropServices.Marshal to do direct buffer manipulation and uses a PhantomReference to schedule cleanup.
  • Updated FileChannelImpl to use new DirectByteBufferImpl instead of MappedByteBufferImpl.
  • Changed FileChannelImpl to directly use win32 boolean instead of polymorphism, for the few platform specific operations.
  • Fixed regression introduced in previous snapshot. IsErasedOrBoxedPrimitiveOrRemapped should only return true for Java primitives, not all .NET primitives.
  • Added check to ikvmc to make sure that all assemblies required by referenced assemblies are available.
  • Added attempted workaround for c++/cli compiler bug https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=234167
  • Fixed Socket.soLingerOption(false) handling.
  • Added String.format() methods. (Note that they delegate to GNU Classpath's java.util.Formatter which isn't yet fully functional.)
  • Changed class file parser to accept version 50 (Java 6) class files (the StackMapTable attribute is still ignored though).
  • Fixed ikvmc to make the stub methods that exist to hide System.Object and System.Exception methods from java.lang.Object and java.lang.Throwable do a virtual call on the methods they hide, instead of a non-virtual call.
  • Removed public instancehelper_finalize() and instancehelper_clone() methods from java.lang.Object & java.lang.Throwable. This required some relatively ugly hacks, but having these protected methods callable by anyone was not acceptable from a security p.o.v. so hacks are a necessary evil. As a side effect, these hacks made it possible to implement clone() for types that extend cli.System.Object and cli.System.Exception (as long as they implement the java.lang.Cloneable interface to signal that they are OK with being cloned).
  • Enabled IKVM.AWT.WinForms.dll target on Linux.
  • Changed AssemblyClassLoader (Java code) to keep track of the Assembly it corresponds to.
  • Implemented some simple codegen optimizations in CountingILGenerator.
  • Implemented resource loading delegation for assembly class loaders.
  • Added support (albeit a little hacky) for generating class stubs for .NET generic type instances.
  • Added ikvmc -externalresource option to link external files as resources (i.e. instead of embedding the resource in the assembly, only a filename and hash are added to the assembly manifest.)
  • Pre-linked .NET method wrappers, to fix problem with .NET generic types in signatures.

Source is in cvs. Binaries: ikvmbin-0.31.2530.zip

Tuesday, 05 December 2006 08:57:09 (W. Europe Standard Time, UTC+01:00)  #    Comments [1]
# Tuesday, 28 November 2006
Linux Build Environment

M. David Peterson has created a Linux Virtual Appliance that can be used to build IKVM.NET from source in a Linux environment without requiring a lot of complicated setup.

  • Download the appliance VMWare image from http://www.rpath.org/rbuilder/project/nuxleus/release?id=5209
  • Boot it up inside VMWare (Player)
  • Log in as root (no password)
  • Run "conary update --replace-files group-devel=conary.rpath.com@rpl:1"  to get the development tools
  • Run "conary update cli-gac-tag" to install the ikvm assemblies into the GAC.
  • Run "cvs -z3 -d:pserver:anonymous@ikvm.cvs.sourceforge.net:/cvsroot/ikvm co -P ikvm" to get IKVM.NET from cvs.
  • Run "cvs -z3 -d:pserver:anonymous@cvs.savannah.gnu.org:/sources/classpath co classpath" to get GNU Classpath from cvs.
  • Change into the ikvm directory and run nant.

That's it!

Tuesday, 28 November 2006 07:28:13 (W. Europe Standard Time, UTC+01:00)  #    Comments [0]
# Tuesday, 14 November 2006
Sun Open Sourcing Java

Yesterday Sun announced that they will be releasing their Java platform implementations under the GPL v2 (+ Classpath exception for the J2SE libraries). This is great news for the Java ecosystem and for IKVM.NET as well, of course.

A few people have mailed me to ask what this means specifically for IKVM. Here are my current plans (subject to change, as always): When the GPL version of the Java 7 libraries will be released, I will start working on integrating them with IKVM. Some parts of the libraries are not owned by Sun, so there will be holes in what they release, hopefully these can be filled soon (for example by code from GNU Classpath.)

The Sun libraries obviously use native code to interface with the OS, for IKVM this is not ideal (JNI is slow and native code much less secure and robust than managed code), so where feasible I will continue to use my current "native" implementations (e.g. socket and file i/o) based on the .NET Framework.

Tuesday, 14 November 2006 07:44:12 (W. Europe Standard Time, UTC+01:00)  #    Comments [3]
# Wednesday, 11 October 2006
New Snapshot

New snapshot where I've reintroduced netmodule support. I think that was the final issue resulting from the assembly class loader architecture change, but, as always, I welcome feedback.

Changes:

  • Added modreq(IsVolatile) support for WHIDBEY target.
  • Fixed a bug in ikvmc's detection of incompatible assemblies (compiled with another version of ikvm).
  • Added support for specifying partial names in ikvmc -reference option (this is most useful for .NET Framework assemblies, e.g. you can now say -r:mscorlib).
  • Fixed NullReferenceException in AssemblyClassLoader when one of the referenced assemblies is not available.
  • Changed class.map and pkg.lst from resources to custom attributes, to better support modules that are merged together (WARNING: merging ikvmc generated modules with modules generated by other compiler is *not* supported)
  • Added support for multi-module assemblies (each module in a multi-module assembly can be written in a different language [but J# is still not suppored]).
  • Added optimization to ikvmc to seal private types that do not have subclasses.
  • Removed global DefineClass lock.
  • Constant fields no longer have a CLR backing field in dynamic mode.

Source is in cvs. Binaries: ikvmbin-0.31.2475.zip

Wednesday, 11 October 2006 07:35:48 (W. Europe Daylight Time, UTC+02:00)  #    Comments [0]
# Wednesday, 04 October 2006
New Snapshot

Yet another new snapshot.

Changes:

  • Fixed java.lang.Byte implementation of IFormattable to treat byte as a signed number.
  • Changed ikvm.lang.CIL boxing methods for built-in primitives to no longer do the actual boxing, but instead simply return the passed in value as another type, the call site will then do the boxing (if required).
  • Fixed field reflection to support overloaded field names.
  • Fixed a bunch of metadata regressions introduced in 0.31 with the changes made to final field handling.
  • Deprecated final fields that are compiled as properties now have the properties marked with ObsoleteAttribute.
  • Added support for encoding method/field signatures with types that look different in the Java world, but are actually the same in the CLR signatures (e.g. you can now have a method that takes or returns cli.System.Object or cli.System.Int32).

Source is in cvs. Binaries: ikvmbin-0.31.2468.zip

Wednesday, 04 October 2006 11:33:49 (W. Europe Daylight Time, UTC+02:00)  #    Comments [0]
# Monday, 02 October 2006
New Snapshot

Again, a new snapshot. This time with some new magic to make Java boxed primitives integrate a little better with .NET string formatting. The following code now produces the expected result:

class test
{
  public static void main(String[] args)
  {
    cli.System.Console.WriteLine("Java Magic = {0:X}", 0xCAFEBABE);
    cli.System.Console.WriteLine("Pi is approx. = {0:N2}", Math.PI);
  }
}

To enable this, the Java box classes have to implement IFormattable. I added support to the remapping infrastructure for this:

<class name="java.lang.Double">
  <implements class="cli.System.IFormattable">
    <method
     
name="ToString"
      sig="(Ljava.lang.String;Lcli.System.IFormatProvider;)Ljava.lang.String;">
      <redirect
        class="ikvm.internal.Formatter"
        type="static"
        name="ToString"
        sig="(Ljava.lang.Double;Ljava.lang.String;Lcli.System.IFormatProvider;)Ljava.lang.String;"
      />
    </method>
  </implements>
</
class>

The ToString helper method is trivial:

public static String ToString(Double d, String format, IFormatProvider provider)
{
  return ((IFormattable)CIL.box_double(d.doubleValue())).ToString(format, provider);
}

Note that from the Java side this is mostly invisible (the exception being that you can now cast a java.lang.Double to cli.System.IFormattable, even though the interface is not visible thru reflection).

Changes:

  • Added workaround for mono bug.
  • Added support for specifying java class names in map.xml attribute parameters of type System.Type.
  • Added support to remapping infrastructure for adding interfaces to classes (invisible to Java code).
  • Made java.lang.Byte, Short, Integer, Long, Float and Double implement IFormattable (privately, so this is invisible to Java code).

Source is in cvs. Binaries: ikvmbin-0.31.2466.zip

Monday, 02 October 2006 09:27:16 (W. Europe Daylight Time, UTC+02:00)  #    Comments [0]
# Tuesday, 26 September 2006
New Snapshot

More fixes and nio improvements and a regression fix.

Changes:

  • Fixed SocketChannel.close() (was broken in previous snapshot).
  • Added support to VMThread for custom interruptable code regions.
  • Implemented SocketChannel interruptability and asynchronous close.
  • Implemented ServerSocketChannel interruptability and asynchronous close.
  • Almost completely rewrote SelectorImpl to fix many bugs and implement interruptability.
  • Fixed PlainDatagramSocketImpl.receive() to ignore WSAECONNRESET errors.
  • Optimized SelectorImpl to not create a new wakeup socket for each select.
  • Fixed regression introduced in 0.31 that caused NullReferenceException if a class had explicitly defined write-only properties (specified in an xml mapping file).

Source is in cvs. Binaries: ikvmbin-0.31.2460.zip

Tuesday, 26 September 2006 07:01:50 (W. Europe Daylight Time, UTC+02:00)  #    Comments [0]
# Friday, 22 September 2006
New Snapshot

More nio fixes. Azureus now works (sort of anyway). I also added a workaround for a bug in mcs that was exposed by my recent changes in the way final fields are handled.

Changes:

  • Added workaround for mcs bug.
  • More nio fixes. Selector now works much better. Lots more work still needed.

Source is in cvs. Binaries: ikvmbin-0.31.2456.zip

Friday, 22 September 2006 07:59:08 (W. Europe Daylight Time, UTC+02:00)  #    Comments [0]
# Wednesday, 20 September 2006
New Snapshot

A new snapshot. Most significant change is the almost complete rewrite of the nio code, triggered by the GNU Classpath nio rewrite. The test coverage for nio is fairly abysmal, so hopefully I haven't introduced too many regressions. On the whole the new code should be equivalent to or better than the previous version, but there still remains a lot to be done.

Changes:

  • Updated to current GNU Classpath cvs version.
  • Fixed streaming sockets to support SO_REUSEADDR socket option.
  • Changed ikvmc -resource option to strip unnecessary leading slash from resource name.
  • More code restructuring.
  • Added tracing to assembly resource and class loading.
  • Fixed ikvmstub to export non-public outer classes when an inner class is exported.
  • Simplified "save debug image" code to emit ikvmdump.dll instead of ikvmdump.exe (the resulting file has not been executable for a while, so it made no sense to pretend it was).
  • Rewrite of nio socket support code.

Source is in cvs. Binaries: ikvmbin-0.31.2454.zip

Wednesday, 20 September 2006 08:16:12 (W. Europe Daylight Time, UTC+02:00)  #    Comments [0]
# Tuesday, 05 September 2006
New Snapshot

A new snapshot with mainly bug fixes and code restructuring.

Changes:

  • Updated to current GNU Classpath cvs version.
  • Fixed Class.forName() regression introduced in 0.28. Doing a Class.forName() on a .NET type using the assembly qualified name wouldn't run the class initializer.
  • Fixed System.arraycopy() performance regression introduced in 0.31 for ikvmc compiled code.
  • Changed java.lang.ref.Reference not to use a WeakReference if the referent is a Class object (since IKVM doesn't support Class gc, it would be a waste).
  • Fixed java.lang.ref.Reference memory leak (a reference associated with a ReferenceQueue would stay around until the referent was GCed).
  • Changed ikvmc to "critical fail" if it triggers a TypeResolve event. If you encounter these, please report them.
  • Fixed stub generator to set inner class access flags correctly in outer class InnerClasses attribute. Previously javac didn't recognize the Annotation inner interface in .NET custom attribute classes as annotation because the annotation bit wasn't set in the outer class.
  • Regenerated mscorlib.jar and System.jar. Removed System.Xml.jar.
  • Fixed bug in VMObjectStreamClass.hasClassInitializer that could cause it to throw a System.NotSupportedException on an array type when the element type was an unfinished dynamic type.
  • Fixed a bug in the hack that looks up the TimeZone.
  • Added IsErased and IsDynamicOnly properties to TypeWrapper.
  • Changed delegate handling to no longer emit the Method interface, but instead use static binding to the target method when possible and otherwise generate dynamic code.
  • Introduced generic handling of DynamicOnly interfaces (both the "Method" and "Annotation" interfaces in respectively delegates and custom attributes are now represented as DynamicOnly types -- i.e. they are implemented entirely through reflection.)
  • Changed bytecode compiler to call ikvm.runtime.getClassFromTypeHandle instead of IKVM.Runtime.GetClassFromTypeHandle for ldc <class> to remove the need to downcast the resulting object to Class.
  • Moved compilation options from static properties of JVM class to instance properties of ClassLoaderWrapper.
  • Did a little cleanup/reorganization of ikvmc.
  • Patched runtime/MemberWrapper.cs to work around gmcs bug.
  • Patched awt/toolkit.cs to work around gmcs bug.
  • Moved AotTypeWrapper static fields to CompilerClassLoader instance fields.
  • Removed TypeWrapper.Assembly property.
  • Fixed WeakReference tracker to use a WeakTrackResurrection handle, to be able to enqueue weak references that are only reachable via a finalizer or are resurrected.
  • Changed file.encoding system property from hardcoded 8859_1 to using System.Text.Encoding.Default.WebName.

Source is in cvs. Binaries: ikvmbin-0.31.2439.zip

Tuesday, 05 September 2006 07:17:14 (W. Europe Daylight Time, UTC+02:00)  #    Comments [0]