Mercurial > hg > graal-jvmci-8
changeset 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 | ca57c045b1e8 |
children | 8ad82587f08d |
files | graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaFieldImpl.java |
diffstat | 1 files changed, 7 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaFieldImpl.java Thu Apr 09 02:15:16 2015 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaFieldImpl.java Wed Apr 08 21:58:46 2015 -0700 @@ -198,12 +198,18 @@ return null; } + private Field toJavaCache; + private Field toJava() { + if (toJavaCache != null) { + return toJavaCache; + } + if (isInternal()) { return null; } try { - return holder.mirror().getDeclaredField(name); + return toJavaCache = holder.mirror().getDeclaredField(name); } catch (NoSuchFieldException | NoClassDefFoundError e) { return null; }