Mercurial > hg > graal-compiler
changeset 22803:f67bef7309ad
made HotSpotVMConfig.arrayKlassComponentMirrorOffset package-private to account for the removal of ArrayKlass::_component_mirror in jdk9
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Tue, 13 Oct 2015 00:19:28 +0200 |
parents | aa321bfb2a65 |
children | 078298728607 |
files | graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/HotSpotReplacementsUtil.java mx.graal/suite.py |
diffstat | 2 files changed, 26 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/HotSpotReplacementsUtil.java Mon Oct 12 17:24:28 2015 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/HotSpotReplacementsUtil.java Tue Oct 13 00:19:28 2015 +0200 @@ -29,6 +29,9 @@ import static com.oracle.graal.nodes.extended.BranchProbabilityNode.probability; import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntimeProvider.getArrayBaseOffset; import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntimeProvider.getArrayIndexScale; + +import java.lang.reflect.Field; + import jdk.vm.ci.code.CodeUtil; import jdk.vm.ci.code.Register; import jdk.vm.ci.common.JVMCIError; @@ -438,9 +441,30 @@ public static final LocationIdentity ARRAY_KLASS_COMPONENT_MIRROR = NamedLocationIdentity.immutable("ArrayKlass::_component_mirror"); + /** + * Employ reflection to read values not available in JDK9. + */ + static class Lazy { + static final int arrayKlassComponentMirrorOffset; + static { + int value = Integer.MAX_VALUE; + try { + Field f = HotSpotVMConfig.class.getDeclaredField("arrayKlassComponentMirrorOffset"); + f.setAccessible(true); + value = f.getInt(config()); + } catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) { + // ArrayKlass::_component_mirror was removed in JDK9. + } + arrayKlassComponentMirrorOffset = value; + } + } + @Fold public static int arrayKlassComponentMirrorOffset() { - return config().arrayKlassComponentMirrorOffset; + if (Lazy.arrayKlassComponentMirrorOffset == Integer.MAX_VALUE) { + throw new JVMCIError("ArrayKlass::_component_mirror does not exist"); + } + return Lazy.arrayKlassComponentMirrorOffset; } public static final LocationIdentity KLASS_SUPER_KLASS_LOCATION = NamedLocationIdentity.immutable("Klass::_super");
--- a/mx.graal/suite.py Mon Oct 12 17:24:28 2015 +0200 +++ b/mx.graal/suite.py Tue Oct 13 00:19:28 2015 +0200 @@ -6,7 +6,7 @@ "suites": [ { "name" : "jvmci", - "version" : "3596054515916b3aa299386f6e2dcbbbfc5621f1", + "version" : "3088a32d27afbec059ef4276e8b7d1904523861d", "urls" : [ {"url" : "http://lafo.ssw.uni-linz.ac.at/hg/graal-jvmci-8", "kind" : "hg"}, {"url" : "https://curio.ssw.jku.at/nexus/content/repositories/snapshots", "kind" : "binary"},