# Monday, 12 July 2010
IKVM.NET 0.44 Release Candidate 1

A new release candidate with two bug fixes.

Changes:

  • Changed version to 0.44.0.1
  • Fixed verifier regression introduced with try/fault handler changes. Thanks to Enrico Minack for reporting this.
  • When a protected field is accessed in a non-public base class in another assembly that is simultaneously compiled, we need to add an InternalsVisibleTo to the callee assembly for the caller assembly.

Binary available here: ikvmbin-0.44.0.1.zip

Sources: ikvmsrc-0.44.0.1.zip, openjdk6-b18-stripped.zip

The sources zip no longer contains any binaries.

Monday, 12 July 2010 09:09:49 (W. Europe Daylight Time, UTC+02:00)  #    Comments [0]
# Wednesday, 07 July 2010
IKVM.NET 0.44 Release Candidate 0

The first 0.44 release candidate is available.

What's New (relative to IKVM.NET 0.42):

  • Integrated OpenJDK 6 build 18
  • Bug fixes
  • Code cleanup
  • Many AWT improvements (by Nat and Volker)
  • IKVM.Reflection
  • Ability to build from source targetting .NET 4.0
  • Reflection optimizations
  • Codegen optimizations
  • JNI optimizations
  • Introduced IKVM.OpenJDK.Tools.dll
  • Improved build process (removed dependency on shipping stub jar binaries)
  • Improved ikvmc parameter validation and error handling
  • Annotated all security critical code with .NET 4.0 security model custom attributes
  • Added -nostdlib option to ikvmstub and ikvmc to allow them to work with .NET 4.0 assemblies (while running on .NET 2.0)
  • Implemented RuntimeMXBean and OperatingSystemMXBean
  • Experimental (when built from source, targetting .NET 4.0) support for class GC

Binary available here: ikvmbin-0.44.0.0.zip

Sources: ikvmsrc-0.44.0.0.zip, openjdk6-b18-stripped.zip

The sources zip no longer contains any binaries.

Wednesday, 07 July 2010 15:54:40 (W. Europe Daylight Time, UTC+02:00)  #    Comments [0]
Bug Reports

I've disabled the ability for anonymous users to post bug reports (and feature requests). Two useless duplicate reports (3026137 and 3026140) pushed me over the edge.

Some bug reporting tips:

  • Include all the (possibly) relevant information (IKVM.NET, .NET / Mono and Operating System version numbers, CPU architecture, error messages, warning messages).
  • Try to create a small repro that demonstrates the problem. Make sure it compiles, don't just include a non-compiling code snippet.
  • Clearly separate fact from speculation.
  • Read this excellent essay on How to Report Bugs Effectively by Simon Tatham.

P.S.  In the case of the above bug report, the poster tried to look at the code for ServerSocket.accept() with Reflector and Reflector crashed. This is a Reflector bug, it simply doesn't understand the code constructs that ikvmc generates (even though they are perfectly valid).

Wednesday, 07 July 2010 14:11:51 (W. Europe Daylight Time, UTC+02:00)  #    Comments [2]
# Wednesday, 30 June 2010
IKVM.Reflection Testing

