changeset 10526:cfb6c135aef4

8152344: JVMCI test task: Unit tests for ConstantReflectionProvider Reviewed-by: twisti, dpochepk, tpivovarova
author kshefov
date Fri, 25 Mar 2016 14:46:09 +0300
parents 055ca7aac8be
children 693064a31888
files .mx.jvmci/suite.py test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/AsJavaTypeDataProvider.java test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/BoxPrimitiveDataProvider.java test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/ConstantEqualsDataProvider.java test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/DummyClass.java test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/ForObjectDataProvider.java test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/ForStringDataProvider.java test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/HotSpotConstantReflectionProviderTest.java test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/IsEmbeddableDataProvider.java test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/ReadArrayElementDataProvider.java test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/ReadArrayLengthDataProvider.java test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/ReadConstantArrayElementDataProvider.java test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/ReadConstantFieldValueDataProvider.java test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/ReadFieldValueDataProvider.java test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/ReadStableFieldValueDataProvider.java test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/TestHelper.java test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/UnboxPrimitiveDataProvider.java
diffstat 17 files changed, 2235 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/.mx.jvmci/suite.py	Thu Mar 24 11:48:37 2016 -0700
+++ b/.mx.jvmci/suite.py	Fri Mar 25 14:46:09 2016 +0300
@@ -32,24 +32,9 @@
 
   "libraries" : {
 
-    "HCFDIS" : {
-      "urls" : ["https://lafo.ssw.uni-linz.ac.at/pub/hcfdis-3.jar"],
-      "sha1" : "a71247c6ddb90aad4abf7c77e501acc60674ef57",
-    },
-
-    "C1VISUALIZER_DIST" : {
-      "urls" : ["https://java.net/downloads/c1visualizer/c1visualizer_2015-07-22.zip"],
-      "sha1" : "7ead6b2f7ed4643ef4d3343a5562e3d3f39564ac",
-    },
-
-    "JOL_INTERNALS" : {
-      "urls" : ["https://lafo.ssw.uni-linz.ac.at/pub/truffle/jol/jol-internals.jar"],
-      "sha1" : "508bcd26a4d7c4c44048990c6ea789a3b11a62dc",
-    },
-
-    "BATIK" : {
-      "sha1" : "122b87ca88e41a415cf8b523fd3d03b4325134a3",
-      "urls" : ["https://lafo.ssw.uni-linz.ac.at/pub/graal-external-deps/batik-all-1.7.jar"],
+    "TESTNG" : {
+      "urls" : ["http://central.maven.org/maven2/org/testng/testng/6.9.10/testng-6.9.10.jar"],
+      "sha1" : "6feb3e964aeb7097aff30c372aac3ec0f8d87ede",
     },
 
     # Stubs for classes introduced in JDK9 that allow compilation with a JDK8 javac and Eclipse.
@@ -175,6 +160,18 @@
       "workingSets" : "JVMCI",
     },
 
+    "jdk.vm.ci.hotspot.test" : {
+      "subDir" : "test/compiler/jvmci",
+      "sourceDirs" : ["src"],
+      "dependencies" : [
+        "mx:TESTNG",
+        "jdk.vm.ci.hotspot",
+      ],
+      "checkstyle" : "jdk.vm.ci.services",
+      "javaCompliance" : "1.8",
+      "workingSets" : "API,JVMCI",
+    },
+
     "jdk.vm.ci.hotspotvmconfig" : {
       "subDir" : "src/jdk.vm.ci/share/classes",
       "sourceDirs" : ["src"],
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/AsJavaTypeDataProvider.java	Fri Mar 25 14:46:09 2016 +0300
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.vm.ci.hotspot.test;
+
+import static jdk.vm.ci.hotspot.test.TestHelper.CONSTANT_REFLECTION_PROVIDER;
+import static jdk.vm.ci.hotspot.test.TestHelper.DUMMY_CLASS_INSTANCE;
+
+import jdk.vm.ci.meta.JavaConstant;
+import org.testng.annotations.DataProvider;
+
+public class AsJavaTypeDataProvider {
+
+    @DataProvider(name = "asJavaTypeDataProvider")
+    public static Object[][] asJavaTypeDataProvider() {
+        return new Object[][]{
+                {CONSTANT_REFLECTION_PROVIDER.forObject(DummyClass.class),
+                        "jdk.vm.ci.hotspot.test.DummyClass"},
+                {CONSTANT_REFLECTION_PROVIDER.forObject(boolean.class), "boolean"},
+                {CONSTANT_REFLECTION_PROVIDER.forObject(byte.class), "byte"},
+                {CONSTANT_REFLECTION_PROVIDER.forObject(short.class), "short"},
+                {CONSTANT_REFLECTION_PROVIDER.forObject(char.class), "char"},
+                {CONSTANT_REFLECTION_PROVIDER.forObject(int.class), "int"},
+                {CONSTANT_REFLECTION_PROVIDER.forObject(long.class), "long"},
+                {CONSTANT_REFLECTION_PROVIDER.forObject(float.class), "float"},
+                {CONSTANT_REFLECTION_PROVIDER.forObject(double.class), "double"},
+                {CONSTANT_REFLECTION_PROVIDER.forObject(Object.class), "java.lang.Object"},
+                {CONSTANT_REFLECTION_PROVIDER.forObject(boolean[].class), "boolean[]"},
+                {CONSTANT_REFLECTION_PROVIDER.forObject(boolean[][].class), "boolean[][]"},
+                {CONSTANT_REFLECTION_PROVIDER.forObject(Object[].class), "java.lang.Object[]"},
+                {CONSTANT_REFLECTION_PROVIDER.forObject(Object[][].class), "java.lang.Object[][]"},
+                {JavaConstant.forBoolean(DUMMY_CLASS_INSTANCE.booleanField), null},
+                {CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.objectField), null},
+                {CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE), null},
+                {CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.booleanArrayWithValues), null},
+                {CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.booleanArrayArrayWithValues), null},
+                {JavaConstant.NULL_POINTER, null}, {null, null}};
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/BoxPrimitiveDataProvider.java	Fri Mar 25 14:46:09 2016 +0300
@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.vm.ci.hotspot.test;
+
+import static jdk.vm.ci.hotspot.test.TestHelper.CONSTANT_REFLECTION_PROVIDER;
+import static jdk.vm.ci.hotspot.test.TestHelper.DUMMY_CLASS_INSTANCE;
+
+import java.util.LinkedList;
+import jdk.vm.ci.meta.JavaConstant;
+import org.testng.annotations.DataProvider;
+
+public class BoxPrimitiveDataProvider {
+
+    @DataProvider(name = "boxPrimitiveDataProvider")
+    public static Object[][] boxPrimitiveDataProvider() {
+        LinkedList<Object[]> cfgSet = new LinkedList<>();
+        // Boolean testing
+        cfgSet.add(
+                new Object[]{JavaConstant.forBoolean(true), CONSTANT_REFLECTION_PROVIDER.forObject((Boolean) true)});
+        cfgSet.add(new Object[]{JavaConstant.forBoolean(false),
+                CONSTANT_REFLECTION_PROVIDER.forObject((Boolean) false)});
+        // Boxed boolean testing (returns null)
+        cfgSet.add(new Object[]{CONSTANT_REFLECTION_PROVIDER.forObject((Boolean) true), null});
+        cfgSet.add(new Object[]{CONSTANT_REFLECTION_PROVIDER.forObject((Boolean) false), null});
+        for (byte number : new byte[]{-128, 0, 1, 127}) {
+            // Integer primitives testing
+            cfgSet.add(new Object[]{JavaConstant.forByte(number),
+                    CONSTANT_REFLECTION_PROVIDER.forObject(Byte.valueOf(number))});
+            cfgSet.add(new Object[]{JavaConstant.forShort(number),
+                    CONSTANT_REFLECTION_PROVIDER.forObject(Short.valueOf(number))});
+            cfgSet.add(new Object[]{JavaConstant.forInt(number),
+                    CONSTANT_REFLECTION_PROVIDER.forObject(Integer.valueOf(number))});
+            cfgSet.add(new Object[]{JavaConstant.forLong(number),
+                    CONSTANT_REFLECTION_PROVIDER.forObject(Long.valueOf(number))});
+            if (number >= 0) {
+                cfgSet.add(new Object[]{JavaConstant.forChar((char) number),
+                        CONSTANT_REFLECTION_PROVIDER.forObject(Character.valueOf((char) number))});
+            }
+            // Float and Double variables are not cached,
+            // so the tested method returns "null" on them
+            cfgSet.add(new Object[]{JavaConstant.forFloat((float) number), null});
+            cfgSet.add(new Object[]{JavaConstant.forDouble((double) number), null});
+            // Boxed primitives testing (return null)
+            cfgSet.add(new Object[]{CONSTANT_REFLECTION_PROVIDER.forObject(Byte.valueOf(number)), null});
+            cfgSet.add(new Object[]{CONSTANT_REFLECTION_PROVIDER.forObject(Short.valueOf(number)), null});
+            cfgSet.add(new Object[]{CONSTANT_REFLECTION_PROVIDER.forObject(Integer.valueOf(number)), null});
+            cfgSet.add(new Object[]{CONSTANT_REFLECTION_PROVIDER.forObject(Long.valueOf(number)), null});
+            cfgSet.add(new Object[]{CONSTANT_REFLECTION_PROVIDER.forObject(Character.valueOf((char) number)), null});
+            cfgSet.add(new Object[]{CONSTANT_REFLECTION_PROVIDER.forObject(Float.valueOf(number)), null});
+            cfgSet.add(new Object[]{CONSTANT_REFLECTION_PROVIDER.forObject(Double.valueOf(number)), null});
+        }
+        // Integer primitives testing with big non-cached values (returns null)
+        cfgSet.add(new Object[]{JavaConstant.forShort(Short.MAX_VALUE), null});
+        cfgSet.add(new Object[]{JavaConstant.forInt(Integer.MAX_VALUE), null});
+        cfgSet.add(new Object[]{JavaConstant.forLong(Long.MAX_VALUE), null});
+        cfgSet.add(new Object[]{JavaConstant.forChar(Character.MAX_VALUE), null});
+        // Non-primitives testing
+        cfgSet.add(new Object[]{CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.objectField), null});
+        cfgSet.add(new Object[]{CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.booleanArrayWithValues),
+                null});
+        // Null testing
+        cfgSet.add(new Object[]{JavaConstant.NULL_POINTER, null});
+        cfgSet.add(new Object[]{null, null});
+        return cfgSet.toArray(new Object[0][0]);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/ConstantEqualsDataProvider.java	Fri Mar 25 14:46:09 2016 +0300
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.vm.ci.hotspot.test;
+
+import static jdk.vm.ci.hotspot.test.TestHelper.CONSTANT_REFLECTION_PROVIDER;
+import static jdk.vm.ci.hotspot.test.TestHelper.DUMMY_CLASS_INSTANCE;
+
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.Objects;
+import jdk.vm.ci.meta.Constant;
+import jdk.vm.ci.meta.JavaConstant;
+import org.testng.annotations.DataProvider;
+
+public class ConstantEqualsDataProvider {
+    @DataProvider(name = "constantEqualsDataProvider")
+    public static Object[][] constantEqualsDataProvider() {
+        HashMap<Object, Constant> constMap = new HashMap<>();
+        constMap.put(DUMMY_CLASS_INSTANCE.booleanField, JavaConstant.forBoolean(DUMMY_CLASS_INSTANCE.booleanField));
+        constMap.put(DUMMY_CLASS_INSTANCE.stableDefaultBooleanField,
+                JavaConstant.forBoolean(DUMMY_CLASS_INSTANCE.stableDefaultBooleanField));
+        constMap.put(DUMMY_CLASS_INSTANCE.byteField, JavaConstant.forByte(DUMMY_CLASS_INSTANCE.byteField));
+        constMap.put(DUMMY_CLASS_INSTANCE.finalByteField, JavaConstant.forByte(DUMMY_CLASS_INSTANCE.finalByteField));
+        constMap.put(DUMMY_CLASS_INSTANCE.stableDefaultByteField,
+                JavaConstant.forByte(DUMMY_CLASS_INSTANCE.stableDefaultByteField));
+        constMap.put(DUMMY_CLASS_INSTANCE.shortField, JavaConstant.forShort(DUMMY_CLASS_INSTANCE.shortField));
+        constMap.put(DUMMY_CLASS_INSTANCE.finalShortField, JavaConstant.forShort(DUMMY_CLASS_INSTANCE.finalShortField));
+        constMap.put(DUMMY_CLASS_INSTANCE.stableDefaultShortField,
+                JavaConstant.forShort(DUMMY_CLASS_INSTANCE.stableDefaultShortField));
+        constMap.put(DUMMY_CLASS_INSTANCE.intField, JavaConstant.forInt(DUMMY_CLASS_INSTANCE.intField));
+        constMap.put(DUMMY_CLASS_INSTANCE.finalIntField, JavaConstant.forInt(DUMMY_CLASS_INSTANCE.finalIntField));
+        constMap.put(DUMMY_CLASS_INSTANCE.stableDefaultIntField,
+                JavaConstant.forInt(DUMMY_CLASS_INSTANCE.stableDefaultIntField));
+        constMap.put(DUMMY_CLASS_INSTANCE.longField, JavaConstant.forLong(DUMMY_CLASS_INSTANCE.longField));
+        constMap.put(DUMMY_CLASS_INSTANCE.finalLongField, JavaConstant.forLong(DUMMY_CLASS_INSTANCE.finalLongField));
+        constMap.put(DUMMY_CLASS_INSTANCE.stableDefaultLongField,
+                JavaConstant.forLong(DUMMY_CLASS_INSTANCE.stableDefaultLongField));
+        constMap.put(DUMMY_CLASS_INSTANCE.doubleField, JavaConstant.forDouble(DUMMY_CLASS_INSTANCE.doubleField));
+        constMap.put(DUMMY_CLASS_INSTANCE.finalDoubleField,
+                JavaConstant.forDouble(DUMMY_CLASS_INSTANCE.finalDoubleField));
+        constMap.put(DUMMY_CLASS_INSTANCE.stableDefaultDoubleField,
+                JavaConstant.forDouble(DUMMY_CLASS_INSTANCE.stableDefaultDoubleField));
+        constMap.put(DUMMY_CLASS_INSTANCE.floatField, JavaConstant.forFloat(DUMMY_CLASS_INSTANCE.floatField));
+        constMap.put(DUMMY_CLASS_INSTANCE.finalFloatField, JavaConstant.forFloat(DUMMY_CLASS_INSTANCE.finalFloatField));
+        constMap.put(DUMMY_CLASS_INSTANCE.stableDefaultFloatField,
+                JavaConstant.forFloat(DUMMY_CLASS_INSTANCE.stableDefaultFloatField));
+        constMap.put(DUMMY_CLASS_INSTANCE.charField, JavaConstant.forChar(DUMMY_CLASS_INSTANCE.charField));
+        constMap.put(DUMMY_CLASS_INSTANCE.finalCharField, JavaConstant.forChar(DUMMY_CLASS_INSTANCE.finalCharField));
+        constMap.put(DUMMY_CLASS_INSTANCE.stableDefaultCharField,
+                JavaConstant.forChar(DUMMY_CLASS_INSTANCE.stableDefaultCharField));
+        constMap.put(DUMMY_CLASS_INSTANCE.stringField,
+                CONSTANT_REFLECTION_PROVIDER.forString(DUMMY_CLASS_INSTANCE.stringField));
+        constMap.put(DUMMY_CLASS_INSTANCE.stringField2,
+                CONSTANT_REFLECTION_PROVIDER.forString(DUMMY_CLASS_INSTANCE.stringField2));
+        constMap.put(DUMMY_CLASS_INSTANCE.objectField,
+                CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.objectField));
+        constMap.put(DUMMY_CLASS_INSTANCE.finalObjectField,
+                CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.finalObjectField));
+        constMap.put(DUMMY_CLASS_INSTANCE.stableDefaultObjectField,
+                CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.stableDefaultObjectField));
+        constMap.put(null, null);
+        constMap.put(JavaConstant.NULL_POINTER, JavaConstant.NULL_POINTER);
+        LinkedList<Object[]> cfgSet = new LinkedList<>();
+        constMap.entrySet().stream().forEach((obj1) -> {
+            constMap.entrySet().stream().forEach((obj2) -> {
+                cfgSet.add(new Object[]{obj1.getValue(), obj2.getValue(),
+                        Objects.equals(obj1.getKey(), obj2.getKey())});
+            });
+        });
+        return cfgSet.toArray(new Object[0][0]);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/DummyClass.java	Fri Mar 25 14:46:09 2016 +0300
@@ -0,0 +1,164 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.vm.ci.hotspot.test;
+
+import jdk.internal.vm.annotation.Stable;
+
+public class DummyClass {
+
+    public boolean booleanField = true;
+    public byte byteField = 2;
+    public short shortField = 3;
+    public char charField = 'a';
+    public int intField = 4;
+    public long longField = 5L;
+    public float floatField = 4.5f;
+    public double doubleField = 53.2;
+    public Object objectField = new Object();
+
+    public final boolean finalBooleanField = true;
+    public final byte finalByteField = -2;
+    public final short finalShortField = -3;
+    public final char finalCharField = 'b';
+    public final int finalIntField = 8;
+    public final long finalLongField = 888L;
+    public final float finalFloatField = 77.8f;
+    public final double finalDoubleField = -234.2;
+    public final Object finalObjectField = new Object();
+
+    @Stable public boolean stableBooleanField = true;
+    @Stable public byte stableByteField = -2;
+    @Stable public short stableShortField = -3;
+    @Stable public char stableCharField = 'c';
+    @Stable public int stableIntField = 8;
+    @Stable public long stableLongField = 888L;
+    @Stable public float stableFloatField = 77.8f;
+    @Stable public double stableDoubleField = -234.2;
+    @Stable public Object stableObjectField = new Object();
+
+    @Stable public boolean stableDefaultBooleanField;
+    @Stable public byte stableDefaultByteField;
+    @Stable public short stableDefaultShortField;
+    @Stable public char stableDefaultCharField;
+    @Stable public int stableDefaultIntField;
+    @Stable public long stableDefaultLongField;
+    @Stable public float stableDefaultFloatField;
+    @Stable public double stableDefaultDoubleField;
+    @Stable public Object stableDefaultObjectField;
+
+    public final boolean finalDefaultBooleanField = false;
+    public final byte finalDefaultByteField = 0;
+    public final short finalDefaultShortField = 0;
+    public final char finalDefaultCharField = 0;
+    public final int finalDefaultIntField = 0;
+    public final long finalDefaultLongField = 0L;
+    public final float finalDefaultFloatField = 0.0f;
+    public final double finalDefaultDoubleField = 0.0;
+    public final Object finalDefaultObjectField = null;
+
+    public static boolean staticBooleanField = true;
+    public static byte staticByteField = -1;
+    public static short staticShortField = 11;
+    public static char staticCharField = 'e';
+    public static int staticIntField = 344;
+    public static long staticLongField = 34231212L;
+    public static float staticFloatField = -4.5f;
+    public static double staticDoubleField = 453.2;
+    public static Object staticObjectField = new Object();
+
+    public static final boolean staticFinalBooleanField = true;
+    public static final byte staticFinalByteField = -51;
+    public static final short staticFinalShortField = 911;
+    public static final char staticFinalCharField = 'g';
+    public static final int staticFinalIntField = 9344;
+    public static final long staticFinalLongField = 54231212L;
+    public static final float staticFinalFloatField = -42.5f;
+    public static final double staticFinalDoubleField = 5453.2;
+    public static final Object staticFinalObjectField = new Object();
+
+    @Stable public static boolean staticStableBooleanField = true;
+    @Stable public static byte staticStableByteField = -61;
+    @Stable public static short staticStableShortField = 661;
+    @Stable public static char staticStableCharField = 'y';
+    @Stable public static int staticStableIntField = 6574;
+    @Stable public static long staticStableLongField = -2342L;
+    @Stable public static float staticStableFloatField = -466.5f;
+    @Stable public static double staticStableDoubleField = 4563.2;
+    @Stable public static Object staticStableObjectField = new Object();
+
+    @Stable public static boolean staticStableDefaultBooleanField;
+    @Stable public static byte staticStableDefaultByteField;
+    @Stable public static short staticStableDefaultShortField;
+    @Stable public static char staticStableDefaultCharField;
+    @Stable public static int staticStableDefaultIntField;
+    @Stable public static long staticStableDefaultLongField;
+    @Stable public static float staticStableDefaultFloatField;
+    @Stable public static double staticStableDefaultDoubleField;
+    @Stable public static Object staticStableDefaultObjectField;
+
+    public boolean[] booleanArrayWithValues = new boolean[]{true, false};
+    public byte[] byteArrayWithValues = new byte[]{43, 0};
+    public short[] shortArrayWithValues = new short[]{9, 0};
+    public char[] charArrayWithValues = new char[]{'a', 0};
+    public int[] intArrayWithValues = new int[]{99, 0};
+    public long[] longArrayWithValues = new long[]{868L, 0L};
+    public float[] floatArrayWithValues = new float[]{75.8f, 0f};
+    public double[] doubleArrayWithValues = new double[]{-294.66, 0.0};
+    public Object[] objectArrayWithValues = new Object[]{new Object(), null};
+
+    @Stable public boolean[] stableBooleanArrayWithValues = new boolean[]{true, false};
+    @Stable public byte[] stableByteArrayWithValues = new byte[]{-2, 0};
+    @Stable public short[] stableShortArrayWithValues = new short[]{-3, 0};
+    @Stable public char[] stableCharArrayWithValues = new char[]{'c', 0};
+    @Stable public int[] stableIntArrayWithValues = new int[]{8, 0};
+    @Stable public long[] stableLongArrayWithValues = new long[]{888L, 0L};
+    @Stable public float[] stableFloatArrayWithValues = new float[]{77.8f, 0f};
+    @Stable public double[] stableDoubleArrayWithValues = new double[]{-234.2, 0.0};
+    @Stable public Object[] stableObjectArrayWithValues = new Object[]{new Object(), null};
+
+    public boolean[][] booleanArrayArrayWithValues = new boolean[][]{{true}, null};
+    public byte[][] byteArrayArrayWithValues = new byte[][]{{43, 0}, null};
+    public short[][] shortArrayArrayWithValues = new short[][]{{9, 0}, null};
+    public char[][] charArrayArrayWithValues = new char[][]{{'a', 0}, null};
+    public int[][] intArrayArrayWithValues = new int[][]{{99, 0}, null};
+    public long[][] longArrayArrayWithValues = new long[][]{{868L, 0L}, null};
+    public float[][] floatArrayArrayWithValues = new float[][]{{75.8f, 0f}, null};
+    public double[][] doubleArrayArrayWithValues = new double[][]{{-294.66, 0.0}, null};
+    public Object[][] objectArrayArrayWithValues = new Object[][]{{new Object(), null}, null};
+
+    @Stable public boolean[][] stableBooleanArrayArrayWithValues = new boolean[][]{{true, false}, null};
+    @Stable public byte[][] stableByteArrayArrayWithValues = new byte[][]{{-2, 0}, null};
+    @Stable public short[][] stableShortArrayArrayWithValues = new short[][]{{-3, 0}, null};
+    @Stable public char[][] stableCharArrayArrayWithValues = new char[][]{{'c', 0}, null};
+    @Stable public int[][] stableIntArrayArrayWithValues = new int[][]{{8, 0}, null};
+    @Stable public long[][] stableLongArrayArrayWithValues = new long[][]{{888L, 0L}, null};
+    @Stable public float[][] stableFloatArrayArrayWithValues = new float[][]{{77.8f, 0f}, null};
+    @Stable public double[][] stableDoubleArrayArrayWithValues = new double[][]{{-234.2, 0.0}, null};
+    @Stable public Object[][] stableObjectArrayArrayWithValues = new Object[][]{{new Object(), null}, null};
+
+    // Strings for testing "forString" method
+    public final String stringField = "abc";
+    public final String stringField2 = "xyz";
+    public final String stringEmptyField = "";
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/ForObjectDataProvider.java	Fri Mar 25 14:46:09 2016 +0300
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.vm.ci.hotspot.test;
+
+import org.testng.annotations.DataProvider;
+
+public class ForObjectDataProvider {
+    @DataProvider(name = "forObjectDataProvider")
+    public static Object[][] forObjectDataProvider() {
+        return new Object[][]{
+                {TestHelper.DUMMY_CLASS_INSTANCE.objectField,
+                        "Object[Object@" + TestHelper.DUMMY_CLASS_INSTANCE.objectField.hashCode() + "]"},
+                {TestHelper.DUMMY_CLASS_INSTANCE.stringField,
+                        "Object[String:\"" + TestHelper.DUMMY_CLASS_INSTANCE.stringField + "\"]"},
+                {TestHelper.DUMMY_CLASS_INSTANCE.booleanField,
+                        "Object[" + TestHelper.DUMMY_CLASS_INSTANCE.booleanField + "]"},
+                {TestHelper.DUMMY_CLASS_INSTANCE.byteField,
+                        "Object[" + TestHelper.DUMMY_CLASS_INSTANCE.byteField + "]"},
+                {TestHelper.DUMMY_CLASS_INSTANCE.charField,
+                        "Object[" + TestHelper.DUMMY_CLASS_INSTANCE.charField + "]"},
+                {TestHelper.DUMMY_CLASS_INSTANCE.shortField,
+                        "Object[" + TestHelper.DUMMY_CLASS_INSTANCE.shortField + "]"},
+                {TestHelper.DUMMY_CLASS_INSTANCE.intField,
+                        "Object[" + TestHelper.DUMMY_CLASS_INSTANCE.intField + "]"},
+                {TestHelper.DUMMY_CLASS_INSTANCE.longField,
+                        "Object[" + TestHelper.DUMMY_CLASS_INSTANCE.longField + "]"},
+                {TestHelper.DUMMY_CLASS_INSTANCE.floatField,
+                        "Object[" + TestHelper.DUMMY_CLASS_INSTANCE.floatField + "]"},
+                {TestHelper.DUMMY_CLASS_INSTANCE.doubleField,
+                        "Object[" + TestHelper.DUMMY_CLASS_INSTANCE.doubleField + "]"},
+                {new Object[0], "Object[Object[" + 0 + "]{}]"}, {new Object[1], "Object[Object[" + 1 + "]{null}]"},
+                {null, "Object[null]"}};
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/ForStringDataProvider.java	Fri Mar 25 14:46:09 2016 +0300
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.vm.ci.hotspot.test;
+
+import static jdk.vm.ci.hotspot.test.TestHelper.DUMMY_CLASS_INSTANCE;
+
+import org.testng.annotations.DataProvider;
+
+public class ForStringDataProvider {
+    @DataProvider(name = "forStringDataProvider")
+    public static Object[][] forStringDataProvider() {
+        return new Object[][]{
+                {DUMMY_CLASS_INSTANCE.stringField, "Object[String:\"" + DUMMY_CLASS_INSTANCE.stringField + "\"]"},
+                {DUMMY_CLASS_INSTANCE.stringEmptyField, "Object[String:\"\"]"},
+                {null, "Object[null]"}};
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/HotSpotConstantReflectionProviderTest.java	Fri Mar 25 14:46:09 2016 +0300
@@ -0,0 +1,226 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test jdk.vm.ci.hotspot.test.HotSpotConstantReflectionProviderTest
+ * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64")
+ * @modules jdk.vm.ci/jdk.vm.ci.runtime
+ *          jdk.vm.ci/jdk.vm.ci.meta
+ *          jdk.vm.ci/jdk.vm.ci.hotspot
+ *          java.base/jdk.internal.vm.annotation
+ *          java.base/jdk.internal.misc
+ * @library /testlibrary /test/lib /compiler/jvmci/jdk.vm.ci.hotspot.test/src
+ * @build jdk.vm.ci.hotspot.test.DummyClass
+ * @run driver ClassFileInstaller jdk.vm.ci.hotspot.test.DummyClass
+ * @run testng/othervm/timeout=300 -Xbootclasspath/a:.
+ *      -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
+ *       jdk.vm.ci.hotspot.test.HotSpotConstantReflectionProviderTest
+ */
+
+package jdk.vm.ci.hotspot.test;
+
+import static jdk.vm.ci.hotspot.test.TestHelper.CONSTANT_REFLECTION_PROVIDER;
+
+import java.lang.reflect.Method;
+import jdk.vm.ci.hotspot.HotSpotResolvedJavaField;
+import jdk.vm.ci.meta.JavaConstant;
+import jdk.vm.ci.meta.Constant;
+import jdk.vm.ci.meta.MemoryAccessProvider;
+import jdk.vm.ci.meta.MethodHandleAccessProvider;
+import jdk.vm.ci.meta.ResolvedJavaField;
+import jdk.vm.ci.meta.ResolvedJavaType;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+public class HotSpotConstantReflectionProviderTest {
+
+    @Test(dataProvider = "forObjectDataProvider", dataProviderClass = ForObjectDataProvider.class)
+    public void testForObject(Object obj, String expected) {
+        JavaConstant jConst = TestHelper.CONSTANT_REFLECTION_PROVIDER.forObject(obj);
+        Assert.assertNotNull(jConst,
+                             "An instance of JavaConstant returned by" + " \"forObject\" method should not be null");
+        Assert.assertEquals(jConst.toString(), expected, "Unexpected result:");
+    }
+
+    @Test(dataProvider = "forStringDataProvider", dataProviderClass = ForStringDataProvider.class)
+    public void testForString(String string, String expected) {
+        JavaConstant jConst = CONSTANT_REFLECTION_PROVIDER.forString(string);
+        Assert.assertNotNull(jConst,
+                             "An instance of JavaConstant returned by" + " \"forString\" method should not be null");
+        Assert.assertEquals(jConst.toString(), expected, "Unexpected result:");
+    }
+
+    @Test(dataProvider = "constantEqualsDataProvider", dataProviderClass = ConstantEqualsDataProvider.class)
+    public void testConstantEquals(Constant const1, Constant const2, Boolean expected) {
+        Assert.assertEquals(CONSTANT_REFLECTION_PROVIDER.constantEquals(const1, const2), expected,
+                            "Unexpected result:");
+    }
+
+    @Test(dataProvider = "readArrayLengthDataProvider", dataProviderClass = ReadArrayLengthDataProvider.class)
+    public void testReadArrayLength(JavaConstant array, Integer expected) {
+        Assert.assertEquals(CONSTANT_REFLECTION_PROVIDER.readArrayLength(array), expected,
+                            "Unexpected result:");
+    }
+
+    @Test(dataProvider = "readArrayElementDataProvider", dataProviderClass = ReadArrayElementDataProvider.class)
+    public void testReadArrayElement(JavaConstant array, int index, Object expected) {
+        Assert.assertEquals(CONSTANT_REFLECTION_PROVIDER.readArrayElement(array, index), expected,
+                            "Unexpected result:");
+    }
+
+    @Test(dataProvider = "readFieldValueDataProvider", dataProviderClass = ReadFieldValueDataProvider.class)
+    public void testReadFieldValue(ResolvedJavaField field, JavaConstant receiver, JavaConstant expected) {
+        JavaConstant actual = CONSTANT_REFLECTION_PROVIDER.readFieldValue(field, receiver);
+        Assert.assertEquals(actual == null ? "null" : actual.toString(),
+                            expected == null ? "null" : expected.toString(), "Unexpected result:");
+    }
+
+    @Test(dataProvider = "readFieldValueNegativeDataProvider",
+            dataProviderClass = ReadFieldValueDataProvider.class,
+            expectedExceptions = {NullPointerException.class})
+    public void testNegativeReadFieldValue(ResolvedJavaField field, JavaConstant receiver) {
+        CONSTANT_REFLECTION_PROVIDER.readFieldValue(field, receiver);
+    }
+
+    @Test(dataProvider = "readStableFieldValueDataProvider",
+            dataProviderClass = ReadStableFieldValueDataProvider.class)
+    public void testReadStableFieldValue(ResolvedJavaField field, JavaConstant receiver, boolean isDefStab,
+                                         JavaConstant expected) {
+        Assert.assertEquals(
+                CONSTANT_REFLECTION_PROVIDER.readStableFieldValue(field, receiver, isDefStab),
+                expected,
+                "Unexpected result:");
+    }
+
+    @Test(dataProvider = "readStableFieldValueArrayDataProvider",
+            dataProviderClass = ReadStableFieldValueDataProvider.class)
+    public void testReadStableFieldValueForArray(ResolvedJavaField field, JavaConstant receiver, boolean isDefStab,
+                                                 int arrayDim, JavaConstant expected) {
+        JavaConstant result = CONSTANT_REFLECTION_PROVIDER.readStableFieldValue(field, receiver,
+                                                                                isDefStab);
+        boolean resultDefStab = false;
+        int resultStableDim = -1;
+        try {
+            Class<?> hotSpotObjectConstantImplClass = Class.forName(
+                    "jdk.vm.ci.hotspot.HotSpotObjectConstantImpl");
+            Method getStableDimensionMethod = hotSpotObjectConstantImplClass.getDeclaredMethod(
+                    "getStableDimension");
+            Method isDefaultStableMethod = hotSpotObjectConstantImplClass.getDeclaredMethod(
+                    "isDefaultStable");
+            getStableDimensionMethod.setAccessible(true);
+            isDefaultStableMethod.setAccessible(true);
+            resultDefStab = (boolean) isDefaultStableMethod.invoke(result);
+            resultStableDim = (int) getStableDimensionMethod.invoke(result);
+        } catch (ReflectiveOperationException e) {
+            throw new Error("Unexpected error: " + e, e);
+        }
+        Assert.assertEquals(resultDefStab, isDefStab,
+                            "Wrong default stable value for " + result.toString());
+        Assert.assertEquals(resultStableDim, arrayDim,
+                            "Wrong array dimension for " + result.toString());
+        Assert.assertEquals(result.toString(), expected.toString(), "Unexpected result:");
+    }
+
+    @Test(dataProvider = "readStableFieldValueNegativeDataProvider",
+            dataProviderClass = ReadStableFieldValueDataProvider.class,
+            expectedExceptions = {NullPointerException.class})
+    public void testNegativeReadStableFieldValue(ResolvedJavaField field, JavaConstant receiver, boolean isDefStab) {
+        CONSTANT_REFLECTION_PROVIDER.readStableFieldValue(field, receiver, isDefStab);
+    }
+
+    @Test(dataProvider = "readConstantFieldValueDataProvider",
+            dataProviderClass = ReadConstantFieldValueDataProvider.class)
+    public void testReadConstantFieldValue(ResolvedJavaField field, JavaConstant receiver, JavaConstant expected,
+                                           String testInfo) {
+        String msg = String.format("Unexpected result for %s. Field is stable = %s.", testInfo,
+                                   ((HotSpotResolvedJavaField) field).isStable());
+        Assert.assertEquals(CONSTANT_REFLECTION_PROVIDER.readConstantFieldValue(field, receiver),
+                            expected, msg);
+    }
+
+    @Test(dataProvider = "readConstantFieldValueNegativeDataProvider",
+            dataProviderClass = ReadConstantFieldValueDataProvider.class,
+            expectedExceptions = {NullPointerException.class})
+    public void testNegativeReadConstantFieldValue(ResolvedJavaField field, JavaConstant receiver) {
+        CONSTANT_REFLECTION_PROVIDER.readConstantFieldValue(field, receiver);
+    }
+
+    @Test(dataProvider = "readConstantArrayElementDataProvider",
+            dataProviderClass = ReadConstantArrayElementDataProvider.class)
+    public void testReadConstantArrayElement(JavaConstant array, int index, JavaConstant expected, String testInfo) {
+        JavaConstant actual = CONSTANT_REFLECTION_PROVIDER.readConstantArrayElement(array, index);
+        Assert.assertEquals(actual == null ? "null" : actual.toString(),
+                            expected == null ? "null" : expected.toString(),
+                            String.format("Unexpected result while testing %s:", testInfo));
+    }
+
+    @Test(dataProvider = "readConstantArrayElementForOffsetDataProvider",
+            dataProviderClass = ReadConstantArrayElementDataProvider.class)
+    public void testReadConstantArrayElementForOffset(JavaConstant array, long offset, JavaConstant expected,
+                                                      String testInfo) {
+        JavaConstant actual = CONSTANT_REFLECTION_PROVIDER.readConstantArrayElementForOffset(array,
+                                                                                             offset);
+        Assert.assertEquals(actual == null ? "null" : actual.toString(),
+                            expected == null ? "null" : expected.toString(),
+                            String.format("Unexpected result while testing %s:", testInfo));
+    }
+
+    @Test(dataProvider = "asJavaTypeDataProvider", dataProviderClass = AsJavaTypeDataProvider.class)
+    public void testAsJavaType(JavaConstant constant, String expected) {
+        ResolvedJavaType actual = CONSTANT_REFLECTION_PROVIDER.asJavaType(constant);
+        Assert.assertEquals(actual == null ? "null" : actual.toJavaName(),
+                            expected == null ? "null" : expected,
+                            "Unexpected result, wrong type returned:");
+    }
+
+    @Test(dataProvider = "boxPrimitiveDataProvider", dataProviderClass = BoxPrimitiveDataProvider.class)
+    public void testBoxPrimitive(JavaConstant constant, JavaConstant expected) {
+        JavaConstant actual = CONSTANT_REFLECTION_PROVIDER.boxPrimitive(constant);
+        Assert.assertEquals(actual, expected, "Unexpected result:");
+    }
+
+    @Test(dataProvider = "unboxPrimitiveDataProvider", dataProviderClass = UnboxPrimitiveDataProvider.class)
+    public void testUnboxPrimitive(JavaConstant constant, JavaConstant expected) {
+        JavaConstant actual = CONSTANT_REFLECTION_PROVIDER.unboxPrimitive(constant);
+        Assert.assertEquals(actual, expected, "Unexpected result:");
+    }
+
+    @Test(dataProvider = "isEmbeddableDataProvider", dataProviderClass = IsEmbeddableDataProvider.class)
+    public void testIsEmbeddable(JavaConstant constant, boolean expected) {
+        boolean actual = CONSTANT_REFLECTION_PROVIDER.isEmbeddable(constant);
+        Assert.assertEquals(actual, expected, "Unexpected result:");
+    }
+
+    @Test
+    public void testGetMemoryAccessProvider() {
+        MemoryAccessProvider actual = CONSTANT_REFLECTION_PROVIDER.getMemoryAccessProvider();
+        Assert.assertNotNull(actual, "Returned MemoryAccessProvider instance should not be null");
+    }
+
+    @Test
+    public void testGetMethodHandleAccess() {
+        MethodHandleAccessProvider actual = CONSTANT_REFLECTION_PROVIDER.getMethodHandleAccess();
+        Assert.assertNotNull(actual,
+                             "Returned MethodHandleAccessProvider instance should not be null");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/IsEmbeddableDataProvider.java	Fri Mar 25 14:46:09 2016 +0300
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.vm.ci.hotspot.test;
+
+import static jdk.vm.ci.hotspot.test.TestHelper.CONSTANT_REFLECTION_PROVIDER;
+import static jdk.vm.ci.hotspot.test.TestHelper.DUMMY_CLASS_INSTANCE;
+
+import jdk.vm.ci.meta.JavaConstant;
+import org.testng.annotations.DataProvider;
+
+public class IsEmbeddableDataProvider {
+    @DataProvider(name = "isEmbeddableDataProvider")
+    public static Object[][] isEmbeddableDataProvider() {
+        return new Object[][]{{JavaConstant.forBoolean(DUMMY_CLASS_INSTANCE.booleanField), true},
+                {JavaConstant.forByte(DUMMY_CLASS_INSTANCE.byteField), true},
+                {JavaConstant.forShort(DUMMY_CLASS_INSTANCE.shortField), true},
+                {JavaConstant.forInt(DUMMY_CLASS_INSTANCE.intField), true},
+                {JavaConstant.forLong(DUMMY_CLASS_INSTANCE.longField), true},
+                {JavaConstant.forChar(DUMMY_CLASS_INSTANCE.charField), true},
+                {JavaConstant.forFloat(DUMMY_CLASS_INSTANCE.floatField), true},
+                {JavaConstant.forDouble(DUMMY_CLASS_INSTANCE.doubleField), true},
+                {CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.objectField), true},
+                {JavaConstant.NULL_POINTER, true}, {null, true}};
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/ReadArrayElementDataProvider.java	Fri Mar 25 14:46:09 2016 +0300
@@ -0,0 +1,102 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.vm.ci.hotspot.test;
+
+import static jdk.vm.ci.hotspot.test.TestHelper.ARRAYS_MAP;
+import static jdk.vm.ci.hotspot.test.TestHelper.ARRAY_ARRAYS_MAP;
+import static jdk.vm.ci.hotspot.test.TestHelper.CONSTANT_REFLECTION_PROVIDER;
+import static jdk.vm.ci.hotspot.test.TestHelper.DUMMY_CLASS_INSTANCE;
+import static jdk.vm.ci.hotspot.test.TestHelper.INSTANCE_FIELDS_MAP;
+
+import java.util.LinkedList;
+import java.util.stream.Stream;
+
+import jdk.vm.ci.meta.JavaConstant;
+import org.testng.annotations.DataProvider;
+
+public class ReadArrayElementDataProvider {
+
+    @DataProvider(name = "readArrayElementDataProvider")
+    public static Object[][] readArrayElementDataProvider() {
+        LinkedList<Object[]> cfgSet = new LinkedList<>();
+        for (int i : new int[]{0, 1}) {
+            cfgSet.add(new Object[]{CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.booleanArrayWithValues),
+                    i, JavaConstant.forBoolean(DUMMY_CLASS_INSTANCE.booleanArrayWithValues[i])});
+            cfgSet.add(new Object[]{CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.byteArrayWithValues),
+                    i, JavaConstant.forByte(DUMMY_CLASS_INSTANCE.byteArrayWithValues[i])});
+            cfgSet.add(new Object[]{CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.shortArrayWithValues),
+                    i, JavaConstant.forShort(DUMMY_CLASS_INSTANCE.shortArrayWithValues[i])});
+            cfgSet.add(new Object[]{CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.charArrayWithValues),
+                    i, JavaConstant.forChar(DUMMY_CLASS_INSTANCE.charArrayWithValues[i])});
+            cfgSet.add(new Object[]{CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.intArrayWithValues),
+                    i, JavaConstant.forInt(DUMMY_CLASS_INSTANCE.intArrayWithValues[i])});
+            cfgSet.add(new Object[]{CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.longArrayWithValues),
+                    i, JavaConstant.forLong(DUMMY_CLASS_INSTANCE.longArrayWithValues[i])});
+            cfgSet.add(new Object[]{CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.floatArrayWithValues),
+                    i, JavaConstant.forFloat(DUMMY_CLASS_INSTANCE.floatArrayWithValues[i])});
+            cfgSet.add(new Object[]{CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.doubleArrayWithValues),
+                    i, JavaConstant.forDouble(DUMMY_CLASS_INSTANCE.doubleArrayWithValues[i])});
+            cfgSet.add(new Object[]{CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.objectArrayWithValues),
+                    i, CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.objectArrayWithValues[i])});
+            cfgSet.add(new Object[]{
+                    CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.booleanArrayArrayWithValues), i,
+                    CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.booleanArrayArrayWithValues[i])});
+            cfgSet.add(new Object[]{
+                    CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.byteArrayArrayWithValues), i,
+                    CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.byteArrayArrayWithValues[i])});
+            cfgSet.add(new Object[]{
+                    CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.shortArrayArrayWithValues), i,
+                    CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.shortArrayArrayWithValues[i])});
+            cfgSet.add(new Object[]{
+                    CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.charArrayArrayWithValues), i,
+                    CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.charArrayArrayWithValues[i])});
+            cfgSet.add(new Object[]{
+                    CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.intArrayArrayWithValues), i,
+                    CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.intArrayArrayWithValues[i])});
+            cfgSet.add(new Object[]{
+                    CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.longArrayArrayWithValues), i,
+                    CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.longArrayArrayWithValues[i])});
+            cfgSet.add(new Object[]{
+                    CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.floatArrayArrayWithValues), i,
+                    CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.floatArrayArrayWithValues[i])});
+            cfgSet.add(new Object[]{
+                    CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.doubleArrayArrayWithValues), i,
+                    CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.doubleArrayArrayWithValues[i])});
+            cfgSet.add(new Object[]{
+                    CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.objectArrayArrayWithValues), i,
+                    CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.objectArrayArrayWithValues[i])});
+        }
+        Stream.concat(ARRAYS_MAP.values().stream(), ARRAY_ARRAYS_MAP.values().stream()).forEach((array) -> {
+            for (int i : new int[]{-1, 2}) {
+                cfgSet.add(new Object[]{array, i, null});
+            }
+        });
+        cfgSet.add(new Object[]{null, 0, null});
+        cfgSet.add(new Object[]{JavaConstant.NULL_POINTER, 0, null});
+        INSTANCE_FIELDS_MAP.values().forEach((constant) -> {
+            cfgSet.add(new Object[]{constant, 0, null});
+        });
+        return cfgSet.toArray(new Object[0][0]);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/ReadArrayLengthDataProvider.java	Fri Mar 25 14:46:09 2016 +0300
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.vm.ci.hotspot.test;
+
+import static jdk.vm.ci.hotspot.test.TestHelper.CONSTANT_REFLECTION_PROVIDER;
+import static jdk.vm.ci.hotspot.test.TestHelper.DUMMY_CLASS_INSTANCE;
+
+import java.util.LinkedList;
+import java.util.List;
+import jdk.vm.ci.meta.JavaConstant;
+import org.testng.annotations.DataProvider;
+
+public class ReadArrayLengthDataProvider {
+
+    public static List<Object> createListOfDummyArrays(int length) {
+        List<Object> arrays = new LinkedList<>();
+        arrays.add(new boolean[length]);
+        arrays.add(new byte[length]);
+        arrays.add(new short[length]);
+        arrays.add(new char[length]);
+        arrays.add(new int[length]);
+        arrays.add(new long[length]);
+        arrays.add(new float[length]);
+        arrays.add(new double[length]);
+        arrays.add(new Object[length]);
+        arrays.add(new boolean[length][2]);
+        arrays.add(new byte[length][2]);
+        arrays.add(new short[length][2]);
+        arrays.add(new char[length][2]);
+        arrays.add(new int[length][2]);
+        arrays.add(new long[length][2]);
+        arrays.add(new float[length][2]);
+        arrays.add(new double[length][2]);
+        arrays.add(new Object[length][2]);
+        return arrays;
+    }
+
+    @DataProvider(name = "readArrayLengthDataProvider")
+    public static Object[][] readArrayLengthDataProvider() {
+        LinkedList<Object[]> cfgSet = new LinkedList<>();
+        for (int i : new int[]{0, 1, 42}) {
+            createListOfDummyArrays(i).stream().forEach((array) -> {
+                cfgSet.add(new Object[]{CONSTANT_REFLECTION_PROVIDER.forObject(array), i});
+            });
+        }
+        cfgSet.add(new Object[]{null, null});
+        cfgSet.add(new Object[]{JavaConstant.NULL_POINTER, null});
+        cfgSet.add(new Object[]{CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.intField), null});
+        cfgSet.add(new Object[]{JavaConstant.forInt(DUMMY_CLASS_INSTANCE.intField), null});
+        return cfgSet.toArray(new Object[0][0]);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/ReadConstantArrayElementDataProvider.java	Fri Mar 25 14:46:09 2016 +0300
@@ -0,0 +1,290 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.vm.ci.hotspot.test;
+
+import static jdk.vm.ci.hotspot.test.TestHelper.ARRAYS_MAP;
+import static jdk.vm.ci.hotspot.test.TestHelper.ARRAY_ARRAYS_MAP;
+import static jdk.vm.ci.hotspot.test.TestHelper.CONSTANT_REFLECTION_PROVIDER;
+import static jdk.vm.ci.hotspot.test.TestHelper.DUMMY_CLASS_CONSTANT;
+import static jdk.vm.ci.hotspot.test.TestHelper.DUMMY_CLASS_INSTANCE;
+import static jdk.vm.ci.hotspot.test.TestHelper.getResolvedJavaField;
+import static jdk.vm.ci.hotspot.test.TestHelper.INSTANCE_STABLE_FIELDS_MAP;
+import static jdk.vm.ci.hotspot.test.TestHelper.INSTANCE_FIELDS_MAP;
+import static jdk.vm.ci.hotspot.test.TestHelper.STABLE_ARRAYS_MAP;
+import static jdk.vm.ci.hotspot.test.TestHelper.STABLE_ARRAY_ARRAYS_MAP;
+
+import java.lang.reflect.Field;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Stream;
+
+import jdk.vm.ci.meta.JavaConstant;
+import org.testng.annotations.DataProvider;
+import jdk.internal.misc.Unsafe;
+import jdk.vm.ci.meta.ResolvedJavaField;
+
+public class ReadConstantArrayElementDataProvider {
+
+    // Non-stable array fields names mapped to their base offsets and index scale
+    private static final List<ArrayFieldParams> NON_STABLE_ARRAY_NAMES
+            = new LinkedList<>();
+
+    static {
+        NON_STABLE_ARRAY_NAMES.add(
+                new ArrayFieldParams("booleanArrayWithValues", Unsafe.ARRAY_BOOLEAN_BASE_OFFSET,
+                             Unsafe.ARRAY_BOOLEAN_INDEX_SCALE));
+        NON_STABLE_ARRAY_NAMES.add(new ArrayFieldParams("byteArrayWithValues",
+                                                Unsafe.ARRAY_BYTE_BASE_OFFSET,
+                                                Unsafe.ARRAY_BYTE_INDEX_SCALE));
+        NON_STABLE_ARRAY_NAMES.add(new ArrayFieldParams("shortArrayWithValues",
+                                                Unsafe.ARRAY_SHORT_BASE_OFFSET,
+                                                Unsafe.ARRAY_SHORT_INDEX_SCALE));
+        NON_STABLE_ARRAY_NAMES.add(new ArrayFieldParams("charArrayWithValues",
+                                                Unsafe.ARRAY_CHAR_BASE_OFFSET,
+                                                Unsafe.ARRAY_CHAR_INDEX_SCALE));
+        NON_STABLE_ARRAY_NAMES.add(new ArrayFieldParams("intArrayWithValues",
+                                                Unsafe.ARRAY_INT_BASE_OFFSET,
+                                                Unsafe.ARRAY_INT_INDEX_SCALE));
+        NON_STABLE_ARRAY_NAMES.add(new ArrayFieldParams("longArrayWithValues",
+                                                Unsafe.ARRAY_LONG_BASE_OFFSET,
+                                                Unsafe.ARRAY_LONG_INDEX_SCALE));
+        NON_STABLE_ARRAY_NAMES.add(new ArrayFieldParams("floatArrayWithValues",
+                                                Unsafe.ARRAY_FLOAT_BASE_OFFSET,
+                                                Unsafe.ARRAY_FLOAT_INDEX_SCALE));
+        NON_STABLE_ARRAY_NAMES.add(new ArrayFieldParams("doubleArrayWithValues",
+                                                Unsafe.ARRAY_DOUBLE_BASE_OFFSET,
+                                                Unsafe.ARRAY_DOUBLE_INDEX_SCALE));
+        NON_STABLE_ARRAY_NAMES.add(new ArrayFieldParams("objectArrayWithValues",
+                                                Unsafe.ARRAY_BOOLEAN_BASE_OFFSET,
+                                                Unsafe.ARRAY_BOOLEAN_INDEX_SCALE));
+        NON_STABLE_ARRAY_NAMES.add(new ArrayFieldParams("booleanArrayArrayWithValues",
+                                                Unsafe.ARRAY_OBJECT_BASE_OFFSET,
+                                                Unsafe.ARRAY_OBJECT_INDEX_SCALE));
+        NON_STABLE_ARRAY_NAMES.add(new ArrayFieldParams("byteArrayArrayWithValues",
+                                                Unsafe.ARRAY_OBJECT_BASE_OFFSET,
+                                                Unsafe.ARRAY_OBJECT_INDEX_SCALE));
+        NON_STABLE_ARRAY_NAMES.add(new ArrayFieldParams("shortArrayArrayWithValues",
+                                                Unsafe.ARRAY_OBJECT_BASE_OFFSET,
+                                                Unsafe.ARRAY_OBJECT_INDEX_SCALE));
+        NON_STABLE_ARRAY_NAMES.add(new ArrayFieldParams("charArrayArrayWithValues",
+                                                Unsafe.ARRAY_OBJECT_BASE_OFFSET,
+                                                Unsafe.ARRAY_OBJECT_INDEX_SCALE));
+        NON_STABLE_ARRAY_NAMES.add(new ArrayFieldParams("intArrayArrayWithValues",
+                                                Unsafe.ARRAY_OBJECT_BASE_OFFSET,
+                                                Unsafe.ARRAY_OBJECT_INDEX_SCALE));
+        NON_STABLE_ARRAY_NAMES.add(new ArrayFieldParams("longArrayArrayWithValues",
+                                                Unsafe.ARRAY_OBJECT_BASE_OFFSET,
+                                                Unsafe.ARRAY_OBJECT_INDEX_SCALE));
+        NON_STABLE_ARRAY_NAMES.add(new ArrayFieldParams("floatArrayArrayWithValues",
+                                                Unsafe.ARRAY_OBJECT_BASE_OFFSET,
+                                                Unsafe.ARRAY_OBJECT_INDEX_SCALE));
+        NON_STABLE_ARRAY_NAMES.add(new ArrayFieldParams("doubleArrayArrayWithValues",
+                                                Unsafe.ARRAY_OBJECT_BASE_OFFSET,
+                                                Unsafe.ARRAY_OBJECT_INDEX_SCALE));
+        NON_STABLE_ARRAY_NAMES.add(new ArrayFieldParams("objectArrayArrayWithValues",
+                                                Unsafe.ARRAY_OBJECT_BASE_OFFSET,
+                                                Unsafe.ARRAY_OBJECT_INDEX_SCALE));
+    }
+
+    // Stable array fields names mapped to their base offsets and index scale
+    private static final List<ArrayFieldParams> STABLE_ARRAY_NAMES
+            = new LinkedList<>();
+
+    static {
+        NON_STABLE_ARRAY_NAMES.stream().forEach((entry) -> {
+            String nsFieldName = entry.name;
+            char firstChar = nsFieldName.charAt(0);
+            char newFirstChar = Character.toUpperCase(firstChar);
+            String sFieldName = nsFieldName.replaceFirst("" + firstChar,
+                                                         "" + newFirstChar);
+            sFieldName = "stable" + sFieldName;
+            STABLE_ARRAY_NAMES.add(new ArrayFieldParams(sFieldName, entry.offsetBase, entry.scale));
+        });
+    }
+
+    @DataProvider(name = "readConstantArrayElementDataProvider")
+    public static Object[][] readConstantArrayElementDataProvider() {
+        LinkedList<Object[]> cfgSet = new LinkedList<>();
+        for (int i : new int[]{0, 1}) {
+            NON_STABLE_ARRAY_NAMES.stream().forEach((entry) -> {
+                String fieldName = entry.name;
+                cfgSet.add(new Object[]{
+                        readFieldValue(fieldName),
+                        i,
+                        null,
+                        "array field \"" + fieldName + "\" for index " + i});
+            });
+            STABLE_ARRAY_NAMES.stream().forEach((entry) -> {
+                String fieldName = entry.name;
+                cfgSet.add(new Object[]{
+                        readFieldValue(fieldName),
+                        i,
+                        i == 0 ? getJavaConstant(fieldName) : null,
+                        "array field \"" + fieldName + "\" for index " + i});
+            });
+        }
+        Stream<Map.Entry<ResolvedJavaField, JavaConstant>> arraysStream1
+                = Stream.concat(ARRAYS_MAP.entrySet().stream(),
+                                ARRAY_ARRAYS_MAP.entrySet().stream());
+        Stream<Map.Entry<ResolvedJavaField, JavaConstant>> arraysStream2
+                = Stream.concat(STABLE_ARRAYS_MAP.entrySet().stream(),
+                                STABLE_ARRAY_ARRAYS_MAP.entrySet().stream());
+        Stream.concat(arraysStream1, arraysStream2).forEach((array) -> {
+            for (int i : new int[]{-1, 2}) {
+                cfgSet.add(new Object[]{
+                        array.getValue(),
+                        i,
+                        null,
+                        "array field \"" + array.getKey() + "\" for index " + i});
+            }
+        });
+        cfgSet.add(new Object[]{null, 0, null, "null"});
+        cfgSet.add(new Object[]{JavaConstant.NULL_POINTER, 0, null, "JavaConstant.NULL_POINTER"});
+        INSTANCE_FIELDS_MAP.values().forEach((constant) -> {
+            cfgSet.add(new Object[]{constant, 0, null, "non-stable non-array field"});
+        });
+        INSTANCE_STABLE_FIELDS_MAP.values().forEach((constant) -> {
+            cfgSet.add(new Object[]{constant, 0, null, "stable non-array field"});
+        });
+        return cfgSet.toArray(new Object[0][0]);
+    }
+
+    @DataProvider(name = "readConstantArrayElementForOffsetDataProvider")
+    public static Object[][] readConstantArrayElementForOffsetDataProvider() {
+        LinkedList<Object[]> cfgSet = new LinkedList<>();
+        // Testing non-stable arrays. Result should be null in all cases
+        for (double i : new double[]{-1, 0, 0.5, 1, 1.5, 2}) {
+            NON_STABLE_ARRAY_NAMES.stream().forEach(entry -> {
+                String fieldName = entry.name;
+                long offset = (long) (entry.offsetBase + i * entry.scale);
+                cfgSet.add(new Object[]{
+                        readFieldValue(fieldName),
+                        offset,
+                        null,
+                        "array field \"" + fieldName + "\" for offset " + offset});
+            });
+        }
+        // Testing stable arrays. Result should be null in all cases except "offset = base + 0"
+        for (double i : new double[]{-1, 0.5, 1, 1.5, 2}) {
+            STABLE_ARRAY_NAMES.stream().forEach(entry -> {
+                String fieldName = entry.name;
+                long offset = (long) Math.ceil(entry.offsetBase + i * entry.scale);
+                cfgSet.add(new Object[]{
+                        readFieldValue(fieldName),
+                        offset,
+                        null,
+                        "array field \"" + fieldName + "\" for offset " + offset});
+            });
+        }
+        // Testing stable arrays "offset = base + 0". Result should be non-null
+        STABLE_ARRAY_NAMES.stream().forEach(entry -> {
+            String fieldName = entry.name;
+            long offset = (long) entry.offsetBase;
+            cfgSet.add(new Object[]{
+                    readFieldValue(fieldName),
+                    offset,
+                    getJavaConstant(fieldName),
+                    "array field \"" + fieldName + "\" for offset " + offset});
+        });
+        // Testing null as array
+        cfgSet.add(new Object[]{null, 0, null, "null"});
+        // Testing JavaConstant.NULL_POINTER as array
+        cfgSet.add(new Object[]{JavaConstant.NULL_POINTER, 0, null, "JavaConstant.NULL_POINTER"});
+        // Testing non-stable non-array fields
+        INSTANCE_FIELDS_MAP.values().forEach((constant) -> {
+            cfgSet.add(new Object[]{constant, 0, null, "non-stable non-array field"});
+        });
+        // Testing stable non-array fields
+        INSTANCE_STABLE_FIELDS_MAP.values().forEach((constant) -> {
+            cfgSet.add(new Object[]{constant, 0, null, "stable non-array field"});
+        });
+        return cfgSet.toArray(new Object[0][0]);
+    }
+
+    private static JavaConstant readFieldValue(String fieldName) {
+        return CONSTANT_REFLECTION_PROVIDER.readFieldValue(getResolvedJavaField(DummyClass.class, fieldName),
+                                                           DUMMY_CLASS_CONSTANT);
+    }
+
+    private static JavaConstant getJavaConstant(String fieldName) {
+        Class<DummyClass> dummyClass = DummyClass.class;
+        Field arrayField;
+        try {
+            arrayField = dummyClass.getDeclaredField(fieldName);
+        } catch (NoSuchFieldException ex) {
+            throw new Error("Test bug: wrong field name " + ex, ex);
+        } catch (SecurityException ex) {
+            throw new Error("Unexpected error: " + ex, ex);
+        }
+        arrayField.setAccessible(true);
+        Class<?> componentType = arrayField.getType().getComponentType();
+        if (componentType == null) {
+            throw new Error("Test error: field is not an array");
+        }
+        Object value;
+        try {
+            value = arrayField.get(DUMMY_CLASS_INSTANCE);
+        } catch (IllegalArgumentException | IllegalAccessException ex) {
+            throw new Error("Unexpected error: " + ex, ex);
+        }
+        if (componentType == boolean.class) {
+            return JavaConstant.forBoolean(((boolean[]) value)[0]);
+        }
+        if (componentType == byte.class) {
+            return JavaConstant.forByte(((byte[]) value)[0]);
+        }
+        if (componentType == short.class) {
+            return JavaConstant.forShort(((short[]) value)[0]);
+        }
+        if (componentType == char.class) {
+            return JavaConstant.forChar(((char[]) value)[0]);
+        }
+        if (componentType == int.class) {
+            return JavaConstant.forInt(((int[]) value)[0]);
+        }
+        if (componentType == long.class) {
+            return JavaConstant.forLong(((long[]) value)[0]);
+        }
+        if (componentType == float.class) {
+            return JavaConstant.forFloat(((float[]) value)[0]);
+        }
+        if (componentType == double.class) {
+            return JavaConstant.forDouble(((double[]) value)[0]);
+        }
+        return CONSTANT_REFLECTION_PROVIDER.forObject(((Object[]) value)[0]);
+    }
+
+    private static class ArrayFieldParams {
+        public final String name;
+        public final int offsetBase;
+        public final int scale;
+
+       ArrayFieldParams(String name, int offsetBase, int scale) {
+           this.name = name;
+           this.offsetBase = offsetBase;
+           this.scale = scale;
+       }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/ReadConstantFieldValueDataProvider.java	Fri Mar 25 14:46:09 2016 +0300
@@ -0,0 +1,112 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.vm.ci.hotspot.test;
+
+import static jdk.vm.ci.hotspot.test.TestHelper.DUMMY_CLASS_CONSTANT;
+import static jdk.vm.ci.hotspot.test.TestHelper.INSTANCE_STABLE_FIELDS_MAP;
+import static jdk.vm.ci.hotspot.test.TestHelper.INSTANCE_FINAL_DEFAULT_FIELDS_MAP;
+import static jdk.vm.ci.hotspot.test.TestHelper.INSTANCE_FINAL_FIELDS_MAP;
+import static jdk.vm.ci.hotspot.test.TestHelper.INSTANCE_FIELDS_MAP;
+import static jdk.vm.ci.hotspot.test.TestHelper.INSTANCE_STABLE_DEFAULT_FIELDS_MAP;
+import static jdk.vm.ci.hotspot.test.TestHelper.STATIC_FIELDS_MAP;
+import static jdk.vm.ci.hotspot.test.TestHelper.STATIC_FINAL_FIELDS_MAP;
+import static jdk.vm.ci.hotspot.test.TestHelper.STATIC_STABLE_FIELDS_MAP;
+import static jdk.vm.ci.hotspot.test.TestHelper.STATIC_STABLE_DEFAULT_FIELDS_MAP;
+
+import java.util.LinkedList;
+import jdk.vm.ci.hotspot.HotSpotJVMCIRuntime;
+import jdk.vm.ci.meta.JavaConstant;
+import org.testng.annotations.DataProvider;
+
+
+public class ReadConstantFieldValueDataProvider {
+
+    @DataProvider(name = "readConstantFieldValueDataProvider")
+    public static Object[][] readConstantFieldValueDataProvider() {
+        LinkedList<Object[]> cfgSet = new LinkedList<>();
+        // Testing static final fields
+        STATIC_FINAL_FIELDS_MAP.entrySet().stream().forEach((field) -> {
+            cfgSet.add(new Object[]{field.getKey(), null, field.getValue(), "static final field"});
+        });
+        // Testing static stable fields
+        STATIC_STABLE_FIELDS_MAP.entrySet().stream().forEach((field) -> {
+            cfgSet.add(new Object[]{field.getKey(), null, field.getValue(), "static stable field"});
+        });
+        // Testing instance final non-default fields
+        INSTANCE_FINAL_FIELDS_MAP.entrySet().stream().forEach((field) -> {
+            cfgSet.add(new Object[]{field.getKey(),
+                    DUMMY_CLASS_CONSTANT,
+                    field.getValue(),
+                    "instance final field"});
+        });
+        // Testing instance final default fields.
+        boolean trustDefFinal = HotSpotJVMCIRuntime.Option.TrustFinalDefaultFields.getBoolean();
+        INSTANCE_FINAL_DEFAULT_FIELDS_MAP.entrySet().stream().forEach((field) -> {
+            JavaConstant expected = trustDefFinal ? field.getValue() : null;
+            cfgSet.add(new Object[]{field.getKey(),
+                    DUMMY_CLASS_CONSTANT,
+                    expected,
+                    "instance final default field"});
+        });
+        // Testing instance stable non-default fields
+        INSTANCE_STABLE_FIELDS_MAP.entrySet().stream().forEach((field) -> {
+            cfgSet.add(new Object[]{field.getKey(),
+                    DUMMY_CLASS_CONSTANT,
+                    field.getValue(),
+                    "instance stable field"});
+        });
+        // Testing instance stable default fields
+        INSTANCE_STABLE_DEFAULT_FIELDS_MAP.entrySet().stream().forEach((field) -> {
+            cfgSet.add(new Object[]{field.getKey(),
+                    DUMMY_CLASS_CONSTANT,
+                    null,
+                    "instance stable default field"});
+        });
+        // Testing regular instance fields
+        INSTANCE_FIELDS_MAP.entrySet().stream().forEach((field) -> {
+            cfgSet.add(new Object[]{field.getKey(), DUMMY_CLASS_CONSTANT, null, "instance field"});
+        });
+        // Testing regular static fields
+        STATIC_FIELDS_MAP.entrySet().stream().forEach((field) -> {
+            cfgSet.add(new Object[]{field.getKey(), null, null, "static field"});
+        });
+        // Testing static stable fields
+        STATIC_STABLE_DEFAULT_FIELDS_MAP.entrySet().stream().forEach((field) -> {
+            cfgSet.add(new Object[]{field.getKey(), null, null, "static stable default field"});
+        });
+        return cfgSet.toArray(new Object[0][0]);
+    }
+
+    @DataProvider(name = "readConstantFieldValueNegativeDataProvider")
+    public static Object[][] readConstantFieldValueNegativeDataProvider() {
+        LinkedList<Object[]> cfgSet = new LinkedList<>();
+        // Testing instance fields with null as receiver
+        INSTANCE_FIELDS_MAP.entrySet().stream().forEach((field) -> {
+            cfgSet.add(new Object[]{field.getKey(), null});
+        });
+        // Testing null as a field argument
+        cfgSet.add(new Object[]{null, null});
+        return cfgSet.toArray(new Object[0][0]);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/ReadFieldValueDataProvider.java	Fri Mar 25 14:46:09 2016 +0300
@@ -0,0 +1,128 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.vm.ci.hotspot.test;
+
+import static jdk.vm.ci.hotspot.test.TestHelper.ARRAYS_MAP;
+import static jdk.vm.ci.hotspot.test.TestHelper.ARRAY_ARRAYS_MAP;
+import static jdk.vm.ci.hotspot.test.TestHelper.CONSTANT_REFLECTION_PROVIDER;
+import static jdk.vm.ci.hotspot.test.TestHelper.DUMMY_CLASS_CONSTANT;
+import static jdk.vm.ci.hotspot.test.TestHelper.DUMMY_CLASS_INSTANCE;
+import static jdk.vm.ci.hotspot.test.TestHelper.STABLE_ARRAYS_MAP;
+import static jdk.vm.ci.hotspot.test.TestHelper.STABLE_ARRAY_ARRAYS_MAP;
+import static jdk.vm.ci.hotspot.test.TestHelper.INSTANCE_STABLE_FIELDS_MAP;
+import static jdk.vm.ci.hotspot.test.TestHelper.INSTANCE_FIELDS_MAP;
+import static jdk.vm.ci.hotspot.test.TestHelper.STATIC_FIELDS_MAP;
+import static jdk.vm.ci.hotspot.test.TestHelper.STATIC_STABLE_FIELDS_MAP;
+
+import java.util.LinkedList;
+import jdk.vm.ci.meta.JavaConstant;
+import org.testng.annotations.DataProvider;
+
+
+public class ReadFieldValueDataProvider {
+
+    @DataProvider(name = "readFieldValueDataProvider")
+    public static Object[][] readFieldValueDataProvider() {
+        LinkedList<Object[]> cfgSet = new LinkedList<>();
+        // Testing instance non-stable fields
+        INSTANCE_FIELDS_MAP.entrySet().stream().forEach((instanceField) -> {
+            cfgSet.add(new Object[]{instanceField.getKey(),
+                    DUMMY_CLASS_CONSTANT,
+                    instanceField.getValue()});
+        });
+        // Testing static non-stable fields with null as receiver
+        STATIC_FIELDS_MAP.entrySet().stream().forEach((staticField) -> {
+            cfgSet.add(new Object[]{staticField.getKey(), null, staticField.getValue()});
+        });
+        // Testing static non-stable fields with JavaConstant.NULL_POINTER as receiver
+        STATIC_FIELDS_MAP.entrySet().stream().forEach((staticField) -> {
+            cfgSet.add(new Object[]{staticField.getKey(),
+                    JavaConstant.NULL_POINTER,
+                    staticField.getValue()});
+        });
+        // Testing instance stable fields
+        INSTANCE_STABLE_FIELDS_MAP.entrySet().stream().forEach((instanceField) -> {
+            cfgSet.add(new Object[]{instanceField.getKey(),
+                    DUMMY_CLASS_CONSTANT,
+                    instanceField.getValue()});
+        });
+        // Testing static stable fields with null as receiver
+        STATIC_STABLE_FIELDS_MAP.entrySet().stream().forEach((staticField) -> {
+            cfgSet.add(new Object[]{staticField.getKey(), null, staticField.getValue()});
+        });
+        // Testing static stable fields with JavaConstant.NULL_POINTER as receiver
+        STATIC_STABLE_FIELDS_MAP.entrySet().stream().forEach((staticField) -> {
+            cfgSet.add(new Object[]{staticField.getKey(),
+                    JavaConstant.NULL_POINTER,
+                    staticField.getValue()});
+        });
+        // Testing instance non-stable array fields
+        ARRAYS_MAP.entrySet().stream().forEach((instanceField) -> {
+            cfgSet.add(new Object[]{instanceField.getKey(),
+                    DUMMY_CLASS_CONSTANT,
+                    instanceField.getValue()});
+        });
+        // Testing instance stable array fields
+        STABLE_ARRAYS_MAP.entrySet().stream().forEach((instanceField) -> {
+            cfgSet.add(new Object[]{instanceField.getKey(),
+                    DUMMY_CLASS_CONSTANT,
+                    instanceField.getValue()});
+        });
+        // Testing instance non-stable array-of-array fields
+        ARRAY_ARRAYS_MAP.entrySet().stream().forEach((instanceField) -> {
+            cfgSet.add(new Object[]{instanceField.getKey(),
+                    DUMMY_CLASS_CONSTANT,
+                    instanceField.getValue()});
+        });
+        // Testing instance stable array-of-array fields
+        STABLE_ARRAY_ARRAYS_MAP.entrySet().stream().forEach((instanceField) -> {
+            cfgSet.add(new Object[]{instanceField.getKey(),
+                    DUMMY_CLASS_CONSTANT,
+                    instanceField.getValue()});
+        });
+        // Testing instance fields with JavaConstant.NULL_POINTER as receiver
+        INSTANCE_FIELDS_MAP.entrySet().stream().forEach((instanceField) -> {
+            cfgSet.add(new Object[]{instanceField.getKey(), JavaConstant.NULL_POINTER, null});
+        });
+        // Testing instance fields with an object that does not have the field
+        INSTANCE_FIELDS_MAP.entrySet().stream().forEach((instanceField) -> {
+            cfgSet.add(new Object[]{instanceField.getKey(),
+                    CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.objectField),
+                    null});
+        });
+        return cfgSet.toArray(new Object[0][0]);
+    }
+
+    @DataProvider(name = "readFieldValueNegativeDataProvider")
+    public static Object[][] readFieldValueNegativeDataProvider() {
+        LinkedList<Object[]> cfgSet = new LinkedList<>();
+        // Testing instance fields with null as receiver
+        INSTANCE_FIELDS_MAP.keySet().stream().forEach((instanceField) -> {
+            cfgSet.add(new Object[]{instanceField, null});
+        });
+        // Testing null as a field argument
+        cfgSet.add(new Object[]{null, null});
+        return cfgSet.toArray(new Object[0][0]);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/ReadStableFieldValueDataProvider.java	Fri Mar 25 14:46:09 2016 +0300
@@ -0,0 +1,161 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.vm.ci.hotspot.test;
+
+import static jdk.vm.ci.hotspot.test.TestHelper.ARRAYS_MAP;
+import static jdk.vm.ci.hotspot.test.TestHelper.ARRAY_ARRAYS_MAP;
+import static jdk.vm.ci.hotspot.test.TestHelper.CONSTANT_REFLECTION_PROVIDER;
+import static jdk.vm.ci.hotspot.test.TestHelper.DUMMY_CLASS_CONSTANT;
+import static jdk.vm.ci.hotspot.test.TestHelper.DUMMY_CLASS_INSTANCE;
+import static jdk.vm.ci.hotspot.test.TestHelper.STABLE_ARRAYS_MAP;
+import static jdk.vm.ci.hotspot.test.TestHelper.STABLE_ARRAY_ARRAYS_MAP;
+import static jdk.vm.ci.hotspot.test.TestHelper.INSTANCE_STABLE_FIELDS_MAP;
+import static jdk.vm.ci.hotspot.test.TestHelper.INSTANCE_FIELDS_MAP;
+import static jdk.vm.ci.hotspot.test.TestHelper.STATIC_FIELDS_MAP;
+import static jdk.vm.ci.hotspot.test.TestHelper.STATIC_STABLE_FIELDS_MAP;
+
+import java.util.LinkedList;
+import jdk.vm.ci.meta.JavaConstant;
+import org.testng.annotations.DataProvider;
+
+public class ReadStableFieldValueDataProvider {
+
+    @DataProvider(name = "readStableFieldValueDataProvider")
+    public static Object[][] readStableFieldValueDataProvider() {
+        LinkedList<Object[]> cfgSet = new LinkedList<>();
+        for (boolean isDefStab : new boolean[]{true, false}) {
+            // Testing instance non-stable fields
+            INSTANCE_FIELDS_MAP.entrySet().stream().forEach((instanceField) -> {
+                cfgSet.add(new Object[]{instanceField.getKey(),
+                        DUMMY_CLASS_CONSTANT,
+                        isDefStab,
+                        instanceField.getValue()});
+            });
+            // Testing static non-stable fields with null as receiver
+            STATIC_FIELDS_MAP.entrySet().stream().forEach((staticField) -> {
+                cfgSet.add(new Object[]{staticField.getKey(),
+                        null,
+                        isDefStab,
+                        staticField.getValue()});
+            });
+            // Testing static non-stable fields with JavaConstant.NULL_POINTER as receiver
+            STATIC_FIELDS_MAP.entrySet().stream().forEach((staticField) -> {
+                cfgSet.add(new Object[]{staticField.getKey(),
+                        JavaConstant.NULL_POINTER,
+                        isDefStab,
+                        staticField.getValue()});
+            });
+            // Testing instance stable fields
+            INSTANCE_STABLE_FIELDS_MAP.entrySet().stream().forEach((instanceField) -> {
+                cfgSet.add(new Object[]{instanceField.getKey(),
+                        DUMMY_CLASS_CONSTANT,
+                        isDefStab,
+                        instanceField.getValue()});
+            });
+            // Testing static stable fields with null as receiver
+            STATIC_STABLE_FIELDS_MAP.entrySet().stream().forEach((staticField) -> {
+                cfgSet.add(new Object[]{staticField.getKey(),
+                        null,
+                        isDefStab,
+                        staticField.getValue()});
+            });
+            // Testing static stable fields with JavaConstant.NULL_POINTER as receiver
+            STATIC_STABLE_FIELDS_MAP.entrySet().stream().forEach((staticField) -> {
+                cfgSet.add(new Object[]{staticField.getKey(),
+                        JavaConstant.NULL_POINTER,
+                        isDefStab,
+                        staticField.getValue()});
+            });
+            // Testing instance fields with JavaConstant.NULL_POINTER as receiver
+            INSTANCE_FIELDS_MAP.entrySet().stream().forEach((instanceField) -> {
+                cfgSet.add(new Object[]{instanceField.getKey(),
+                        JavaConstant.NULL_POINTER,
+                        isDefStab,
+                        null});
+            });
+            // Testing instance fields with an object that does not have the field
+            INSTANCE_FIELDS_MAP.entrySet().stream().forEach((instanceField) -> {
+                cfgSet.add(new Object[]{instanceField.getKey(),
+                        CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.objectField),
+                        isDefStab,
+                        null});
+            });
+        }
+        return cfgSet.toArray(new Object[0][0]);
+    }
+
+    @DataProvider(name = "readStableFieldValueArrayDataProvider")
+    public static Object[][] readStableFieldValueArrayDataProvider() {
+        LinkedList<Object[]> cfgSet = new LinkedList<>();
+        for (boolean isDefStab : new boolean[]{true, false}) {
+            // Testing instance non-stable array fields
+            ARRAYS_MAP.entrySet().stream().forEach((instanceField) -> {
+                cfgSet.add(new Object[]{instanceField.getKey(),
+                        DUMMY_CLASS_CONSTANT,
+                        isDefStab,
+                        TestHelper.ARRAY_DIMENSION,
+                        instanceField.getValue()});
+            });
+            // Testing instance stable array fields
+            STABLE_ARRAYS_MAP.entrySet().stream().forEach((instanceField) -> {
+                cfgSet.add(new Object[]{instanceField.getKey(),
+                        DUMMY_CLASS_CONSTANT,
+                        isDefStab,
+                        TestHelper.ARRAY_DIMENSION,
+                        instanceField.getValue()});
+            });
+            // Testing instance non-stable array-of-array fields
+            ARRAY_ARRAYS_MAP.entrySet().stream().forEach((instanceField) -> {
+                cfgSet.add(new Object[]{instanceField.getKey(),
+                        DUMMY_CLASS_CONSTANT,
+                        isDefStab,
+                        TestHelper.ARRAY_OF_ARRAYS_DIMENSION,
+                        instanceField.getValue()});
+            });
+            // Testing instance stable array-of-array fields
+            STABLE_ARRAY_ARRAYS_MAP.entrySet().stream().forEach((instanceField) -> {
+                cfgSet.add(new Object[]{instanceField.getKey(),
+                        DUMMY_CLASS_CONSTANT,
+                        isDefStab,
+                        TestHelper.ARRAY_OF_ARRAYS_DIMENSION,
+                        instanceField.getValue()});
+            });
+        }
+        return cfgSet.toArray(new Object[0][0]);
+    }
+
+    @DataProvider(name = "readStableFieldValueNegativeDataProvider")
+    public static Object[][] readStableFieldValueNegativeDataProvider() {
+        LinkedList<Object[]> cfgSet = new LinkedList<>();
+        for (boolean isDefStab : new boolean[]{true, false}) {
+            // Testing instance fields with null as receiver
+            INSTANCE_FIELDS_MAP.keySet().stream().forEach((instanceField) -> {
+                cfgSet.add(new Object[]{instanceField, null, isDefStab});
+            });
+            // Testing null as a field argument
+            cfgSet.add(new Object[]{null, null, isDefStab});
+        }
+        return cfgSet.toArray(new Object[0][0]);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/TestHelper.java	Fri Mar 25 14:46:09 2016 +0300
@@ -0,0 +1,486 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.vm.ci.hotspot.test;
+
+import java.lang.reflect.Field;
+import java.util.HashMap;
+import java.util.Map;
+import jdk.vm.ci.hotspot.HotSpotConstantReflectionProvider;
+import jdk.vm.ci.meta.JavaConstant;
+import jdk.vm.ci.meta.MetaAccessProvider;
+import jdk.vm.ci.meta.ResolvedJavaField;
+import jdk.vm.ci.runtime.JVMCI;
+
+public class TestHelper {
+
+    public static final DummyClass DUMMY_CLASS_INSTANCE = new DummyClass();
+    public static final HotSpotConstantReflectionProvider CONSTANT_REFLECTION_PROVIDER
+            = (HotSpotConstantReflectionProvider) JVMCI.getRuntime().getHostJVMCIBackend().getConstantReflection();
+    public static final JavaConstant DUMMY_CLASS_CONSTANT
+            = CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE);
+
+    public static final Map<ResolvedJavaField, JavaConstant> INSTANCE_FIELDS_MAP
+            = new HashMap<>();
+
+    static {
+        INSTANCE_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class, "booleanField"),
+                                JavaConstant.forBoolean(DUMMY_CLASS_INSTANCE.booleanField));
+        INSTANCE_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class, "byteField"),
+                                JavaConstant.forByte(DUMMY_CLASS_INSTANCE.byteField));
+        INSTANCE_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class, "shortField"),
+                                JavaConstant.forShort(DUMMY_CLASS_INSTANCE.shortField));
+        INSTANCE_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class, "charField"),
+                                JavaConstant.forChar(DUMMY_CLASS_INSTANCE.charField));
+        INSTANCE_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class, "intField"),
+                                JavaConstant.forInt(DUMMY_CLASS_INSTANCE.intField));
+        INSTANCE_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class, "longField"),
+                                JavaConstant.forLong(DUMMY_CLASS_INSTANCE.longField));
+        INSTANCE_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class, "floatField"),
+                                JavaConstant.forFloat(DUMMY_CLASS_INSTANCE.floatField));
+        INSTANCE_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class, "doubleField"),
+                                JavaConstant.forDouble(DUMMY_CLASS_INSTANCE.doubleField));
+        INSTANCE_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class, "objectField"),
+                                CONSTANT_REFLECTION_PROVIDER.forObject(
+                                        DUMMY_CLASS_INSTANCE.objectField));
+    }
+
+    public static final Map<ResolvedJavaField, JavaConstant> INSTANCE_FINAL_FIELDS_MAP
+            = new HashMap<>();
+
+    static {
+        INSTANCE_FINAL_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class, "finalBooleanField"),
+                                      JavaConstant.forBoolean(
+                                              DUMMY_CLASS_INSTANCE.finalBooleanField));
+        INSTANCE_FINAL_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class, "finalByteField"),
+                                      JavaConstant.forByte(DUMMY_CLASS_INSTANCE.finalByteField));
+        INSTANCE_FINAL_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class, "finalShortField"),
+                                      JavaConstant.forShort(DUMMY_CLASS_INSTANCE.finalShortField));
+        INSTANCE_FINAL_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class, "finalCharField"),
+                                      JavaConstant.forChar(DUMMY_CLASS_INSTANCE.finalCharField));
+        INSTANCE_FINAL_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class, "finalIntField"),
+                                      JavaConstant.forInt(DUMMY_CLASS_INSTANCE.finalIntField));
+        INSTANCE_FINAL_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class, "finalLongField"),
+                                      JavaConstant.forLong(DUMMY_CLASS_INSTANCE.finalLongField));
+        INSTANCE_FINAL_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class, "finalFloatField"),
+                                      JavaConstant.forFloat(DUMMY_CLASS_INSTANCE.finalFloatField));
+        INSTANCE_FINAL_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class, "finalDoubleField"),
+                                      JavaConstant.forDouble(
+                                              DUMMY_CLASS_INSTANCE.finalDoubleField));
+        INSTANCE_FINAL_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class, "finalObjectField"),
+                                      CONSTANT_REFLECTION_PROVIDER.forObject(
+                                              DUMMY_CLASS_INSTANCE.finalObjectField));
+    }
+
+    public static final Map<ResolvedJavaField, JavaConstant> INSTANCE_FINAL_DEFAULT_FIELDS_MAP
+            = new HashMap<>();
+
+    static {
+        INSTANCE_FINAL_DEFAULT_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class,
+                                                                   "finalDefaultBooleanField"),
+                                              JavaConstant.forBoolean(
+                                                      DUMMY_CLASS_INSTANCE.finalDefaultBooleanField));
+        INSTANCE_FINAL_DEFAULT_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class,
+                                                                   "finalDefaultByteField"),
+                                              JavaConstant.forByte(
+                                                      DUMMY_CLASS_INSTANCE.finalDefaultByteField));
+        INSTANCE_FINAL_DEFAULT_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class,
+                                                                   "finalDefaultShortField"),
+                                              JavaConstant.forShort(
+                                                      DUMMY_CLASS_INSTANCE.finalDefaultShortField));
+        INSTANCE_FINAL_DEFAULT_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class,
+                                                                   "finalDefaultCharField"),
+                                              JavaConstant.forChar(
+                                                      DUMMY_CLASS_INSTANCE.finalDefaultCharField));
+        INSTANCE_FINAL_DEFAULT_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class,
+                                                                   "finalDefaultIntField"),
+                                              JavaConstant.forInt(
+                                                      DUMMY_CLASS_INSTANCE.finalDefaultIntField));
+        INSTANCE_FINAL_DEFAULT_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class,
+                                                                   "finalDefaultLongField"),
+                                              JavaConstant.forLong(
+                                                      DUMMY_CLASS_INSTANCE.finalDefaultLongField));
+        INSTANCE_FINAL_DEFAULT_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class,
+                                                                   "finalDefaultFloatField"),
+                                              JavaConstant.forFloat(
+                                                      DUMMY_CLASS_INSTANCE.finalDefaultFloatField));
+        INSTANCE_FINAL_DEFAULT_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class,
+                                                                   "finalDefaultDoubleField"),
+                                              JavaConstant.forDouble(
+                                                      DUMMY_CLASS_INSTANCE.finalDefaultDoubleField));
+        INSTANCE_FINAL_DEFAULT_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class,
+                                                                   "finalDefaultObjectField"),
+                                              CONSTANT_REFLECTION_PROVIDER.forObject(
+                                                      DUMMY_CLASS_INSTANCE.finalDefaultObjectField));
+    }
+
+    public static final Map<ResolvedJavaField, JavaConstant> INSTANCE_STABLE_FIELDS_MAP
+            = new HashMap<>();
+
+    static {
+        INSTANCE_STABLE_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class, "stableBooleanField"),
+                                       JavaConstant.forBoolean(
+                                               DUMMY_CLASS_INSTANCE.stableBooleanField));
+        INSTANCE_STABLE_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class, "stableByteField"),
+                                       JavaConstant.forByte(DUMMY_CLASS_INSTANCE.stableByteField));
+        INSTANCE_STABLE_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class, "stableShortField"),
+                                       JavaConstant.forShort(
+                                               DUMMY_CLASS_INSTANCE.stableShortField));
+        INSTANCE_STABLE_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class, "stableCharField"),
+                                       JavaConstant.forChar(DUMMY_CLASS_INSTANCE.stableCharField));
+        INSTANCE_STABLE_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class, "stableIntField"),
+                                       JavaConstant.forInt(DUMMY_CLASS_INSTANCE.stableIntField));
+        INSTANCE_STABLE_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class, "stableLongField"),
+                                       JavaConstant.forLong(DUMMY_CLASS_INSTANCE.stableLongField));
+        INSTANCE_STABLE_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class, "stableFloatField"),
+                                       JavaConstant.forFloat(
+                                               DUMMY_CLASS_INSTANCE.stableFloatField));
+        INSTANCE_STABLE_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class, "stableDoubleField"),
+                                       JavaConstant.forDouble(
+                                               DUMMY_CLASS_INSTANCE.stableDoubleField));
+        INSTANCE_STABLE_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class, "stableObjectField"),
+                                       CONSTANT_REFLECTION_PROVIDER.forObject(
+                                               DUMMY_CLASS_INSTANCE.stableObjectField));
+    }
+
+    public static final Map<ResolvedJavaField, JavaConstant> INSTANCE_STABLE_DEFAULT_FIELDS_MAP
+            = new HashMap<>();
+
+    static {
+        INSTANCE_STABLE_DEFAULT_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class,
+                                                                    "stableDefaultBooleanField"),
+                                               JavaConstant.forBoolean(
+                                                       DUMMY_CLASS_INSTANCE.stableDefaultBooleanField));
+        INSTANCE_STABLE_DEFAULT_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class,
+                                                                    "stableDefaultByteField"),
+                                               JavaConstant.forByte(
+                                                       DUMMY_CLASS_INSTANCE.stableDefaultByteField));
+        INSTANCE_STABLE_DEFAULT_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class,
+                                                                    "stableDefaultShortField"),
+                                               JavaConstant.forShort(
+                                                       DUMMY_CLASS_INSTANCE.stableDefaultShortField));
+        INSTANCE_STABLE_DEFAULT_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class,
+                                                                    "stableDefaultCharField"),
+                                               JavaConstant.forChar(
+                                                       DUMMY_CLASS_INSTANCE.stableDefaultCharField));
+        INSTANCE_STABLE_DEFAULT_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class,
+                                                                    "stableDefaultIntField"),
+                                               JavaConstant.forInt(
+                                                       DUMMY_CLASS_INSTANCE.stableDefaultIntField));
+        INSTANCE_STABLE_DEFAULT_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class,
+                                                                    "stableDefaultLongField"),
+                                               JavaConstant.forLong(
+                                                       DUMMY_CLASS_INSTANCE.stableDefaultLongField));
+        INSTANCE_STABLE_DEFAULT_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class,
+                                                                    "stableDefaultFloatField"),
+                                               JavaConstant.forFloat(
+                                                       DUMMY_CLASS_INSTANCE.stableDefaultFloatField));
+        INSTANCE_STABLE_DEFAULT_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class,
+                                                                    "stableDefaultDoubleField"),
+                                               JavaConstant.forDouble(
+                                                       DUMMY_CLASS_INSTANCE.stableDefaultDoubleField));
+        INSTANCE_STABLE_DEFAULT_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class,
+                                                                    "stableDefaultObjectField"),
+                                               CONSTANT_REFLECTION_PROVIDER.forObject(
+                                                       DUMMY_CLASS_INSTANCE.stableDefaultObjectField));
+    }
+
+    public static final Map<ResolvedJavaField, JavaConstant> STATIC_FIELDS_MAP = new HashMap<>();
+
+    static {
+        STATIC_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class, "staticBooleanField"),
+                              JavaConstant.forBoolean(DummyClass.staticBooleanField));
+        STATIC_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class, "staticByteField"),
+                              JavaConstant.forByte(DummyClass.staticByteField));
+        STATIC_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class, "staticShortField"),
+                              JavaConstant.forShort(DummyClass.staticShortField));
+        STATIC_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class, "staticCharField"),
+                              JavaConstant.forChar(DummyClass.staticCharField));
+        STATIC_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class, "staticIntField"),
+                              JavaConstant.forInt(DummyClass.staticIntField));
+        STATIC_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class, "staticLongField"),
+                              JavaConstant.forLong(DummyClass.staticLongField));
+        STATIC_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class, "staticFloatField"),
+                              JavaConstant.forFloat(DummyClass.staticFloatField));
+        STATIC_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class, "staticDoubleField"),
+                              JavaConstant.forDouble(DummyClass.staticDoubleField));
+        STATIC_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class, "staticObjectField"),
+                              CONSTANT_REFLECTION_PROVIDER.forObject(DummyClass.staticObjectField));
+    }
+
+    public static final Map<ResolvedJavaField, JavaConstant> STATIC_FINAL_FIELDS_MAP
+            = new HashMap<>();
+
+    static {
+        STATIC_FINAL_FIELDS_MAP.put(
+                getResolvedJavaField(DummyClass.class, "staticFinalBooleanField"),
+                JavaConstant.forBoolean(DummyClass.staticFinalBooleanField));
+        STATIC_FINAL_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class, "staticFinalByteField"),
+                                    JavaConstant.forByte(DummyClass.staticFinalByteField));
+        STATIC_FINAL_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class, "staticFinalShortField"),
+                                    JavaConstant.forShort(DummyClass.staticFinalShortField));
+        STATIC_FINAL_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class, "staticFinalCharField"),
+                                    JavaConstant.forChar(DummyClass.staticFinalCharField));
+        STATIC_FINAL_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class, "staticFinalIntField"),
+                                    JavaConstant.forInt(DummyClass.staticFinalIntField));
+        STATIC_FINAL_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class, "staticFinalLongField"),
+                                    JavaConstant.forLong(DummyClass.staticFinalLongField));
+        STATIC_FINAL_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class, "staticFinalFloatField"),
+                                    JavaConstant.forFloat(DummyClass.staticFinalFloatField));
+        STATIC_FINAL_FIELDS_MAP.put(
+                getResolvedJavaField(DummyClass.class, "staticFinalDoubleField"),
+                JavaConstant.forDouble(DummyClass.staticFinalDoubleField));
+        STATIC_FINAL_FIELDS_MAP.put(
+                getResolvedJavaField(DummyClass.class, "staticFinalObjectField"),
+                CONSTANT_REFLECTION_PROVIDER.forObject(DummyClass.staticFinalObjectField));
+    }
+
+    public static final Map<ResolvedJavaField, JavaConstant> STATIC_STABLE_FIELDS_MAP
+            = new HashMap<>();
+
+    static {
+        STATIC_STABLE_FIELDS_MAP.put(
+                getResolvedJavaField(DummyClass.class, "staticStableBooleanField"),
+                JavaConstant.forBoolean(DummyClass.staticStableBooleanField));
+        STATIC_STABLE_FIELDS_MAP.put(
+                getResolvedJavaField(DummyClass.class, "staticStableByteField"),
+                JavaConstant.forByte(DummyClass.staticStableByteField));
+        STATIC_STABLE_FIELDS_MAP.put(
+                getResolvedJavaField(DummyClass.class, "staticStableShortField"),
+                JavaConstant.forShort(DummyClass.staticStableShortField));
+        STATIC_STABLE_FIELDS_MAP.put(
+                getResolvedJavaField(DummyClass.class, "staticStableCharField"),
+                JavaConstant.forChar(DummyClass.staticStableCharField));
+        STATIC_STABLE_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class, "staticStableIntField"),
+                                     JavaConstant.forInt(DummyClass.staticStableIntField));
+        STATIC_STABLE_FIELDS_MAP.put(
+                getResolvedJavaField(DummyClass.class, "staticStableLongField"),
+                JavaConstant.forLong(DummyClass.staticStableLongField));
+        STATIC_STABLE_FIELDS_MAP.put(
+                getResolvedJavaField(DummyClass.class, "staticStableFloatField"),
+                JavaConstant.forFloat(DummyClass.staticStableFloatField));
+        STATIC_STABLE_FIELDS_MAP.put(
+                getResolvedJavaField(DummyClass.class, "staticStableDoubleField"),
+                JavaConstant.forDouble(DummyClass.staticStableDoubleField));
+        STATIC_STABLE_FIELDS_MAP.put(
+                getResolvedJavaField(DummyClass.class, "staticStableObjectField"),
+                CONSTANT_REFLECTION_PROVIDER.forObject(DummyClass.staticStableObjectField));
+    }
+
+    public static final Map<ResolvedJavaField, JavaConstant> STATIC_STABLE_DEFAULT_FIELDS_MAP
+            = new HashMap<>();
+
+    static {
+        STATIC_STABLE_DEFAULT_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class,
+                                                                  "staticStableDefaultBooleanField"),
+                                             JavaConstant.forBoolean(
+                                                     DummyClass.staticStableDefaultBooleanField));
+        STATIC_STABLE_DEFAULT_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class,
+                                                                  "staticStableDefaultByteField"),
+                                             JavaConstant.forByte(
+                                                     DummyClass.staticStableDefaultByteField));
+        STATIC_STABLE_DEFAULT_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class,
+                                                                  "staticStableDefaultShortField"),
+                                             JavaConstant.forShort(
+                                                     DummyClass.staticStableDefaultShortField));
+        STATIC_STABLE_DEFAULT_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class,
+                                                                  "staticStableDefaultCharField"),
+                                             JavaConstant.forChar(
+                                                     DummyClass.staticStableDefaultCharField));
+        STATIC_STABLE_DEFAULT_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class,
+                                                                  "staticStableDefaultIntField"),
+                                             JavaConstant.forInt(
+                                                     DummyClass.staticStableDefaultIntField));
+        STATIC_STABLE_DEFAULT_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class,
+                                                                  "staticStableDefaultLongField"),
+                                             JavaConstant.forLong(
+                                                     DummyClass.staticStableDefaultLongField));
+        STATIC_STABLE_DEFAULT_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class,
+                                                                  "staticStableDefaultFloatField"),
+                                             JavaConstant.forFloat(
+                                                     DummyClass.staticStableDefaultFloatField));
+        STATIC_STABLE_DEFAULT_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class,
+                                                                  "staticStableDefaultDoubleField"),
+                                             JavaConstant.forDouble(
+                                                     DummyClass.staticStableDefaultDoubleField));
+        STATIC_STABLE_DEFAULT_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class,
+                                                                  "staticStableDefaultObjectField"),
+                                             CONSTANT_REFLECTION_PROVIDER.forObject(
+                                                     DummyClass.staticStableDefaultObjectField));
+    }
+
+    public static final int ARRAY_DIMENSION = 1;
+    public static final int ARRAY_OF_ARRAYS_DIMENSION = 2;
+
+    public static final Map<ResolvedJavaField, JavaConstant> ARRAYS_MAP = new HashMap<>();
+
+    static {
+        ARRAYS_MAP.put(getResolvedJavaField(DummyClass.class, "booleanArrayWithValues"),
+                       CONSTANT_REFLECTION_PROVIDER.forObject(
+                               DUMMY_CLASS_INSTANCE.booleanArrayWithValues));
+        ARRAYS_MAP.put(getResolvedJavaField(DummyClass.class, "byteArrayWithValues"),
+                       CONSTANT_REFLECTION_PROVIDER.forObject(
+                               DUMMY_CLASS_INSTANCE.byteArrayWithValues));
+        ARRAYS_MAP.put(getResolvedJavaField(DummyClass.class, "shortArrayWithValues"),
+                       CONSTANT_REFLECTION_PROVIDER.forObject(
+                               DUMMY_CLASS_INSTANCE.shortArrayWithValues));
+        ARRAYS_MAP.put(getResolvedJavaField(DummyClass.class, "charArrayWithValues"),
+                       CONSTANT_REFLECTION_PROVIDER.forObject(
+                               DUMMY_CLASS_INSTANCE.charArrayWithValues));
+        ARRAYS_MAP.put(getResolvedJavaField(DummyClass.class, "intArrayWithValues"),
+                       CONSTANT_REFLECTION_PROVIDER.forObject(
+                               DUMMY_CLASS_INSTANCE.intArrayWithValues));
+        ARRAYS_MAP.put(getResolvedJavaField(DummyClass.class, "longArrayWithValues"),
+                       CONSTANT_REFLECTION_PROVIDER.forObject(
+                               DUMMY_CLASS_INSTANCE.longArrayWithValues));
+        ARRAYS_MAP.put(getResolvedJavaField(DummyClass.class, "floatArrayWithValues"),
+                       CONSTANT_REFLECTION_PROVIDER.forObject(
+                               DUMMY_CLASS_INSTANCE.floatArrayWithValues));
+        ARRAYS_MAP.put(getResolvedJavaField(DummyClass.class, "doubleArrayWithValues"),
+                       CONSTANT_REFLECTION_PROVIDER.forObject(
+                               DUMMY_CLASS_INSTANCE.doubleArrayWithValues));
+        ARRAYS_MAP.put(getResolvedJavaField(DummyClass.class, "objectArrayWithValues"),
+                       CONSTANT_REFLECTION_PROVIDER.forObject(
+                               DUMMY_CLASS_INSTANCE.objectArrayWithValues));
+    }
+
+    public static final Map<ResolvedJavaField, JavaConstant> STABLE_ARRAYS_MAP = new HashMap<>();
+
+    static {
+        STABLE_ARRAYS_MAP.put(
+                getResolvedJavaField(DummyClass.class, "stableBooleanArrayWithValues"),
+                CONSTANT_REFLECTION_PROVIDER.forObject(
+                        DUMMY_CLASS_INSTANCE.stableBooleanArrayWithValues));
+        STABLE_ARRAYS_MAP.put(getResolvedJavaField(DummyClass.class, "stableByteArrayWithValues"),
+                              CONSTANT_REFLECTION_PROVIDER.forObject(
+                                      DUMMY_CLASS_INSTANCE.stableByteArrayWithValues));
+        STABLE_ARRAYS_MAP.put(getResolvedJavaField(DummyClass.class, "stableShortArrayWithValues"),
+                              CONSTANT_REFLECTION_PROVIDER.forObject(
+                                      DUMMY_CLASS_INSTANCE.stableShortArrayWithValues));
+        STABLE_ARRAYS_MAP.put(getResolvedJavaField(DummyClass.class, "stableCharArrayWithValues"),
+                              CONSTANT_REFLECTION_PROVIDER.forObject(
+                                      DUMMY_CLASS_INSTANCE.stableCharArrayWithValues));
+        STABLE_ARRAYS_MAP.put(getResolvedJavaField(DummyClass.class, "stableIntArrayWithValues"),
+                              CONSTANT_REFLECTION_PROVIDER.forObject(
+                                      DUMMY_CLASS_INSTANCE.stableIntArrayWithValues));
+        STABLE_ARRAYS_MAP.put(getResolvedJavaField(DummyClass.class, "stableLongArrayWithValues"),
+                              CONSTANT_REFLECTION_PROVIDER.forObject(
+                                      DUMMY_CLASS_INSTANCE.stableLongArrayWithValues));
+        STABLE_ARRAYS_MAP.put(getResolvedJavaField(DummyClass.class, "stableFloatArrayWithValues"),
+                              CONSTANT_REFLECTION_PROVIDER.forObject(
+                                      DUMMY_CLASS_INSTANCE.stableFloatArrayWithValues));
+        STABLE_ARRAYS_MAP.put(getResolvedJavaField(DummyClass.class, "stableDoubleArrayWithValues"),
+                              CONSTANT_REFLECTION_PROVIDER.forObject(
+                                      DUMMY_CLASS_INSTANCE.stableDoubleArrayWithValues));
+        STABLE_ARRAYS_MAP.put(getResolvedJavaField(DummyClass.class, "stableObjectArrayWithValues"),
+                              CONSTANT_REFLECTION_PROVIDER.forObject(
+                                      DUMMY_CLASS_INSTANCE.stableObjectArrayWithValues));
+    }
+
+    public static final Map<ResolvedJavaField, JavaConstant> ARRAY_ARRAYS_MAP = new HashMap<>();
+
+    static {
+        ARRAY_ARRAYS_MAP.put(getResolvedJavaField(DummyClass.class, "booleanArrayArrayWithValues"),
+                             CONSTANT_REFLECTION_PROVIDER.forObject(
+                                     DUMMY_CLASS_INSTANCE.booleanArrayArrayWithValues));
+        ARRAY_ARRAYS_MAP.put(getResolvedJavaField(DummyClass.class, "byteArrayArrayWithValues"),
+                             CONSTANT_REFLECTION_PROVIDER.forObject(
+                                     DUMMY_CLASS_INSTANCE.byteArrayArrayWithValues));
+        ARRAY_ARRAYS_MAP.put(getResolvedJavaField(DummyClass.class, "shortArrayArrayWithValues"),
+                             CONSTANT_REFLECTION_PROVIDER.forObject(
+                                     DUMMY_CLASS_INSTANCE.shortArrayArrayWithValues));
+        ARRAY_ARRAYS_MAP.put(getResolvedJavaField(DummyClass.class, "charArrayArrayWithValues"),
+                             CONSTANT_REFLECTION_PROVIDER.forObject(
+                                     DUMMY_CLASS_INSTANCE.charArrayArrayWithValues));
+        ARRAY_ARRAYS_MAP.put(getResolvedJavaField(DummyClass.class, "intArrayArrayWithValues"),
+                             CONSTANT_REFLECTION_PROVIDER.forObject(
+                                     DUMMY_CLASS_INSTANCE.intArrayArrayWithValues));
+        ARRAY_ARRAYS_MAP.put(getResolvedJavaField(DummyClass.class, "longArrayArrayWithValues"),
+                             CONSTANT_REFLECTION_PROVIDER.forObject(
+                                     DUMMY_CLASS_INSTANCE.longArrayArrayWithValues));
+        ARRAY_ARRAYS_MAP.put(getResolvedJavaField(DummyClass.class, "floatArrayArrayWithValues"),
+                             CONSTANT_REFLECTION_PROVIDER.forObject(
+                                     DUMMY_CLASS_INSTANCE.floatArrayArrayWithValues));
+        ARRAY_ARRAYS_MAP.put(getResolvedJavaField(DummyClass.class, "doubleArrayArrayWithValues"),
+                             CONSTANT_REFLECTION_PROVIDER.forObject(
+                                     DUMMY_CLASS_INSTANCE.doubleArrayArrayWithValues));
+        ARRAY_ARRAYS_MAP.put(getResolvedJavaField(DummyClass.class, "objectArrayArrayWithValues"),
+                             CONSTANT_REFLECTION_PROVIDER.forObject(
+                                     DUMMY_CLASS_INSTANCE.objectArrayArrayWithValues));
+    }
+
+    public static final Map<ResolvedJavaField, JavaConstant> STABLE_ARRAY_ARRAYS_MAP = new HashMap<>();
+
+    static {
+        STABLE_ARRAY_ARRAYS_MAP.put(
+                getResolvedJavaField(DummyClass.class, "stableBooleanArrayArrayWithValues"),
+                CONSTANT_REFLECTION_PROVIDER.forObject(
+                        DUMMY_CLASS_INSTANCE.stableBooleanArrayArrayWithValues));
+        STABLE_ARRAY_ARRAYS_MAP.put(
+                getResolvedJavaField(DummyClass.class, "stableByteArrayArrayWithValues"),
+                CONSTANT_REFLECTION_PROVIDER.forObject(
+                        DUMMY_CLASS_INSTANCE.stableByteArrayArrayWithValues));
+        STABLE_ARRAY_ARRAYS_MAP.put(
+                getResolvedJavaField(DummyClass.class, "stableShortArrayArrayWithValues"),
+                CONSTANT_REFLECTION_PROVIDER.forObject(
+                        DUMMY_CLASS_INSTANCE.stableShortArrayArrayWithValues));
+        STABLE_ARRAY_ARRAYS_MAP.put(
+                getResolvedJavaField(DummyClass.class, "stableCharArrayArrayWithValues"),
+                CONSTANT_REFLECTION_PROVIDER.forObject(
+                        DUMMY_CLASS_INSTANCE.stableCharArrayArrayWithValues));
+        STABLE_ARRAY_ARRAYS_MAP.put(
+                getResolvedJavaField(DummyClass.class, "stableIntArrayArrayWithValues"),
+                CONSTANT_REFLECTION_PROVIDER.forObject(
+                        DUMMY_CLASS_INSTANCE.stableIntArrayArrayWithValues));
+        STABLE_ARRAY_ARRAYS_MAP.put(
+                getResolvedJavaField(DummyClass.class, "stableLongArrayArrayWithValues"),
+                CONSTANT_REFLECTION_PROVIDER.forObject(
+                        DUMMY_CLASS_INSTANCE.stableLongArrayArrayWithValues));
+        STABLE_ARRAY_ARRAYS_MAP.put(
+                getResolvedJavaField(DummyClass.class, "stableFloatArrayArrayWithValues"),
+                CONSTANT_REFLECTION_PROVIDER.forObject(
+                        DUMMY_CLASS_INSTANCE.stableFloatArrayArrayWithValues));
+        STABLE_ARRAY_ARRAYS_MAP.put(
+                getResolvedJavaField(DummyClass.class, "stableDoubleArrayArrayWithValues"),
+                CONSTANT_REFLECTION_PROVIDER.forObject(
+                        DUMMY_CLASS_INSTANCE.stableDoubleArrayArrayWithValues));
+        STABLE_ARRAY_ARRAYS_MAP.put(
+                getResolvedJavaField(DummyClass.class, "stableObjectArrayArrayWithValues"),
+                CONSTANT_REFLECTION_PROVIDER.forObject(
+                        DUMMY_CLASS_INSTANCE.stableObjectArrayArrayWithValues));
+    }
+
+    public static ResolvedJavaField getResolvedJavaField(Class<?> clazz, String fieldName) {
+        Field reflectionField = null;
+        try {
+            reflectionField = clazz.getDeclaredField(fieldName);
+            reflectionField.setAccessible(true);
+        } catch (NoSuchFieldException ex) {
+            throw new Error("Test bug: Invalid field name: " + ex, ex);
+        } catch (SecurityException ex) {
+            throw new Error("Unexpected error: " + ex, ex);
+        }
+        MetaAccessProvider metaAccess = JVMCI.getRuntime().getHostJVMCIBackend().getMetaAccess();
+        return metaAccess.lookupJavaField(reflectionField);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/UnboxPrimitiveDataProvider.java	Fri Mar 25 14:46:09 2016 +0300
@@ -0,0 +1,100 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.vm.ci.hotspot.test;
+
+import static jdk.vm.ci.hotspot.test.TestHelper.CONSTANT_REFLECTION_PROVIDER;
+import static jdk.vm.ci.hotspot.test.TestHelper.DUMMY_CLASS_INSTANCE;
+
+import java.util.LinkedList;
+
+import jdk.vm.ci.meta.JavaConstant;
+import org.testng.annotations.DataProvider;
+
+public class UnboxPrimitiveDataProvider {
+
+    @DataProvider(name = "unboxPrimitiveDataProvider")
+    public static Object[][] unboxPrimitiveDataProvider() {
+        LinkedList<Object[]> cfgSet = new LinkedList<>();
+        // Testing boolean
+        cfgSet.add(new Object[]{CONSTANT_REFLECTION_PROVIDER.forObject(
+                (Boolean) true), JavaConstant.forBoolean(true)});
+        cfgSet.add(new Object[]{JavaConstant.forBoolean(true), null});
+        cfgSet.add(new Object[]{CONSTANT_REFLECTION_PROVIDER.forObject((Boolean) false),
+                JavaConstant.forBoolean(false)});
+        cfgSet.add(new Object[]{JavaConstant.forBoolean(false), null});
+        for (byte number : new byte[]{-128, 0, 1, 127}) {
+            // Testing boxed primitives
+            cfgSet.add(new Object[]{CONSTANT_REFLECTION_PROVIDER.forObject(Byte.valueOf(number)),
+                    JavaConstant.forByte(number)});
+            cfgSet.add(new Object[]{CONSTANT_REFLECTION_PROVIDER.forObject(Short.valueOf(number)),
+                    JavaConstant.forShort(number)});
+            cfgSet.add(new Object[]{CONSTANT_REFLECTION_PROVIDER.forObject(Integer.valueOf(number)),
+                    JavaConstant.forInt(number)});
+            cfgSet.add(new Object[]{CONSTANT_REFLECTION_PROVIDER.forObject(Long.valueOf(number)),
+                    JavaConstant.forLong(number)});
+            if (number >= 0) {
+                cfgSet.add(new Object[]{CONSTANT_REFLECTION_PROVIDER.forObject(
+                        Character.valueOf((char) number)),
+                        JavaConstant.forChar((char) number)});
+            }
+            cfgSet.add(new Object[]{CONSTANT_REFLECTION_PROVIDER.forObject(
+                    Float.valueOf(number * 1.1f)),
+                    JavaConstant.forFloat(number * 1.1f)});
+            cfgSet.add(new Object[]{CONSTANT_REFLECTION_PROVIDER.forObject(
+                    Double.valueOf(number * 1.1)),
+                    JavaConstant.forDouble(number * 1.1)});
+            // Testing non-boxed primitives (should result in returning of "null")
+            cfgSet.add(new Object[]{JavaConstant.forByte(number), null});
+            cfgSet.add(new Object[]{JavaConstant.forShort(number), null});
+            cfgSet.add(new Object[]{JavaConstant.forInt(number), null});
+            cfgSet.add(new Object[]{JavaConstant.forLong(number), null});
+            cfgSet.add(new Object[]{JavaConstant.forChar((char) number), null});
+            cfgSet.add(new Object[]{JavaConstant.forFloat(number), null});
+            cfgSet.add(new Object[]{JavaConstant.forDouble(number), null});
+        }
+        // Testing boxed primitives with max values
+        cfgSet.add(new Object[]{CONSTANT_REFLECTION_PROVIDER.forObject(Short.MAX_VALUE),
+                JavaConstant.forShort(Short.MAX_VALUE)});
+        cfgSet.add(new Object[]{CONSTANT_REFLECTION_PROVIDER.forObject(Integer.MAX_VALUE),
+                JavaConstant.forInt(Integer.MAX_VALUE)});
+        cfgSet.add(new Object[]{CONSTANT_REFLECTION_PROVIDER.forObject(Long.MAX_VALUE),
+                JavaConstant.forLong(Long.MAX_VALUE)});
+        cfgSet.add(new Object[]{CONSTANT_REFLECTION_PROVIDER.forObject(Character.MAX_VALUE),
+                JavaConstant.forChar(Character.MAX_VALUE)});
+        cfgSet.add(new Object[]{CONSTANT_REFLECTION_PROVIDER.forObject(Float.MAX_VALUE),
+                JavaConstant.forFloat(Float.MAX_VALUE)});
+        cfgSet.add(new Object[]{CONSTANT_REFLECTION_PROVIDER.forObject(Double.MAX_VALUE),
+                JavaConstant.forDouble(Double.MAX_VALUE)});
+        // Non-primitives testing
+        cfgSet.add(new Object[]{CONSTANT_REFLECTION_PROVIDER.forObject(
+                DUMMY_CLASS_INSTANCE.objectField), null});
+        cfgSet.add(new Object[]{CONSTANT_REFLECTION_PROVIDER.forObject(
+                DUMMY_CLASS_INSTANCE.booleanArrayWithValues),
+                null});
+        // Null testing
+        cfgSet.add(new Object[]{JavaConstant.NULL_POINTER, null});
+        cfgSet.add(new Object[]{null, null});
+        return cfgSet.toArray(new Object[0][0]);
+    }
+}