Mercurial > hg > truffle
comparison graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaFieldImpl.java @ 20821:1bfa14fd1275
Cache the reflection Field in HotSpotResolvedFieldImpl, since it is accessed repeatedly when accessing the annotations of the field
author | Christian Wimmer <christian.wimmer@oracle.com> |
---|---|
date | Wed, 08 Apr 2015 21:58:46 -0700 |
parents | 7815c4d4a07f |
children | 673e0b242d4d |
comparison
equal
deleted
inserted
replaced
20820:ca57c045b1e8 | 20821:1bfa14fd1275 |
---|---|
196 return javaField.getAnnotation(annotationClass); | 196 return javaField.getAnnotation(annotationClass); |
197 } | 197 } |
198 return null; | 198 return null; |
199 } | 199 } |
200 | 200 |
201 private Field toJavaCache; | |
202 | |
201 private Field toJava() { | 203 private Field toJava() { |
204 if (toJavaCache != null) { | |
205 return toJavaCache; | |
206 } | |
207 | |
202 if (isInternal()) { | 208 if (isInternal()) { |
203 return null; | 209 return null; |
204 } | 210 } |
205 try { | 211 try { |
206 return holder.mirror().getDeclaredField(name); | 212 return toJavaCache = holder.mirror().getDeclaredField(name); |
207 } catch (NoSuchFieldException | NoClassDefFoundError e) { | 213 } catch (NoSuchFieldException | NoClassDefFoundError e) { |
208 return null; | 214 return null; |
209 } | 215 } |
210 } | 216 } |
211 | 217 |