Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8207381

Provide internal Java API for archiving object sub-graph reachable from static field



    • Enhancement
    • Resolution: Won't Fix
    • P3
    • tbd
    • 12
    • hotspot


      It might be helpful to provide a java API like the following to specify entry point (static field) for archiving a sub-graph in Java code:

      In VM class:
      public static native void archive(Class<?> c, String fieldName);

      Suggested by Ioi and Karen.

      The new API will make adding new sub-graph archiving an easier task. No new CDS/VM code change will be required for registering the entry fields (currently several VM files need to be modified in order to add a new entry) with the java API.

      In addition to the API, we need a mechanism to validate that the new sub-graph for archiving is 'preservable'. There are following starter approaches:

      Approach 1)
      Author driven approach. The author who's adding a new sub-graph archiving need to specify all classes included in the graph are 'preservable'. Method for how to specify 'preservable' state is not determined yet currently.

      Approach 2)
      Add guards to the archived sub-graph during dump time. When archiving a sub-graph, checks can be done for the objects within the sub-graph to make sure they are not the ones with known issues (such as Thread, etc).

      Approach 3)
      This is suggested by Ioi. Dump time can consult a list of classes maintained internally by the sub-graph archiving mechanism. Only instances of classes on the list can be included in the archived sub-graph. When new sub-graphs are archived, new classes may be added to the list. Only classes with no runtime dependencies should be added to the list.


        Issue Links



              jiangli Jiangli Zhou
              jiangli Jiangli Zhou
              0 Vote for this issue
              6 Start watching this issue