# Monday, 25 February 2013
IKDASM Update

I finally created a github repository for ikdasm. A couple of weeks ago I fixed some ildasm compatibility issues and changed pinvokeimpl and marshalas handling to use the IKVM.Reflection specific APIs instead of decoding the pseudo custom attributes (I also used the new IKVM.Reflection feature to disable generating pseudo custom attributes). I added external module support and fixed some other small issues.

The primary purpose of ikdasm is to make sure that the IKVM.Reflection API is complete. I believe it now exposes all relevant Managed PE file features. The secondary feature is to test IKVM.Reflection and to make this easy ikdasm replicates (almost) all ildasm quirks to enable comparing the output files. I disassembled a large number of files (including C++/CLI and Managed C++ files) and compared the results.

Only a small subset of ildasm functionality has been cloned. There is no GUI and most command line options are also not implemented.

Pull requests are welcome.

Monday, 25 February 2013 11:58:14 (W. Europe Standard Time, UTC+01:00)  #    Comments [0]
New Development Snapshot

Still more changes to better support what I'll start calling "mixed mode" (i.e. ikvmc compiled assemblies that use dynamically loaded classes or use dynamic binding to classes in another assembly).

Another change is that runtime stub class generation is now based on the ikvmstub class file writer, instead of the very old code that was reflection based. This means that stubs can now acurately be generated even when some of the types involved are not available.

Changes:

  • Refactored assembly class loading.
  • Added ikvm.runtime.EnumerationWrapper to expose an IEnumerable as a java.util.Enumeration.
  • Removed the old runtime Java stub class generator and replaced it with the ikvmstub core.
  • Allow dynamic class loading from boot class "path" and referenced assemblies.
  • Regression fix. The previous custom assembly class loader construction rewrite introduced a bug.
  • Bug fix. MethodHandle should be able to call dynamic only methods.
  • Bug fix. MethodHandle to Object.clone/finalize should be special cased.
  • Reimplemented dynamic binding on top of MethodHandles.

Binaries available here: ikvmbin-7.3.4804.zip

Monday, 25 February 2013 07:41:17 (W. Europe Standard Time, UTC+01:00)  #    Comments [0]
# Wednesday, 20 February 2013
New Development Snapshot

A quick update because the previous snapshot had a bug that caused ikvmc to be completely broken on the CLR x86 JIT.

Changes:

  • Changed build to explicitly exclude the classes that are already defined in map.xml.
  • Changed ikvmc to add uncompilable classes loaded from the file system to classes.jar.
  • Changed ikvmc to copy zip file comment.
  • Changed ikvmc to emit a warning if a remapped type duplicates a loaded class.
  • Removed CallerID optimization special casing since we can now call internal members from dynamic assemblies.
  • Added some version information to the Internal Compiler Error message.
  • Added some version information to runtime critical failure.
  • Fixed AttributeHelper to have a deterministic class constructor.
  • Bug fix. Disallow invalid class names in AssemblyClassLoader.loadClass().
  • Removed the special casing of generic type definition loading as we've since exposed the generic type definitions to Java.
  • Some beginnings of class loading refactoring.

Binaries available here: ikvmbin-7.3.4799.zip

Wednesday, 20 February 2013 08:24:44 (W. Europe Standard Time, UTC+01:00)  #    Comments [0]
# Monday, 18 February 2013
New Development Snapshot

Lot's of changes in just a week. The most interesting one being that ikvmc and the runtime now work together to project all the classes that were in the original jars compiled by ikvmc are now visible in the same (virtual) jars at runtime.

To avoid making the generated assemblies much bigger, this is implemented by having ikvmc generate a compressed file called --ikvm-classes--/ in the resources jar that contains the names of the classes compiled from this jar. This typically adds about 0.5% size overhead. At runtime when that jar is read in by java.util.zip.ZipFile it expands the list of class names to create virtual ZipEntries. Only when a virtual class resource is accessed is the class stub generated.

