RFR: 8276184: Add CDS test on lambda proxy class with java agent

Ioi Lam iklam at openjdk.java.net
Tue Nov 2 06:00:15 UTC 2021


On Tue, 2 Nov 2021 01:54:00 GMT, Calvin Cheung <ccheung at openjdk.org> wrote:

> Adding a test when an interface (major version 49) of a lambda proxy class is being transformed by a java agent during
> CDS dump time and run time. The java agent will update the version of the interface to 50.  During dump time, the
> interface will be included in the CDS archive. During run time, any transformed classes will not be loaded from the
> archive.
> 
> The new tests passed tiers 1,2,3,4 testing.

FYI, I applied this patch and ran test/hotspot/jtreg/runtime/cds/appcds/SignedJar.java:


$ git diff
diff --git a/test/hotspot/jtreg/runtime/cds/appcds/test-classes/Hello.java b/test/hotspot/jtreg/runtime/cds/appcds/test-classes/Hello.java
index 250a63adde8..f421ba5477f 100644
--- a/test/hotspot/jtreg/runtime/cds/appcds/test-classes/Hello.java
+++ b/test/hotspot/jtreg/runtime/cds/appcds/test-classes/Hello.java
@@ -25,5 +25,10 @@
 public class Hello {
   public static void main(String args[]) {
     System.out.println("Hello World");
+    System.out.println(getRunnable());
+  }
+
+  public static Runnable getRunnable() {
+    return () -> {};
   }
 }


Inside the JTREG scratch directory, you will find hello.jar and signed_hello.jar. The output of the second command seems suspicious. The Hello class is not archived, but its lambda proxy class is archived:


$ java -cp hello.jar -XX:ArchiveClassesAtExit=foo.jsa -Xlog:cds+class=debug Hello | grep Hello
Hello World
Hello$$Lambda$1/0x0000000800c009f0 at 18b4aac2
[0.144s][debug][cds,class] klasses[    1] = 0x0000000800bb4638 app   Hello$$Lambda$1/0x0000000800c009f0 ** hidden
[0.144s][debug][cds,class] klasses[    2] = 0x0000000800bb49e0 app   Hello

$ java -cp signed_hello.jar -XX:ArchiveClassesAtExit=foo.jsa -Xlog:cds+class=debug Hello | grep Hello
Hello World
Hello$$Lambda$11/0x0000000800c011f0 at 5eb5c224
[0.257s][warning][cds] Skipping Hello: Signed JAR
[0.289s][debug  ][cds,class] klasses[  103] = 0x0000000800bea278 app   Hello$$Lambda$11/0x0000000800c011f0 ** hidden

-------------

PR: https://git.openjdk.java.net/jdk/pull/6205


More information about the hotspot-runtime-dev mailing list