changeset 39251:a691c50d2b16

8157428: [JVMCI] remove MemoryAccessProvider.readUnsafeConstant from API Reviewed-by: iveresov
author rschatz
date Tue, 31 May 2016 20:43:12 +0000
parents c84204ee784b
children a3644fa2b8b4
files hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMemoryAccessProviderImpl.java hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/MemoryAccessProvider.java hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/MemoryAccessProviderTest.java
diffstat 3 files changed, 12 insertions(+), 35 deletions(-) [+]
line wrap: on
line diff
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMemoryAccessProviderImpl.java	Tue May 31 17:51:42 2016 +0000
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMemoryAccessProviderImpl.java	Tue May 31 20:43:12 2016 +0000
@@ -144,8 +144,18 @@
         return ret;
     }
 
-    @Override
-    public JavaConstant readUnsafeConstant(JavaKind kind, JavaConstant baseConstant, long displacement) {
+    /**
+     * Reads a value of this kind using a base address and a displacement. No bounds checking or
+     * type checking is performed. Returns {@code null} if the value is not available at this point.
+     *
+     * @param baseConstant the base address from which the value is read.
+     * @param displacement the displacement within the object in bytes
+     * @return the read value encapsulated in a {@link JavaConstant} object, or {@code null} if the
+     *         value cannot be read.
+     * @throws IllegalArgumentException if {@code kind} is {@code null}, {@link JavaKind#Void}, not
+     *             {@link JavaKind#Object} or not {@linkplain JavaKind#isPrimitive() primitive} kind
+     */
+    JavaConstant readUnsafeConstant(JavaKind kind, JavaConstant baseConstant, long displacement) {
         if (kind == null) {
             throw new IllegalArgumentException("null JavaKind");
         }
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/MemoryAccessProvider.java	Tue May 31 17:51:42 2016 +0000
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/MemoryAccessProvider.java	Tue May 31 20:43:12 2016 +0000
@@ -28,19 +28,6 @@
 public interface MemoryAccessProvider {
 
     /**
-     * Reads a value of this kind using a base address and a displacement. No bounds checking or
-     * type checking is performed. Returns {@code null} if the value is not available at this point.
-     *
-     * @param base the base address from which the value is read.
-     * @param displacement the displacement within the object in bytes
-     * @return the read value encapsulated in a {@link JavaConstant} object, or {@code null} if the
-     *         value cannot be read.
-     * @throws IllegalArgumentException if {@code kind} is {@code null}, {@link JavaKind#Void}, not
-     *             {@link JavaKind#Object} or not {@linkplain JavaKind#isPrimitive() primitive} kind
-     */
-    JavaConstant readUnsafeConstant(JavaKind kind, JavaConstant base, long displacement) throws IllegalArgumentException;
-
-    /**
      * Reads a primitive value using a base address and a displacement.
      *
      * @param kind the {@link JavaKind} of the returned {@link JavaConstant} object
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/MemoryAccessProviderTest.java	Tue May 31 17:51:42 2016 +0000
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/MemoryAccessProviderTest.java	Tue May 31 20:43:12 2016 +0000
@@ -49,26 +49,6 @@
     private static final MemoryAccessProvider PROVIDER = JVMCI.getRuntime().getHostJVMCIBackend().getConstantReflection().getMemoryAccessProvider();
 
     @Test(dataProvider = "positivePrimitive", dataProviderClass = MemoryAccessProviderData.class)
-    public void testPositiveReadUnsafeConstant(JavaKind kind, JavaConstant base, Long offset, Object expected, int bitsCount) {
-        Assert.assertEquals(PROVIDER.readUnsafeConstant(kind, base, offset), expected, "Failed to read constant");
-    }
-
-    @Test(dataProvider = "positivePrimitive", dataProviderClass = MemoryAccessProviderData.class, expectedExceptions = {IllegalArgumentException.class})
-    public void testReadUnsafeConstantNullBase(JavaKind kind, JavaConstant base, Long offset, Object expected, int bitsCount) {
-        PROVIDER.readUnsafeConstant(kind, null, offset);
-    }
-
-    @Test(dataProvider = "positivePrimitive", dataProviderClass = MemoryAccessProviderData.class, expectedExceptions = {IllegalArgumentException.class})
-    public void testNegativeReadUnsafeConstantNullKind(JavaKind kind, JavaConstant base, Long offset, Object expected, int bitsCount) {
-        Assert.assertNull(PROVIDER.readUnsafeConstant(null, base, offset), "Expected null return");
-    }
-
-    @Test(dataProvider = "negative", dataProviderClass = MemoryAccessProviderData.class, expectedExceptions = {IllegalArgumentException.class})
-    public void testNegativeReadUnsafeConstant(JavaKind kind, JavaConstant base) {
-        PROVIDER.readUnsafeConstant(kind, base, 0L);
-    }
-
-    @Test(dataProvider = "positivePrimitive", dataProviderClass = MemoryAccessProviderData.class)
     public void testPositiveReadPrimitiveConstant(JavaKind kind, Constant base, Long offset, Object expected, int bitsCount) {
         Assert.assertEquals(PROVIDER.readPrimitiveConstant(kind, base, offset, bitsCount), expected, "Failed to read constant");
     }