RFR: 8004823: Add VM support for type annotation reflection (original) (raw)

Joel Borggrén-Franck joel.franck at oracle.com
Mon Dec 17 08:47:53 PST 2012


Hi,

Here is a webrev for adding VM support for type annotation reflection: http://cr.openjdk.java.net/~jfranck/8004823/webrev.v4/

Type annotations are coming with JDK 8, the proposed language changes can be found from here: http://openjdk.java.net/projects/type-annotations/

Since runtime visible type annotations probably won't be that common I have tried to minimise overhead when there are no type annotations. This is done by adding a pointer to a type annotation Annotations instance from the regular annotations Annotations instance, see annotations.hpp. This means that if there are no runtime visible annotations there is no additional overhead with this patch since no Annotations instance will be allocated at all. If there is runtime visible annotations but no runtime visible type annotations there is an additional overhead of 1 pointer with this patch. If you use type annotations there will also be storage overhead, but that is to be expected.

This patch also fixes that Annotations were never deallocated when InstanceKlass::deallocate_contents() were called.

There is currently no redefineClass support for type annotations. This will be added later. In order avoid ship possibly broken bytes to java-land, type annotations are nulled out and deallocated after a redefineClass.

This patch also exports a new method from jvm.h, JVM_GetClassTypeAnnotations, so map files are updated. Build-dev are included for review.

Testing done:

FYI, The initial set of jdk changes are being reviewed on core-libs-dev: http://mail.openjdk.java.net/pipermail/core-libs-dev/2012-December/013016.html

cheers /Joel



More information about the hotspot-dev mailing list