6
I Use This!
Activity Not Available

News

Posted about 7 years ago by Jeroen
After almost fifteen years I have decided to quit working on IKVM.NET. The decision has been a long time coming. Those of you that saw yesterday’s Twitter spat, please don’t assume that was the cause. It rather shared an underlying cause. I’ve slowly ... [More] been losing faith in .NET. Looking back, I guess this process started with the release of .NET 3.5. On the Java side things don’t look much better. The Java 9 module system reminds me too much of the generics erasure debacle. I hope someone will fork IKVM.NET and continue working on it. Although, I’d appreciate it if they’d pick another name. I’ve gotten so much criticism for the name over the years, that I’d like to hang on to it 😊 I’d like to thank the following people for helping me make this journey or making the journey so much fun: Brian Goetz, Chris Brumme, Chris Laffra, Dawid Weiss, Erik Meijer, Jb Evain, John Rose, Mads Torgersen, Mark Reinhold, Volker Berlin, Wayne Kovsky, The GNU Classpath Community, The Mono Community. And I want to especially thank my friend Miguel de Icaza for his guidance, support, inspiration and tireless efforts to promote IKVM. Thank you all and goodbye. [Less]
Posted over 8 years ago by Jeroen
The first release candidate is finally available. It can be downloaded here or from NuGet. What's New (relative to IKVM.NET 8.0): Integrated OpenJDK 8u45. Many fixes to late binding support. Added ikvmc support for deterministic ... [More] output files. Various sun.misc.Unsafe improvements. Many minor bug fixes and performance tweaks. Changes since previous development snapshot: Assemblies are strong named. Fix for bug #303. ikvmc internal compiler error when trying to get interfaces from type from missing assembly reference. Implemented NIO atomic file move on Windows. Binaries available here: ikvmbin-8.1.5717.0.zip Sources: ikvmsrc-8.1.5717.0.zip, openjdk-8u45-b14-stripped.zip [Less]
Posted over 8 years ago by Jeroen
The first release candidate is finally available. It can be downloaded here or from NuGet. What's New (relative to IKVM.NET 8.0): Integrated OpenJDK 8u45. Many fixes to late binding support. Added ikvmc support for deterministic ... [More] output files. Various sun.misc.Unsafe improvements. Many minor bug fixes and performance tweaks. Changes since previous development snapshot: Assemblies are strong named. Fix for bug #303. ikvmc internal compiler error when trying to get interfaces from type from missing assembly reference. Implemented NIO atomic file move on Windows. Binaries available here: ikvmbin-8.1.5717.0.zip Sources: ikvmsrc-8.1.5717.0.zip, openjdk-8u45-b14-stripped.zip [Less]
Posted almost 9 years ago by Jeroen
Final 8.1 development snapshot. Release candidate 0 will be next (after .NET 4.6 RTM). Changes: Updated HOWTO reference to OpenJDK 8u45. Extract Windows version from kernel32.dll to avoid version lie. Idea stolen from OpenJDK. Moved unused ... [More] field removal optimization to a later stage in the compilation. Made field removal optimization check more strict to only remove final fields and not remove fields that have annotations. Added support for automatically passing in fields to "native" methods. Various minor clean ups. Added FieldWrapper.IsSerialVersionUID property to properly (and consistently) detect serialVersionUID fields. Improved side effect free static initializer detection. Improved -removeassertions ikvmc optimization to remove more code (esp. allow otherwise empty static initializers to be optimized away). Binaries available here: ikvmbin-8.1.5666.zip [Less]
Posted almost 9 years ago by Jeroen
Final 8.1 development snapshot. Release candidate 0 will be next (after .NET 4.6 RTM). Changes: Updated HOWTO reference to OpenJDK 8u45. Extract Windows version from kernel32.dll to avoid version lie. Idea stolen from OpenJDK. ... [More] Moved unused field removal optimization to a later stage in the compilation. Made field removal optimization check more strict to only remove final fields and not remove fields that have annotations. Added support for automatically passing in fields to "native" methods. Various minor clean ups. Added FieldWrapper.IsSerialVersionUID property to properly (and consistently) detect serialVersionUID fields. Improved side effect free static initializer detection. Improved -removeassertions ikvmc optimization to remove more code (esp. allow otherwise empty static initializers to be optimized away). Binaries available here: ikvmbin-8.1.5666.zip [Less]
Posted almost 9 years ago by Jeroen
Last time I mentioned that with the integration of OpenJDK 8u45 MethodHandle performance went from awful to unusable. That was pretty literal as the JSR 292 test cases that I regularly run went from taking about 8 minutes to more than 30 minutes ... [More] (when my patience ran out). Using sophisticated profiling techniques (pressing Ctrl-Break a few times) I determined that a big part of the problem was MethodHandle.asType(). So I wrote a microbenchmark:    IKVM 8.0.5449.1  IKVM 8.1.5638 asType.permutations(1) 2108 9039 asType.permutations(2) 2476 17269 The numbers are times in milliseconds. Clearly not a good trend. I did not investigate deeply what changed in OpenJDK, but after looking at the 8u45 code it was clear that too many intermediate MethodHandles were being created. So I rewrote asType to create a single LambdaForm to do all the work at once. This improved the performance a bit, but the disturbing increase in time for the second iteration was still there. Once again I decided not to investigate the root cause of this, but simply to assume that it was because of anonymous type creation (the CLR has no anonymous types and creating a type is relatively expensive). Avoiding anonymous type creation turned out to be easy (well, the high level design was easy, the actual implementation took a lot more time). I just had to replace the LambdaForm compiler. There is a single method that represents the exact point where I can come in and change the implementation: static MemberName generateCustomizedCode(LambdaForm form, MethodType invokerType) { ... } In OpenJDK this method compiles the LambdaForm into a static method in an anonymous class and returns a MemberName that points to the static method. All I had to do was replace this method with my own implementation that directly generates a .NET DynamicMethod. As I said before, the idea was simple, actually getting the implementation correct took a couple of weeks (part time). With both these optimizations in place, MethodHandle performance is back to awful (actually, it is less afwul than it was before):    IKVM 8.0.5449.1  IKVM 8.1.5638  IKVM 8.1.5653 asType.permutations(1) 2108 9039 314 asType.permutations(2) 2476 17269 210 The running time of the JSR 292 test cases went down to less than 7 minutes. So I was satisfied. There are many more opportunities to improve the MethodHandle performance on IKVM, but so far no IKVM user has complained about it, so it is not a priority. Note that Java 8 lambdas are not implemented using MethodHandles on IKVM. Changes: Fixed performance bug. Base type of java.lang.Object was not cached. Untangled TypeWrapper.Finish() from member linking to improve Finish performance for already compiled types. Improved MethodHandle.asType() performance by directly creating a single LambdaForm to do the conversion, instead of creating various intermediate forms (and MethodHandles). Make non-public final methods defined in map.xml that don't override anything automatically non-virtual. Optimized LambdaForm compiler. IKVM.Reflection: Added Type.__GetGenericParameterConstraintCustomModifiers() API. Binaries available here: ikvmbin-8.1.5653.zip [Less]
Posted almost 9 years ago by Jeroen
Last time I mentioned that with the integration of OpenJDK 8u45 MethodHandle performance went from awful to unusable. That was pretty literal as the JSR 292 test cases that I regularly run went from taking about 8 minutes to more than 30 minutes ... [More] (when my patience ran out). Using sophisticated profiling techniques (pressing Ctrl-Break a few times) I determined that a big part of the problem was MethodHandle.asType(). So I wrote a microbenchmark:    IKVM 8.0.5449.1  IKVM 8.1.5638 asType.permutations(1) 2108 9039 asType.permutations(2) 2476 17269 The numbers are times in milliseconds. Clearly not a good trend. I did not investigate deeply what changed in OpenJDK, but after looking at the 8u45 code it was clear that too many intermediate MethodHandles were being created. So I rewrote asType to create a single LambdaForm to do all the work at once. This improved the performance a bit, but the disturbing increase in time for the second iteration was still there. Once again I decided not to investigate the root cause of this, but simply to assume that it was because of anonymous type creation (the CLR has no anonymous types and creating a type is relatively expensive). Avoiding anonymous type creation turned out to be easy (well, the high level design was easy, the actual implementation took a lot more time). I just had to replace the LambdaForm compiler. There is a single method that represents the exact point where I can come in and change the implementation: static MemberName generateCustomizedCode(LambdaForm form, MethodType invokerType) { ... } In OpenJDK this method compiles the LambdaForm into a static method in an anonymous class and returns a MemberName that points to the static method. All I had to do was replace this method with my own implementation that directly generates a .NET DynamicMethod. As I said before, the idea was simple, actually getting the implementation correct took a couple of weeks (part time). With both these optimizations in place, MethodHandle performance is back to awful (actually, it is less afwul than it was before):    IKVM 8.0.5449.1  IKVM 8.1.5638  IKVM 8.1.5653 asType.permutations(1) 2108 9039 314 asType.permutations(2) 2476 17269 210 The running time of the JSR 292 test cases went down to less than 7 minutes. So I was satisfied. There are many more opportunities to improve the MethodHandle performance on IKVM, but so far no IKVM user has complained about it, so it is not a priority. Note that Java 8 lambdas are not implemented using MethodHandles on IKVM. Changes: Fixed performance bug. Base type of java.lang.Object was not cached. Untangled TypeWrapper.Finish() from member linking to improve Finish performance for already compiled types. Improved MethodHandle.asType() performance by directly creating a single LambdaForm to do the conversion, instead of creating various intermediate forms (and MethodHandles). Make non-public final methods defined in map.xml that don't override anything automatically non-virtual. Optimized LambdaForm compiler. IKVM.Reflection: Added Type.__GetGenericParameterConstraintCustomModifiers() API. Binaries available here: ikvmbin-8.1.5653.zip [Less]
Posted almost 9 years ago by Jeroen
I integrated OpenJDK 8u45, so a new development snapshot is warranted. MethodHandle performance regressed from awful to unusable, so that's something I need to look into. Changes: Merged OpenJDK 8u45. Special thanks to @mihi42 for ... [More] helping me with the download. Bug fix. Don't enforce canonical UTF8 encoding for class file versions <= 47. Added support for "high contrast" desktop property. Inspired by patch from Daniel Zatonyi . Handle more text sources for clipboard copy by using an appropriate Reader for the source data. Patch by Daniel Zatonyi . Fixed drag-n-drop coordinates. Patch by Daniel Zatonyi . Fixed Graphics.clipRect(). Fix by Daniel Zatonyi . Bug fix. ReferenceQueue should not keep registered (but not yet enqueued) Reference objects alive. Added Unsafe.staticFieldOffset() and Unsafe.staticFieldBase() methods. sun.misc.Unsafe: Replaced (broken) TypedReference based field CompareExchange with DynamicMethod based implementation. Fixed clone/finalize invocation via MethodHandle. Fixed build to allow nasgen to work with 1.8.0_40. IKVM.Reflection: Fixed known custom attribute handling. They should be recognized by type name, not type identity. IKVM.Reflection: Added Module.__TryGetImplMap() public API to get ImplMap by token. IKVM.Reflection: Added new public APIs to help deal with built-in types even when they are not defined in mscorlib: Type.__IsBuiltIn and Universe.GetBuiltInType(string ns, string name). Binaries available here: ikvmbin-8.1.5638.zip Sources: ikvmsrc-8.1.5638.zip, openjdk-8u45-b14-stripped.zip [Less]
Posted almost 9 years ago by Jeroen
I integrated OpenJDK 8u45, so a new development snapshot is warranted. MethodHandle performance regressed from awful to unusable, so that's something I need to look into. Changes: Merged OpenJDK 8u45. Special thanks to @mihi42 for helping me ... [More] with the download. Bug fix. Don't enforce canonical UTF8 encoding for class file versions <= 47. Bug fix. ReferenceQueue should not keep registered (but not yet enqueued) Reference objects alive. Added Unsafe.staticFieldOffset() and Unsafe.staticFieldBase() methods. sun.misc.Unsafe: Replaced (broken) TypedReference based field CompareExchange with DynamicMethod based implementation. Fixed clone/finalize invocation via MethodHandle. Fixed build to allow nasgen to work with 1.8.0_40. IKVM.Reflection: Fixed known custom attribute handling. They should be recognized by type name, not type identity. IKVM.Reflection: Added Module.__TryGetImplMap() public API to get ImplMap by token. IKVM.Reflection: Added new public APIs to help deal with built-in types even when they are not defined in mscorlib: Type.__IsBuiltIn and Universe.GetBuiltInType(string ns, string name). Binaries available here: ikvmbin-8.1.5638.zip Sources: ikvmsrc-8.1.5638.zip, openjdk-8u45-b14-stripped.zip [Less]
Posted about 9 years ago by Jeroen
After debugging a stack overflow caused by a weird class loader, I decided to make the runtime more robust against this and as a side effect I added the ability to disable eager class loading. This in turn made it easier to test the late binding ... [More] infrastructure (which is used when a class is not yet available while a method is compiled) and that testing revealed a large number of bugs that have now been fixed. Changes: Bug fix. When -Xsave is used the modopt types should be attached to unloadable types in inherited method signatures. Bug fix. Don't try to get constructor on generic instantiation containing a TypeBuilder generic parameter. Use the last write time of the input file for resources read from the file system. Enable UniverseOptions.DeterministicOutput for ikvmc (unless -debug option is used). Copy timestamps from source files for generated files that end up in resources.jar. The zip file timestamp is in local time, but for deterministic builds we don't want to depend on system timezone, so we have to store the UTC time. Bug fix. Removed legacy (incorrect) array assignability check that compensated for the lack of ghost array typing. This should have been removed when ghost array tagging was introduced. Bug fix. Verifier should disallow using invokeinterface on private methods. The message of a VM generated java.lang.NoClassDefFoundError exception should be the class name, not the message of the underlying exception. Bug fix. Don't crash if java.lang.invoke.LambdaMetafactory class is not loadable. Added Unsafe.reallocateMemory() and fixed allocateMemory() to do nothing if zero length is allocated. Bug fix. Return background color (instead of foreground color). Fix by Daniel Zatonyi . Bug fix. Dynamically created ghost arrays should get tagged. Bug fix. When catching a dynamically loaded .NET exception type the exception should not be remapped. Bug fix. Bootstrap classes that use .NET types in their signatures should be accessible via MethodHandles. Bug fix. Allow MethodHandle for cli.System.Object methods to work on (Java compatble) arrays to handle a hole in the type system. Bug fix. Handle unloadable types in interface stub signatures. Bug fix. MethodHandle and JNI should be able to set static final fields. Bug fix. If a miranda method signature differs from its base class miranda method (due to unloadable types), we need to emit an override stub. Bug fix. Allow value type default constructor to be invoked using MethodHandle. Bug fix. Allow invokedynamic with unloadable type in signature. Bug fix. Handle late-bound MethodHandle.invokeExact() with unloadable type in signature. Bug fix. Late bound instanceof and castclass should behave the same as regular versions (with respect to type system holes caused by .NET types). Bug fix. MethodHandle interface method lookup should support methods inherited from base interfaces. Bug fix. Late bound delegate signature conversion should use explicitCastArguments instead of asType to handle varargs correctly. Implemented delegate constructor invocation on existing object (to enable MethodHandle to construct a delegate). Bug fix. Handle unloadable return type in native method signature. Bug fix. Handle unloadable types in native method signature in JniProxyBuilder (used when -Xsave is used). Bug fix. Late bound invokespecial should also be handled in local variable analysis. Bug fix. Handle unloadable type in BSM extra arguments. Bug fix. Verifier would incorrectly report a loader constraints violated if a field type was not unloadable, but the field ref type was unloadable. Bug fix. Make sure declaring class is loadable. Bug fix. Try loading unloadable declared classes instead of simply throwing a NoClassDefFoundError. Bug fix. Make sure inner classes are loadable. Bug fix. Disallow invokevirtual MH constant to resolve to interface method and disallow invokeinterface MH constant to resolve to non-public method. Bug fix. Handle unloadable type in MH.invoke() signature. Bug fix. Handle invocation of method on unloadable value type. Bug fix. Handle ghost and value types in override stub signatures. Added a hack to the deprecated Reflection.getCallerClass(int) version to skip LamdbaForm methods to report the right caller when dynamic binding is used. Bug fix. Dynamica caller id should return host class for anonymous classes injected into host class. Avoid infinite recursion if (broken) class loader triggers a load of a class currently being finished. Added environment switch IKVM_DISABLE_EAGER_CLASS_LOADING to enable testing late binding. IKVM.Reflection: Added CoreCLR target. IKVM.Reflection: Fixed ModuleBuilder.DefineManifestResource() to support very large resources. IKVM.Reflection: Added new public API ModuleBuilder.__PEHeaderTimeDateStamp property. IKVM.Reflection: Added UniverseOptions.DeterministicOutput to enable deterministic output (i.e. setting the PE file header time stamp to zero and computing the module version id based on the contents, instead of using a random guid). Binaries available here: ikvmbin-8.1.5561.zip [Less]