bottleneck by java.lang.Class.getAnnotations() - proposed patch (original) (raw)

Martin Buchholz martinrb at google.com
Wed Nov 7 17:59:39 UTC 2012


We've also seen deadlocks in accessing annotations in the wild. So, many thanks for working on this (both performance improvements and deadlock removal). We don't have a test case to contribute, but here's a stacktrace:

sun.reflect.annotation.AnnotationType.getInstance(AnnotationType.java:80) sun.reflect.annotation.AnnotationParser.parseAnnotation (AnnotationParser.java:220) sun.reflect.annotation.AnnotationParser.parseAnnotations2 (AnnotationParser.java:87) sun.reflect.annotation.AnnotationParser.parseAnnotations (AnnotationParser.java:70) java.lang.Class.initAnnotationsIfNecessary(Class.java:3093) java.lang.Class.getAnnotation(Class.java:3050) sun.reflect.annotation.AnnotationType.(AnnotationType.java:130) sun.reflect.annotation.AnnotationType.getInstance(Annotation Type.java:83) sun.reflect.annotation.AnnotationParser.parseAnnotation (AnnotationParser.java:220) sun.reflect.annotation.AnnotationParser.parseAnnotations2 (AnnotationParser.java:87) sun.reflect.annotation.AnnotationParser.parseAnnotations (AnnotationParser.java:70) java.lang.Class.initAnnotationsIfNecessary(Class.java:3093) java.lang.Class.getAnnotation(Class.java:3050) sun.reflect.annotation.AnnotationType.(AnnotationType.java:130) sun.reflect.annotation.AnnotationType.getInstance(Annotation Type.java:83) sun.reflect.annotation.AnnotationParser.parseAnnotation (AnnotationParser.java:220) sun.reflect.annotation.AnnotationParser.parseAnnotations2 (AnnotationParser.java:87) sun.reflect.annotation.AnnotationParser.parseAnnotations (AnnotationParser.java:70) java.lang.Class.initAnnotationsIfNecessary(Class.java:3093) java.lang.Class.getAnnotation(Class.java:3050)

Martin

On Wed, Nov 7, 2012 at 9:11 AM, Peter Levart <peter.levart at gmail.com> wrote:

On 11/06/2012 08:37 AM, Peter Levart wrote:

Hi all, I have prepared a better patch. It addresses the goals of JEP-149 more seriously. I also have some benchmarks. Stay tuned... Regards, Peter

For easier viewing, here's also a webrev: http://dl.dropbox.com/u/**101777488/jdk8-hacks/JEP-149/**webrev/index.html<http://dl.dropbox.com/u/101777488/jdk8-hacks/JEP-149/webrev/index.html> Regards, Peter



More information about the core-libs-dev mailing list