# Monday, May 23, 2005
« Cross Language Debugging in MonoDevelop | Main | PDC '05 »
New Snapshot

Partial Trust

I did some research into supporting partial trust and it looks like it might be feasible. This snapshot already contains some changes to better support running in partial trust (particularly for IKVM.GNU.Classpath, IKVM.Runtime contains unsafe code so it currently needs to be trusted). On .NET 1.1 non of the built in partial trust permission sets are suitable, because I require ReflectionPermission(ReflectionPermissionFlag.TypeInformation). In Whidbey this permission flag is deprecated, so the story looks more promissing there.

One of the consequences of adding partial trust support is that IKVM.Runtime.dll will need to be split into several parts. At the very least the JNI implementation will need to be in a separate assembly, so that the common non-JNI scenarios won't require SkipVerification permission.

Exception Handling

I made some major changes to exception handling in this version. However, for Java code nothing should change (except that it hopefully runs a little bit faster), but for .NET/Java interop there are some important changes:

  • Exceptions generated by the CLR or .NET code (e.g. System.NullReferenceException) will no longer be changed into their Java equivalents for non-Java code. This means that when you catch an exception in IKVM Java code, you'll still see the corresponding Java exception (e.g. java.lang.NullPointerException), but when you rethrow the exception, the original exception gets thrown.
  • When Java code explicitly throws a .NET exception (e.g. System.NullReferenceException) it is no longer remapped to the Java equivalent.
  • Catching exceptions now faithfully corresponds to the IKVM type system. This means that you can now use catch(cli.System.Exception) to catch the unremapped .NET exceptions.

This is a major step towards my ultimate vision for exception handling, but I'm not nearly there yet. Other changes I want to make include adding more exception state to java.lang.Throwable instead of the WeakHashMap construct that is currently used (the WeakHashMap will still be required to associate the .NET exceptions with their remapped Java exceptions). I also want to use exception filters to check for remapped exceptions, to make the debugging experience better and the bytecode compiler needs to be improved to recognize try {} finally {} constructs so that they can be compiled as .NET try {} finally {} blocks, instead of the currently used and vastly less efficient try {} catch() { throw; }.

Other News

Mark Proctor reports that Drools runs on IKVM.


  • Sync'ed with GNU Classpath cvs.
  • Removed VMClass.forName() implementation (rely on standard implementation instead).
  • Fixed ikvmc to ignore directories in jars.
  • Added "isStatic" parameter to JNI methods ToReflectedMethod and ToReflectedField (this parameter is missing in the JNI specification, but exists in the Sun implementation).
  • Removed workaround for previously unimplemented MethodBase.GetMethodFromHandle in Mono from JNI code.
  • Removed workaround for previously broken GCHandle.IsAllocated in Mono.
  • Removed workaround for previously broken Assembly.GetTypes() in Mono.
  • Disabled finalizer in MemberWrapper (since code unloading isn't supported, members will never be finalized anyway).
  • Added MirandaMethod to MemberFlags.
  • Fixed cosmetic bug in verifier that caused unloadable array types to be named incorrectly.
  • Implemented 1.5 java.lang.String methods (except String.format()).
  • Added ldsfld instruction support to remapper.
  • Implemented ikvmc -compressresources option, to use a simple compression algorithm for resources.
  • Classpath locale information is now in *.properties files instead of classes with resource compression this shaves a couple of hundred KB of the size of IKVM.GNU.Classpath.
  • Many changes to exception handling to improve performance, compatibility and consistency.
  • Added EditorBrowsable(Never) attribute to helper methods in java.lang.Throwable.
  • Fixed method "cloaking" (i.e. hiding .NET methods on Java types in IntelliSense) to hide inherited static methods as well.
  • Various fixes to work towards supporting running in partial trust.
  • Fixed ikvmc bug that caused it to run Java code when tracing was enabled.
  • Added support for applying CodeAccessSecurityAttribute derived attributes (although not at the assembly level yet).
  • Fixed a Miranda bug that caused incorrect classes to be generated for abstract classes implementing java.lang.Comparable but not implementing compareTo.
  • Implemented support for applying attributes to methods/fields defined in map.xml.
  • Changed reflection to disallow reflecting on IKVM.Runtime types (to avoid potential security holes, where Java code can access internal members of IKVM.Runtime).
  • Enabled generation of debug info when a debugger is attached (at the time the runtime is initializing), to allow debugging of dynamically generated code (a Whidbey feature, although in beta 2 it doesn't work yet).
  • Added check to ikvmc to make sure that referenced ikvmc-generated assemblies were compiled with the same version of the ikvm runtime.

New snapshots: just the binaries and source plus binaries.

Monday, May 23, 2005 11:31:14 AM (W. Europe Daylight Time, UTC+02:00)  #    Comments [0]
Comments are closed.