8163476: java/lang/StackWalker/VerifyStackTrace.java fails after JDK-8163369
authorredestad
Tue, 09 Aug 2016 15:02:27 +0200
changeset 40212 6863c0579ecf
parent 40211 8b78c9b31244
child 40213 558b11baf637
8163476: java/lang/StackWalker/VerifyStackTrace.java fails after JDK-8163369 Reviewed-by: igerasim, chegar
jdk/src/java.base/share/classes/java/lang/invoke/DirectMethodHandle.java
jdk/src/java.base/share/classes/java/lang/invoke/LambdaForm.java
jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/GenerateJLIClassesPlugin.java
jdk/test/java/lang/StackWalker/VerifyStackTrace.java
--- a/jdk/src/java.base/share/classes/java/lang/invoke/DirectMethodHandle.java	Tue Aug 09 10:00:31 2016 +0200
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/DirectMethodHandle.java	Tue Aug 09 15:02:27 2016 +0200
@@ -191,12 +191,12 @@
         boolean doesAlloc = (which == LF_NEWINVSPECIAL);
         String linkerName, lambdaName;
         switch (which) {
-        case LF_INVVIRTUAL:    linkerName = "linkToVirtual";    lambdaName = "invokeVirtual";    break;
-        case LF_INVSTATIC:     linkerName = "linkToStatic";     lambdaName = "invokeStatic";     break;
-        case LF_INVSTATIC_INIT:linkerName = "linkToStatic";     lambdaName = "invokeStaticInit"; break;
-        case LF_INVSPECIAL:    linkerName = "linkToSpecial";    lambdaName = "invokeSpecial";    break;
-        case LF_INVINTERFACE:  linkerName = "linkToInterface";  lambdaName = "invokeInterface";  break;
-        case LF_NEWINVSPECIAL: linkerName = "linkToSpecial";    lambdaName = "newInvokeSpecial"; break;
+        case LF_INVVIRTUAL:    linkerName = "linkToVirtual";    lambdaName = "DMH.invokeVirtual";    break;
+        case LF_INVSTATIC:     linkerName = "linkToStatic";     lambdaName = "DMH.invokeStatic";     break;
+        case LF_INVSTATIC_INIT:linkerName = "linkToStatic";     lambdaName = "DMH.invokeStaticInit"; break;
+        case LF_INVSPECIAL:    linkerName = "linkToSpecial";    lambdaName = "DMH.invokeSpecial";    break;
+        case LF_INVINTERFACE:  linkerName = "linkToInterface";  lambdaName = "DMH.invokeInterface";  break;
+        case LF_NEWINVSPECIAL: linkerName = "linkToSpecial";    lambdaName = "DMH.newInvokeSpecial"; break;
         default:  throw new InternalError("which="+which);
         }
 
--- a/jdk/src/java.base/share/classes/java/lang/invoke/LambdaForm.java	Tue Aug 09 10:00:31 2016 +0200
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/LambdaForm.java	Tue Aug 09 15:02:27 2016 +0200
@@ -783,7 +783,9 @@
         }
         MethodType invokerType = methodType();
         assert(vmentry == null || vmentry.getMethodType().basicType().equals(invokerType));
-        MemberName member = new MemberName(lookupClass, debugName, invokerType, REF_invokeStatic);
+        int dot = debugName.indexOf('.');
+        String methodName = (dot > 0) ? debugName.substring(dot + 1) : debugName;
+        MemberName member = new MemberName(lookupClass, methodName, invokerType, REF_invokeStatic);
         MemberName resolvedMember = MemberName.getFactory().resolveOrNull(REF_invokeStatic, member, lookupClass);
         if (resolvedMember != null) {
             vmentry = resolvedMember;
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/GenerateJLIClassesPlugin.java	Tue Aug 09 10:00:31 2016 +0200
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/GenerateJLIClassesPlugin.java	Tue Aug 09 15:02:27 2016 +0200
@@ -117,7 +117,7 @@
      */
     public static Map<String, List<String>> defaultDMHMethods() {
         return Map.of(
-            DMH_INVOKE_VIRTUAL, List.of("_L", "L_L", "LI_I"),
+            DMH_INVOKE_VIRTUAL, List.of("_L", "L_L", "LI_I", "LL_V"),
             DMH_INVOKE_SPECIAL, List.of("L_I", "L_L", "LF_L", "LD_L", "LL_L",
                 "L3_L", "L4_L", "L5_L", "L6_L", "L7_L", "LI_I", "LI_L", "LIL_I",
                 "LII_I", "LII_L", "LLI_L", "LLI_I", "LILI_I", "LIIL_L",
--- a/jdk/test/java/lang/StackWalker/VerifyStackTrace.java	Tue Aug 09 10:00:31 2016 +0200
+++ b/jdk/test/java/lang/StackWalker/VerifyStackTrace.java	Tue Aug 09 15:02:27 2016 +0200
@@ -205,6 +205,8 @@
                     .replaceAll("java.base@(\\d+\\.){0,3}(\\d+)/", "java.base/")
                     .replaceAll("/[0-9]+\\.run", "/xxxxxxxx.run")
                     .replaceAll("/[0-9]+\\.invoke", "/xxxxxxxx.invoke")
+                    .replaceAll("DirectMethodHandle\\$Holder", "LambdaForm\\$DMH")
+                    .replaceAll("DMH\\.invoke", "DMH/xxxxxxxx.invoke")
                     .replaceAll("\\$[0-9]+", "\\$??");
         } else {
             return produced;