changeset 50727:d72fb500b553 condy-folding

manual merge with jep-334
author vromero
date Wed, 23 May 2018 09:13:50 -0700
parents 145a09d60b39 c97d728ea327
children acd4969ec1f8
files src/java.base/share/classes/java/lang/Class.java src/java.base/share/classes/java/lang/Double.java src/java.base/share/classes/java/lang/Enum.java src/java.base/share/classes/java/lang/Float.java src/java.base/share/classes/java/lang/Integer.java src/java.base/share/classes/java/lang/Long.java src/java.base/share/classes/java/lang/String.java src/java.base/share/classes/java/lang/invoke/MethodHandle.java src/java.base/share/classes/java/lang/invoke/MethodType.java src/java.base/share/classes/java/lang/invoke/VarHandle.java src/java.base/share/classes/java/lang/invoke/X-VarHandle.java.template src/java.base/share/classes/java/lang/invoke/X-VarHandleByteArrayView.java.template src/java.base/share/classes/java/lang/invoke/constant/AsTypeMethodHandleDesc.java src/java.base/share/classes/java/lang/invoke/constant/ClassDesc.java src/java.base/share/classes/java/lang/invoke/constant/Constable.java src/java.base/share/classes/java/lang/invoke/constant/ConstantClassDesc.java src/java.base/share/classes/java/lang/invoke/constant/ConstantDesc.java src/java.base/share/classes/java/lang/invoke/constant/ConstantDescs.java src/java.base/share/classes/java/lang/invoke/constant/ConstantMethodHandleDesc.java src/java.base/share/classes/java/lang/invoke/constant/ConstantMethodTypeDesc.java src/java.base/share/classes/java/lang/invoke/constant/ConstantUtils.java src/java.base/share/classes/java/lang/invoke/constant/DynamicCallSiteDesc.java src/java.base/share/classes/java/lang/invoke/constant/DynamicConstantDesc.java src/java.base/share/classes/java/lang/invoke/constant/EnumDesc.java src/java.base/share/classes/java/lang/invoke/constant/MethodHandleDesc.java src/java.base/share/classes/java/lang/invoke/constant/MethodTypeDesc.java src/java.base/share/classes/java/lang/invoke/constant/PrimitiveClassDesc.java src/java.base/share/classes/java/lang/invoke/constant/VarHandleDesc.java src/java.base/share/classes/java/lang/invoke/constant/package-info.java src/java.base/share/classes/module-info.java test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessBoolean.java test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessByte.java test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessChar.java test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessDouble.java test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessFloat.java test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessInt.java test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessLong.java test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessShort.java test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessString.java test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsChar.java test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsDouble.java test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsFloat.java test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsInt.java test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsLong.java test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsShort.java test/jdk/java/lang/invoke/VarHandles/X-VarHandleTestAccess.java.template test/jdk/java/lang/invoke/VarHandles/X-VarHandleTestByteArrayView.java.template test/jdk/java/lang/invoke/constant/ClassRefTest.java test/jdk/java/lang/invoke/constant/CondyRefTest.java test/jdk/java/lang/invoke/constant/MethodHandleRefTest.java test/jdk/java/lang/invoke/constant/MethodTypeRefTest.java test/jdk/java/lang/invoke/constant/SymbolicRefTest.java
diffstat 8 files changed, 280 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessBoolean.java	Wed May 23 07:50:48 2018 -0700
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessBoolean.java	Wed May 23 09:13:50 2018 -0700
@@ -103,6 +103,41 @@
         return vhs.toArray(new VarHandle[0]);
     }
 