I decided to do some brute force testing of IKVM.Reflection. I ran my LinkerPrototype on almost all assemblies in the .NET and Mono GACs. This resulted in a number of fixes to the linker (but note that it's still just a toy) and a bunch of fixes to IKVM.Reflection. Most of these fixes aren't relevant for IKVM.NET, but I want IKVM.Reflection to be useful as a general System.Reflection replacement.

Fixes:

  • MethodInfo.DeclaringType should return null for global generic method instances.
  • Fixed support for TypeSpec in custom modifiers.
  • Fixed bug that caused duplicate MethodSpec rows to be emitted.
  • Fixed bug that caused duplicate MemberRef rows to be emitted.
  • Allow use of generic method definition in IL stream.
  • Made signature binding lazy for GenericMethodInstance.
  • Allow declarative security attributes to use non-public constructors.
  • Implemented ManifestResourceInfo.FileName property.
  • Implemented workaround for incorrect exception table length in methods generated by VB compiler.
  • Fixed exception filter block handling to support having both regular handlers and a filter for the same try block.
  • Fixed metadata header to account for the actual ImageRuntimeVersion string length, instead of assuming it to be "v2.0.50727".
  • Implemented __GetDeclaredMethods() for ArrayType and MultiArrayType.
  • Fixed two MarshalSpec blob parsing bugs.
  • Fixed several places where generic type definitions would be encoded as TypeDef token instead of TypeSpec.
  • Re-instroduced generic type instantation for "identity" instantations of TypeBuilder types.
  • Several fixes for C++/CLI that tends to stick custom modifiers everywhere. Also, support void& in local variable signature.
  • Support fields that have an RVA, but where it is set to zero (C++/CLI does this).
  • Added support for a TypeRef with a null ResolutionScope.

The source is available in cvs and the LinkerPrototype zip link above contains the most recent IKVM.Reflection.dll, but if you want just the IKVM.Reflection.dll binary, it is available here: ikvm-reflect-0.43.3833.zip

Wednesday, 30 June 2010 10:47:31 (W. Europe Daylight Time, UTC+02:00)  #    Comments [0]
Apache PDFBox 1.2.0 Released

Yesterday the release of Apache PDFBox 1.2.0 was announced. Thanks to Daniel Wilson the included Ant build script to build the .NET version has been updated to work with IKVM.NET 0.42.

Wednesday, 30 June 2010 08:50:07 (W. Europe Daylight Time, UTC+02:00)  #    Comments [2]
# Monday, 21 June 2010
New Development Snapshot

One more development snapshot. A couple of minor tweaks.

Changes:

  • Updated copyright notices.
  • Removed Winforms thread workaround timer that was previously required to make the thread abortable.
  • IKVM.Reflection: Fixed a couple of bugs related to escaped type names not being unescaped.
  • IKVM.Reflection: Changed assembly reference caching to be more efficient and to handle the fact that assembly identities can change (if it is an AssemblyBuilder).
  • IKVM.Reflection: Changed assembly identity caching to only add identities to the cache when they are used to look up the assembly.

Binaries available here: ikvmbin-0.43.3824.zip

Monday, 21 June 2010 10:36:02 (W. Europe Daylight Time, UTC+02:00)  #    Comments [2]
# Monday, 14 June 2010
CLR JIT Bugs Found During IKVM.NET Development

"It is actually fairly common that people notice that things fail under retail but not debug and tend to blame code generation.
While a code generation bug is possible, as a matter of statistics, it is not likely."
-- Vance Morrison

Date CLR Arch Type Description
2010-06-12 v4 x64 Incorrect code Optimizer incorrectly propagates invariants.
2010-06-04 v2, v4 x86 Crash Access violation while compiling code.
2010-04-11 v4 x64 Vulnerability Type safety vulnerability caused by incorrect optimization.
2009-10-28 v4 beta 2 x64 Vulnerability Type safety vulnerability in exception handler code.
2007-07-02 v2 x64 Exception System.InvalidProgramException on verifiable IL.
2007-05-11 v2 x64 Incorrect code 0.0 and -0.0 are considered the same by the optimizer.
2006-12-06 v2 x86 Vulnerability Ability to access array outside of bounds.
Monday, 14 June 2010 10:30:23 (W. Europe Daylight Time, UTC+02:00)  #    Comments [2]
New Development Snapshot

I finished all the .NET 4.0 security model changes. If you build from source, you can now (optionally) build on .NET 4.0 and get native .NET 4.0 assemblies that use the new .NET 4.0 security model (and also experimental class gc support). The .NET 2.0 binaries also work on .NET 4.0.

This is probably the final development snapshot before the first 0.44 release candidate and it has been tested more than a typical development snapshot. Please start testing it and, as always, feedback is appreciated.

Changes:

  • Final set of .NET 4.0 security model changes.
  • Added "first-pass" build of IKVM.AWT.WinForms.dll and moved "native" AWT code from IKVM.Runtime.dll to IKVM.AWT.WinForms.dll.
  • Fixed verifier bug that caused verification errors if "new" string was interned before verifying any code. Thanks to Andrey Malakov for tracking this down.
  • Include more parts of tools.jar in IKVM.OpenJDK.Tools.dll.
  • Add feature to expand environment variables in system properties specified with -D ikvmc option.
  • Added jdk-tools target to openjdk.build to build javac.exe, javah.exe and javap.exe (not included in the default build).
  • Added build script to build ikvmdoc.exe (not included in the default build).
  • Fixed JNIEnv.DescribeException() (NPE instead of printing the exception).
  • IKVM.Reflection: When the user string heap overflows, throw an exception instead of silently creating corrupt image.
  • IKVM.Reflection: Fixed .PDB emitter to work with .NET 4.0. Thanks to Jb Evain for the heads up on this.

Binaries available here: ikvmbin-0.43.3817.zip

Monday, 14 June 2010 07:53:11 (W. Europe Daylight Time, UTC+02:00)  #    Comments [0]
# Tuesday, 08 June 2010
New Development Snapshot

I finally did the work necessary to improve the codegen for finally handlers. More improvements are still possible, but at least most finally handlers will now execute without touching the exception object (and hence without having to do any mapping/stack trace collection work). It also means that assembly file sizes are a little bit smaller and that the debugging experience should be improved (less exception catching & rethrowing).

Changes:

  • Restructuring of verifier/analyzer code.
  • Fixed exception stack trace collection regression that caused frame part of the exception stack trace collection infrastructure to show up in some stack traces.
  • Make synthesized .class resources available via ClassLoader.getResources() (note the plural) as well.
  • Use a LinkedHashMap to preserve annotation order (but only in dynamic mode, because for compiled code we get the .NET attributes in unspecified order). By my reading of the API spec there is no guarantee about the ordering, but the Google Guice test suite depends on it.
  • TypeWrapper.AssertFinished() doesn't make sense for the static compiler anymore.
  • Moved mutable flags from Instruction array into separate array.
  • Made ExceptionTableEntry immutable.
  • Implemented codegen improvement to use CLR fault handlers for Java catch all handlers, whenever possible.
  • IKVM.Reflection: Order try blocks inside handlers before the entries for that handler. Workaround for CLR x86 JIT null pointer dereference bug.

Binaries available here: ikvmbin-0.43.3811.zip

Tuesday, 08 June 2010 08:24:58 (W. Europe Daylight Time, UTC+02:00)  #    Comments [0]
# Tuesday, 01 June 2010
New Development Snapshot

I got a little side tracked by the investigation of the Google Collections test suite performance issue, reported by Albert Strasheim in the comments to the previous snapshot.

This caused me to do some work on exception handling (unfortunately without any performance benefit to the Google Collections test suite) which, in turn, triggered something I've been wanting to do for while, namely to introduce a stub version of IKVM.OpenJDK.Core.dll which can be referenced by IKVM.Runtime.dll during FIRST_PASS compilation, to make it possible to have a cyclic dependency between IKVM.Runtime.dll and IKVM.OpenJDK.Core.dll for method signatures and not just the method bodies as was previously the case.

Changes:

  • Added (limited) support to ikvmc for cyclic dependency compilation. The build now takes advantage of this to make it possible to use strongly typed method signatures for "native" methods implemented in IKVM.Runtime.dll.
  • Changed reflection to convert any Method|FieldAccessExceptions to occur (in partial trust) into IllegalAccessException.
  • Fixed type conversion verification issues in reflection dynamic methods.
  • Moved exception handling code to IKVM.Runtime.dll (for IKVM.OpenJDK.Core.dll) and cleaned up several issues. Changed mapping API to be more efficient (in terms of bytecode size, and to allow stack trace collection to be bypassed for discarded remapped exceptions).
  • Added new public API to unmap exception (ikvm.runtime.Util.unmapException()).
  • Fixed loop counter integer overflow bug in tableswitch bytecode parsing. Bug #3009543.
  • IKVM.Reflection: Fixed bug in constructor importing that could cause Module.ResolveMethod() on ModuleBuilder to return the underlying MethodInfo instead of the ConstructorInfo wrapper.

Binaries available here: ikvmbin-0.43.3803.zip

Tuesday, 01 June 2010 07:36:30 (W. Europe Daylight Time, UTC+02:00)  #    Comments [0]