# Wednesday, 04 June 2014
« New Development Snapshot | Main | New Development Snapshot »
New Development Snapshot

More progress on the OpenJDK 8 integration and a couple of unrelated fixes.

I fixed an incompatibility with Mono (and other ECMA compliant tools that parse custom attributes). When I changed package manifest handling in 7.4 to handle reading the manifest from the right jar I unknowingly chose a custom attribute encoding that works on the CLR, but isn't actually ECMA compliant. Mono has since added support for this encoding.

Another somewhat interesting change is that I added an (internal only) feature to make it easier to replace sun.misc.Unsafe.compareAndSet() with Interlocked.CompareExchange. The trigger was the new reflection data caching in java.lang.Class. Here's an example of what it looks like:

@ikvm.internal.InterlockedCompareAndSet("reflectionData")
static native boolean casReflectionData(Class<?> clazz,
                                        SoftReference<ReflectionData<T>> oldData,
                                        SoftReference<ReflectionData<T>> newData);

The ikvmc compiler will generate a method body that uses Interlocked.CompareExchange<T>() to update the reflectionData field in Class. In other places where I previously used Interlocked methods (e.g. java.util.concurrent.AtomicReferenceArray) I implemented the method body in map.xml using MSIL instructions, but here the generic version of CompareExchange is needed and I didn't want to invent a syntax for instantiating a generic method in map.xml.

Oracle is working on adding atomic operations to Java and I suggested this annotation based approach, but it was rejected because "we don't add language semantics through annotations".

Changes:

  • Implemented method parameter reflection.
  • Compile class library with javac -parameters option to get parameter names for abstract and native methods.
  • Added (undocumented) -noparameterreflection option ikvmc to disable emitting method parameter reflection metadata
  • Enabled MethodParameter attribute in runtime stub generator.
  • Support round tripping malformed MethodParameter attribute in stub generator.
  • Fixed PackageListAttribute to be ECMA compliant.
  • Added support for defining abstract methods in remap file.
  • Implemented sun.nio.ch.Net.poll() native method.
  • Replaced sun.misc.Unsafe cas operations in java.lang.Class with Interlocked.CompareExchange().
  • Replaced AtomicReference[Array].getAndSet() implementations with Interlocked.Exchange() based implementations.
  • Fixed Linux build. Thanks to Joan Karadimov for reporting this.
  • Prevent unfocable windows from being activated by mouse click. (Based on patch by Maria Papendieck of pure-systems.)
  • Fixed clipboard access to use the right thread. (Based on patch by Maria Papendieck of pure-systems.)
  • IKVM.Reflection: Added UniverseOptions.DecodeVersionInfoAttributeBlobs to support decoding CustomAttributeBuilder with blob to extract version info fields.

Binaries available here: ikvmbin-8.0.5268.zip
Sources: ikvmsrc-8.0.5268.zip and openjdk-8-b132-stripped.zip

Wednesday, 04 June 2014 09:30:36 (W. Europe Daylight Time, UTC+02:00)  #    Comments [4]
Thursday, 26 June 2014 02:10:07 (W. Europe Daylight Time, UTC+02:00)
"we don't add language semantics through annotations"
Isn't that exactly what they did with @FunctionalInterface in Java 8?
Thursday, 26 June 2014 08:39:51 (W. Europe Daylight Time, UTC+02:00)
It only documents intent, not actual semantics:
"An informative annotation type used to indicate that an interface type declaration is intended to be a functional interface"
Thursday, 26 June 2014 23:22:19 (W. Europe Daylight Time, UTC+02:00)
It includes the requirement of having exactly 1 abstract method, isn't that a semantic change introduced by an annotation?

Not to nitpick, I am curious.
Friday, 27 June 2014 08:14:38 (W. Europe Daylight Time, UTC+02:00)
I can only guess, but I think they feel that wether something compiles or not does not affect the semantics, since if doesn't compile it isn't valid Java to begin with. That feels a bit circular to me, but hey.

Note also that @Override behaves similarly.
Name
E-mail
Home page

I apologize for the lameness of this, but the comment spam was driving me nuts. In order to be able to post a comment, you need to answer a simple question. Hopefully this question is easy enough not to annoy serious commenters, but hard enough to keep the spammers away.

Anti-Spam Question: What method on java.lang.System returns an object's original hashcode (i.e. the one that would be returned by java.lang.Object.hashCode() if it wasn't overridden)? (case is significant)

Answer:  
Comment (HTML not allowed)  

Live Comment Preview