changeset 24116:df038ccc5943

missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail - part 6 (JDK-8177673)
author Doug Simon <doug.simon@oracle.com>
date Sat, 01 Apr 2017 15:45:34 +0200
parents 244adb543e36
children 6508ce8d068f
files jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMemoryAccessProviderImpl.java
diffstat 1 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMemoryAccessProviderImpl.java	Sat Apr 01 12:37:10 2017 +0200
+++ b/jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMemoryAccessProviderImpl.java	Sat Apr 01 15:45:34 2017 +0200
@@ -62,10 +62,9 @@
             HotSpotResolvedObjectType type = constant.getType();
             Object object = constant.object();
             if (object instanceof Class && kind != JavaKind.Object) {
-                // Cannot check bounds when reading from a java.lang.Class as
-                // we don't have the bounds for the variable length part of
-                // the object tail containing the static fields of the
-                // represented class.
+                // Cannot check bounds when reading primitives from java.lang.Class as
+                // we don't have the bounds for the part of a java.lang.Class object
+                // containing the static fields of the represented class.
             } else {
                 checkRead(runtime, kind, displacement, type, object);
             }
@@ -126,6 +125,9 @@
                 if (displacement == runtime.getConfig().classMirrorOffset) {
                     // Klass::_java_mirror is valid for all Klass* values
                     return true;
+                } else if (displacement == runtime.getConfig().arrayKlassComponentMirrorOffset) {
+                    // ArrayKlass::_component_mirror is only valid for all ArrayKlass* values
+                    return ((HotSpotResolvedObjectTypeImpl) metaspaceObject).mirror().isArray();
                 }
             } else {
                 throw new IllegalArgumentException(String.valueOf(metaspaceObject));