< prev index next >

src/java.base/share/classes/jdk/internal/misc/CDS.java

Print this page
*** 1,7 ***
  /*
!  * Copyright (c) 2020, 2022, 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.  Oracle designates this
--- 1,7 ---
  /*
!  * Copyright (c) 2020, 2023, 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.  Oracle designates this

*** 39,19 ***
  import java.util.stream.Stream;
  
  import jdk.internal.access.SharedSecrets;
  
  public class CDS {
-     private static final boolean isDumpingClassList;
      private static final boolean isDumpingArchive;
!     private static final boolean isSharingEnabled;
      private static final boolean isDumpingStaticArchive;
      static {
-         isDumpingClassList = isDumpingClassList0();
          isDumpingArchive = isDumpingArchive0();
          isSharingEnabled = isSharingEnabled0();
!         isDumpingStaticArchive = isDumpingArchive && !isSharingEnabled;
      }
  
      /**
        * indicator for dumping class list.
        */
--- 39,23 ---
  import java.util.stream.Stream;
  
  import jdk.internal.access.SharedSecrets;
  
  public class CDS {
      private static final boolean isDumpingArchive;
!     private static final boolean isDumpingClassList;
+     private static final boolean isDumpingHeap;
      private static final boolean isDumpingStaticArchive;
+     private static final boolean isSharingEnabled;
+     private static final boolean isTracingDynamicProxy;
      static {
          isDumpingArchive = isDumpingArchive0();
+         isDumpingClassList = isDumpingClassList0();
+         isDumpingHeap = isDumpingHeap0();
+         isDumpingStaticArchive = isDumpingStaticArchive0();
          isSharingEnabled = isSharingEnabled0();
!         isTracingDynamicProxy = isTracingDynamicProxy0();
      }
  
      /**
        * indicator for dumping class list.
        */

*** 78,13 ***
        */
      public static boolean isDumpingStaticArchive() {
          return isDumpingStaticArchive;
      }
  
!     private static native boolean isDumpingClassList0();
      private static native boolean isDumpingArchive0();
      private static native boolean isSharingEnabled0();
      private static native void logLambdaFormInvoker(String line);
  
      /**
       * Initialize archived static fields in the given Class using archived
       * values from CDS dump time. Also initialize the classes of objects in
--- 82,25 ---
        */
      public static boolean isDumpingStaticArchive() {
          return isDumpingStaticArchive;
      }
  
!     public static boolean isDumpingHeap() {
+         return isDumpingHeap;
+     }
+ 
+     public static boolean isTracingDynamicProxy() {
+         return isTracingDynamicProxy;
+     }
+ 
      private static native boolean isDumpingArchive0();
+     private static native boolean isDumpingClassList0();
+     private static native boolean isDumpingHeap0();
+     private static native boolean isDumpingStaticArchive0();
      private static native boolean isSharingEnabled0();
+     private static native boolean isTracingDynamicProxy0();
+ 
      private static native void logLambdaFormInvoker(String line);
  
      /**
       * Initialize archived static fields in the given Class using archived
       * values from CDS dump time. Also initialize the classes of objects in

*** 125,10 ***
--- 141,19 ---
          if (isDumpingClassList) {
              logLambdaFormInvoker(prefix + " " + cn);
          }
      }
  
+     public static void traceDynamicProxy(ClassLoader loader, String proxyName,
+                                          Class<?>[] interfaces, int accessFlags) {
+         Objects.requireNonNull(proxyName);
+         Objects.requireNonNull(interfaces);
+         logDynamicProxy(loader, proxyName, interfaces, accessFlags);
+     }
+     private static native void logDynamicProxy(ClassLoader loader, String proxyName,
+                                                Class<?>[] interfaces, int accessFlags);
+ 
      static final String DIRECT_HOLDER_CLASS_NAME  = "java.lang.invoke.DirectMethodHandle$Holder";
      static final String DELEGATING_HOLDER_CLASS_NAME = "java.lang.invoke.DelegatingMethodHandle$Holder";
      static final String BASIC_FORMS_HOLDER_CLASS_NAME = "java.lang.invoke.LambdaForm$Holder";
      static final String INVOKERS_HOLDER_CLASS_NAME = "java.lang.invoke.Invokers$Holder";
  
< prev index next >