Changes:

  • Fixed ikvmc to give a proper error message if it fails to write to the output file.
  • If a class can't be statically compiled due to a missing base class/interface, include it as a resource.
  • Modified the assembly class loader to try to load classes from resources.
  • Made dynamic binding to unloadable types the default (for ikvmc).
  • Added -static option to ikvmc to disable dynamic binding.
  • Unified all ikvmc filename validation.
  • Implemented StandardGlyphVector.getGlyphOutline().
  • Bug fix. When looking for a method to override we should handle internal access methods.
  • Fixed some runtime memory model issues (for non-x86 architectures).
  • Bug fix. Custom attribute annotation should skip indexer properties.
  • Bug fix. The available() method of the InputStream returned by ZipFile.getInputStream() was based on ZipEntry passed in, instead of the actual one.
  • Fixed ikvmc to suppress "class not found" warning for a classes that fails to compile for any reason (because we've already given a warning about it).
  • Bug fix. Don't look for main method in excluded classes.
  • Unified the handling of resources and classes in ikvmc.
  • Include all uncompilable .class files (from jars) into the resource jars.
  • Project stub classes into the jar the classes originated from.
  • Fixed ikvmc to prefer the last jar entry if there are duplicate entries. This mirrors the behavior of Java and dynamic mode.
  • Fixed ikvmc to compare extensions case sensitive to find .class files.
  • Fixed ikvmc to use the jar entry name, instead of the class name to load classes.
  • Removed exclude.lst left over from ancient times.
  • Removed META-INF/mailcap.default and META-INF/mimetypes.default resources that are no longer in resources.jar.
  • Changed ikvmc -recurse: option to give a fatal error if it matches no files.

Binaries available here: ikvmbin-7.3.4796.zip

Monday, 18 February 2013 09:05:07 (W. Europe Standard Time, UTC+01:00)  #    Comments [0]
# Monday, 11 February 2013
New Development Snapshot

The recent architectural change makes it possible for the static compiler to use dynamic binding when it encounters a missing type. This in turn makes the dynamic binding support more important, so I've been fixing a lot of bugs in this area.

Currently, ikvmc will still emit code that statically throws a NoClassDefFoundError when accessing missing types, but in the future the default will change to generate dynamic binding code in this case.

Changes:

  • Fixed a bug with Graphics.setComposite(x). This fixes most paint artefacts of Nimbus L&F.
  • Fixed a NPE in constructor of BufferedImage.
  • Fixed TexturePaint bugs.
  • Enable ldc to work for unloadable types in dynamic mode.
  • Changed dynamic bytecode helper methods to be CallerID based instead of trusting the caller to provide the right context type handle.
  • Use sun.launcher.LauncherHelper to make the launcher more consistent with Java.
  • Implemented package access checks in dynamic mode.
  • Fixed reflection handling of unloadable types.
  • Added CodeGenOptions.DisableDynamicBinding to disable dynamic binding, instead of conditional compilation.
  • Bug fix. Dynamic method invocations should unwrap InvocationTargetException.
  • Bug fix. Dynamic instantiation should throw InstantiationError when trying to instantiate an abstract class.
  • Bug fix. Dynamic invokespecial (that isn't a new) should fail verification.
  • Bug fix. Dynamic method lookup should also look in base classes (for non-constructor methods).
  • Bug fix. When dynamically calling a non-constructor instance method, the receiver object should be of the correct type.
  • Added support for setPaint with custom Paint implementation.
  • Added support for dynamic (non-loadable type) annotations in statically compiled code.
  • Have ikvmc record inner classes even if they can't be loaded.
  • Have ikvmc record the outer class even if it is not loadable.
  • Bug fix. If the runtime tries to load a class from an assembly with a custom assembly class loader, the custom assembly class loader should be called. Previously it would only be called if the Java class loader had been instantiated.
  • Bug fix. We should emit miranda methods for non-abstract classes too.
  • Bug fix. Mark "missing" interface methods so that subclasses (that are compiled separately) know that the base class is incomplete.
  • Allow dynamic assemblies injected into assembly class loaders to be (debug dump) saved.
  • Changed the build system to automatically scan all sources files for copyright statements and validate that all GPL licensed files include the Classpath exception.
  • Removed resource compiler dependency from JVM.DLL build.
  • Bug fix. Custom assembly class loader was made visible to other threads while it was still being constructed.
  • Stop considering ACC_SUPER when linking invokespecial (unless compatibility switch is set). This change matches the security change in Java 7u13.
  • Improved ldc MethodType: Use nested type with class constructor to create values with statically know signatures (like ldc MethodHandle).
  • Improved ldc MethodType: Use caching for dynamicallly constructed MethodType values but retry on failure.
  • Fixed dynamic dispatch class loading exception handling to wrap non-java.lang.Error exceptions in NoClassDefFoundError.
  • Added support for dynamic ldc MethodHandle.
  • Added support for dynamically linking the boostrap method of an invokedynamic.
  • IKVM.Reflection: Expose the Name and __ModuleHash for missing external Modules.
  • IKVM.Reflection: Regression fix. The AssemblyNames returned by Module.__GetReferencedAssemblies() didn't have the ContentType set for windowruntime assembly references.
  • IKVM.Reflection: Added new public API Module.__ResolveTypeSpecCustomModifiers() to resolve the (useless) custom modifiers that can be put on TypeSpecs.
  • IKVM.Reflection: Added another overload of the public API Module.__GetSectionInfo() that returns more information about the section.
  • IKVM.Reflection: Bug fix. The OriginalFilename in the version info resource should only include the filename, not the path.

Binaries available here: ikvmbin-7.3.4790.zip

Monday, 11 February 2013 13:02:04 (W. Europe Standard Time, UTC+01:00)  #    Comments [0]