+    VarHandle[] allocate(boolean same) {
+        List<VarHandle> vhs = new ArrayList<>();
+
+        String postfix = same ? "" : "2";
+        VarHandle vh;
+        try {
+            vh = MethodHandles.lookup().findVarHandle(
+                    VarHandleTestAccessBoolean.class, "final_v" + postfix, boolean.class);
+            vhs.add(vh);
+
+            vh = MethodHandles.lookup().findVarHandle(
+                    VarHandleTestAccessBoolean.class, "v" + postfix, boolean.class);
+            vhs.add(vh);
+
+            vh = MethodHandles.lookup().findStaticVarHandle(
+                VarHandleTestAccessBoolean.class, "static_final_v" + postfix, boolean.class);
+            vhs.add(vh);
+
+            vh = MethodHandles.lookup().findStaticVarHandle(
+                VarHandleTestAccessBoolean.class, "static_v" + postfix, boolean.class);
+            vhs.add(vh);
+
+            if (same) {
+                vh = MethodHandles.arrayElementVarHandle(boolean[].class);
+            }
+            else {
+                vh = MethodHandles.arrayElementVarHandle(String[].class);
+            }
+            vhs.add(vh);
+        } catch (Exception e) {
+            throw new InternalError(e);
+        }
+        return vhs.toArray(new VarHandle[0]);
+    }
+
     @BeforeClass
     public void setup() throws Exception {
         vhFinalField = MethodHandles.lookup().findVarHandle(
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessByte.java	Wed May 23 07:50:48 2018 -0700
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessByte.java	Wed May 23 09:13:50 2018 -0700
@@ -103,6 +103,41 @@
         return vhs.toArray(new VarHandle[0]);
     }
 
+    VarHandle[] allocate(boolean same) {
+        List<VarHandle> vhs = new ArrayList<>();
+
+        String postfix = same ? "" : "2";
+        VarHandle vh;
+        try {
+            vh = MethodHandles.lookup().findVarHandle(
+                    VarHandleTestAccessByte.class, "final_v" + postfix, byte.class);
+            vhs.add(vh);
+
+            vh = MethodHandles.lookup().findVarHandle(
+                    VarHandleTestAccessByte.class, "v" + postfix, byte.class);
+            vhs.add(vh);
+
+            vh = MethodHandles.lookup().findStaticVarHandle(
+                VarHandleTestAccessByte.class, "static_final_v" + postfix, byte.class);
+            vhs.add(vh);
+
+            vh = MethodHandles.lookup().findStaticVarHandle(
+                VarHandleTestAccessByte.class, "static_v" + postfix, byte.class);
+            vhs.add(vh);
+
+            if (same) {
+                vh = MethodHandles.arrayElementVarHandle(byte[].class);
+            }
+            else {
+                vh = MethodHandles.arrayElementVarHandle(String[].class);
+            }
+            vhs.add(vh);
+        } catch (Exception e) {
+            throw new InternalError(e);
+        }
+        return vhs.toArray(new VarHandle[0]);
+    }
+
     @BeforeClass
     public void setup() throws Exception {
         vhFinalField = MethodHandles.lookup().findVarHandle(
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessChar.java	Wed May 23 07:50:48 2018 -0700
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessChar.java	Wed May 23 09:13:50 2018 -0700
@@ -103,6 +103,41 @@
         return vhs.toArray(new VarHandle[0]);
     }
 
+    VarHandle[] allocate(boolean same) {
+        List<VarHandle> vhs = new ArrayList<>();
+
+        String postfix = same ? "" : "2";
+        VarHandle vh;
+        try {
+            vh = MethodHandles.lookup().findVarHandle(
+                    VarHandleTestAccessChar.class, "final_v" + postfix, char.class);
+            vhs.add(vh);
+
+            vh = MethodHandles.lookup().findVarHandle(
+                    VarHandleTestAccessChar.class, "v" + postfix, char.class);
+            vhs.add(vh);
+
+            vh = MethodHandles.lookup().findStaticVarHandle(
+                VarHandleTestAccessChar.class, "static_final_v" + postfix, char.class);
+            vhs.add(vh);
+
+            vh = MethodHandles.lookup().findStaticVarHandle(
+                VarHandleTestAccessChar.class, "static_v" + postfix, char.class);
+            vhs.add(vh);
+
+            if (same) {
+                vh = MethodHandles.arrayElementVarHandle(char[].class);
+            }
+            else {
+                vh = MethodHandles.arrayElementVarHandle(String[].class);
+            }
+            vhs.add(vh);
+        } catch (Exception e) {
+            throw new InternalError(e);
+        }
+        return vhs.toArray(new VarHandle[0]);
+    }
+
     @BeforeClass
     public void setup() throws Exception {
         vhFinalField = MethodHandles.lookup().findVarHandle(
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessDouble.java	Wed May 23 07:50:48 2018 -0700
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessDouble.java	Wed May 23 09:13:50 2018 -0700
@@ -103,6 +103,41 @@
         return vhs.toArray(new VarHandle[0]);
     }
 
+    VarHandle[] allocate(boolean same) {
+        List<VarHandle> vhs = new ArrayList<>();
+
+        String postfix = same ? "" : "2";
+        VarHandle vh;
+        try {
+            vh = MethodHandles.lookup().findVarHandle(
+                    VarHandleTestAccessDouble.class, "final_v" + postfix, double.class);
+            vhs.add(vh);
+
+            vh = MethodHandles.lookup().findVarHandle(
+                    VarHandleTestAccessDouble.class, "v" + postfix, double.class);
+            vhs.add(vh);
+
+            vh = MethodHandles.lookup().findStaticVarHandle(
+                VarHandleTestAccessDouble.class, "static_final_v" + postfix, double.class);
+            vhs.add(vh);
+
+            vh = MethodHandles.lookup().findStaticVarHandle(
+                VarHandleTestAccessDouble.class, "static_v" + postfix, double.class);
+            vhs.add(vh);
+
+            if (same) {
+                vh = MethodHandles.arrayElementVarHandle(double[].class);
+            }
+            else {
+                vh = MethodHandles.arrayElementVarHandle(String[].class);
+            }
+            vhs.add(vh);
+        } catch (Exception e) {
+            throw new InternalError(e);
+        }
+        return vhs.toArray(new VarHandle[0]);
+    }
+
     @BeforeClass
     public void setup() throws Exception {
         vhFinalField = MethodHandles.lookup().findVarHandle(
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessFloat.java	Wed May 23 07:50:48 2018 -0700
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessFloat.java	Wed May 23 09:13:50 2018 -0700
@@ -103,6 +103,41 @@
         return vhs.toArray(new VarHandle[0]);
     }
 
+    VarHandle[] allocate(boolean same) {
+        List<VarHandle> vhs = new ArrayList<>();
+
+        String postfix = same ? "" : "2";
+        VarHandle vh;
+        try {
+            vh = MethodHandles.lookup().findVarHandle(
+                    VarHandleTestAccessFloat.class, "final_v" + postfix, float.class);
+            vhs.add(vh);
+
+            vh = MethodHandles.lookup().findVarHandle(
+                    VarHandleTestAccessFloat.class, "v" + postfix, float.class);
+            vhs.add(vh);
+
+            vh = MethodHandles.lookup().findStaticVarHandle(
+                VarHandleTestAccessFloat.class, "static_final_v" + postfix, float.class);
+            vhs.add(vh);
+
+            vh = MethodHandles.lookup().findStaticVarHandle(
+                VarHandleTestAccessFloat.class, "static_v" + postfix, float.class);
+            vhs.add(vh);
+
+            if (same) {
+                vh = MethodHandles.arrayElementVarHandle(float[].class);
+            }
+            else {
+                vh = MethodHandles.arrayElementVarHandle(String[].class);
+            }
+            vhs.add(vh);
+        } catch (Exception e) {
+            throw new InternalError(e);
+        }
+        return vhs.toArray(new VarHandle[0]);
+    }
+
     @BeforeClass
     public void setup() throws Exception {
         vhFinalField = MethodHandles.lookup().findVarHandle(
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessInt.java	Wed May 23 07:50:48 2018 -0700
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessInt.java	Wed May 23 09:13:50 2018 -0700
@@ -103,6 +103,41 @@
         return vhs.toArray(new VarHandle[0]);
     }
 
+    VarHandle[] allocate(boolean same) {
+        List<VarHandle> vhs = new ArrayList<>();
+
+        String postfix = same ? "" : "2";
+        VarHandle vh;
+        try {
+            vh = MethodHandles.lookup().findVarHandle(
+                    VarHandleTestAccessInt.class, "final_v" + postfix, int.class);
+            vhs.add(vh);
+
+            vh = MethodHandles.lookup().findVarHandle(
+                    VarHandleTestAccessInt.class, "v" + postfix, int.class);
+            vhs.add(vh);
+
+            vh = MethodHandles.lookup().findStaticVarHandle(
+                VarHandleTestAccessInt.class, "static_final_v" + postfix, int.class);
+            vhs.add(vh);
+
+            vh = MethodHandles.lookup().findStaticVarHandle(
+                VarHandleTestAccessInt.class, "static_v" + postfix, int.class);
+            vhs.add(vh);
+
+            if (same) {
+                vh = MethodHandles.arrayElementVarHandle(int[].class);
+            }
+            else {
+                vh = MethodHandles.arrayElementVarHandle(String[].class);
+            }
+            vhs.add(vh);
+        } catch (Exception e) {
+            throw new InternalError(e);
+        }
+        return vhs.toArray(new VarHandle[0]);
+    }
+
     @BeforeClass
     public void setup() throws Exception {
         vhFinalField = MethodHandles.lookup().findVarHandle(
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessLong.java	Wed May 23 07:50:48 2018 -0700
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessLong.java	Wed May 23 09:13:50 2018 -0700
@@ -103,6 +103,41 @@
         return vhs.toArray(new VarHandle[0]);
     }
 
+    VarHandle[] allocate(boolean same) {
+        List<VarHandle> vhs = new ArrayList<>();
+
+        String postfix = same ? "" : "2";
+        VarHandle vh;
+        try {
+            vh = MethodHandles.lookup().findVarHandle(
+                    VarHandleTestAccessLong.class, "final_v" + postfix, long.class);
+            vhs.add(vh);
+
+            vh = MethodHandles.lookup().findVarHandle(
+                    VarHandleTestAccessLong.class, "v" + postfix, long.class);
+            vhs.add(vh);
+
+            vh = MethodHandles.lookup().findStaticVarHandle(
+                VarHandleTestAccessLong.class, "static_final_v" + postfix, long.class);
+            vhs.add(vh);
+
+            vh = MethodHandles.lookup().findStaticVarHandle(
+                VarHandleTestAccessLong.class, "static_v" + postfix, long.class);
+            vhs.add(vh);
+
+            if (same) {
+                vh = MethodHandles.arrayElementVarHandle(long[].class);
+            }
+            else {
+                vh = MethodHandles.arrayElementVarHandle(String[].class);
+            }
+            vhs.add(vh);
+        } catch (Exception e) {
+            throw new InternalError(e);
+        }
+        return vhs.toArray(new VarHandle[0]);
+    }
+
     @BeforeClass
     public void setup() throws Exception {
         vhFinalField = MethodHandles.lookup().findVarHandle(
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessShort.java	Wed May 23 07:50:48 2018 -0700
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessShort.java	Wed May 23 09:13:50 2018 -0700
@@ -103,6 +103,41 @@
         return vhs.toArray(new VarHandle[0]);
     }
 
+    VarHandle[] allocate(boolean same) {
+        List<VarHandle> vhs = new ArrayList<>();
+
+        String postfix = same ? "" : "2";
+        VarHandle vh;
+        try {
+            vh = MethodHandles.lookup().findVarHandle(
+                    VarHandleTestAccessShort.class, "final_v" + postfix, short.class);
+            vhs.add(vh);
+
+            vh = MethodHandles.lookup().findVarHandle(
+                    VarHandleTestAccessShort.class, "v" + postfix, short.class);
+            vhs.add(vh);
+
+            vh = MethodHandles.lookup().findStaticVarHandle(
+                VarHandleTestAccessShort.class, "static_final_v" + postfix, short.class);
+            vhs.add(vh);
+
+            vh = MethodHandles.lookup().findStaticVarHandle(
+                VarHandleTestAccessShort.class, "static_v" + postfix, short.class);
+            vhs.add(vh);
+
+            if (same) {
+                vh = MethodHandles.arrayElementVarHandle(short[].class);
+            }
+            else {
+                vh = MethodHandles.arrayElementVarHandle(String[].class);
+            }
+            vhs.add(vh);
+        } catch (Exception e) {
+            throw new InternalError(e);
+        }
+        return vhs.toArray(new VarHandle[0]);
+    }
+
     @BeforeClass
     public void setup() throws Exception {
         vhFinalField = MethodHandles.lookup().findVarHandle(