APIdia Launch Partner
Top Inners Fields Constructors Methods
jdk.internal.misc

public Class CDS

extends Object
Class Inheritance
Imports
java.io.BufferedReader, .File, .InputStreamReader, .InputStream, .IOException, .PrintStream, java.nio.file.Files, .Path, java.util.Arrays, .ArrayList, .HashMap, .List, .Map, .Objects, java.util.jar.JarFile, java.util.stream.Stream, jdk.internal.access.SharedSecrets, jdk.internal.util.StaticProperty

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
CDS.ProcessLauncher

This class is used only by native JVM code to spawn a child JVM process to assemble the AOT cache.

private static class
CDS.UnregisteredClassLoader

This class is used only by native JVM code at CDS dump time for loading "unregistered classes", which are archived classes that are intended to be loaded by custom class loaders during runtime.

Field Summary

Modifier and TypeField and Description
pack-priv static final String
private static final int
pack-priv static final String
pack-priv static final String
private static String[]
pack-priv static final String
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static ArrayList<Object>

Constructor Summary

AccessConstructor and Description
public
CDS()

Method Summary

Modifier and TypeMethod and Description
private static boolean
public static native void
defineArchivedModules(ClassLoader platformLoader, ClassLoader systemLoader)

Ensure that the native representation of all archived java.lang.Module objects are properly restored.

private static String
drainOutput(InputStream stream, long pid, String tail, List<String> cmds)

private static native void
dumpClassList(String listFileName)

private static native void
dumpDynamicArchive(String archiveFileName)

private static String

Returns:

The archive name if successfully dumped.
dumpSharedArchive
(boolean
true for dump static archive or false for dynnamic archive.
isStatic
,
String
user input archive name, can be null.
fileName
)

called from jcmd VM.cds to dump static or dynamic shared archive

private static Object[]

Returns:

Object[] if holder classes can be generated.
generateLambdaFormHolderClasses
(String[]
in format of LF_RESOLVE or SPECIES_RESOLVE output
lines
)

called from vm to generate MethodHandle holder classes

private static native int
private static Object[]
public static native long
getRandomSeedForDumping()

Returns a predictable "random" seed derived from the VM's build ID and version, to be used by java.util.ImmutableCollections to ensure that archived ImmutableCollections are always sorted the same order for the same VM build.

public static native void
initializeFromArchive(Class<?> c)

Initialize archived static fields in the given Class using archived values from CDS dump time.

private static boolean
public static boolean
public static boolean
isDumpingArchive()

Is the VM writing to a (static or dynamic) CDS archive.

public static boolean
isDumpingStaticArchive()

Is dumping static archive.

public static boolean
isLoggingLambdaFormInvokers()

Should we log the use of lambda form invokers?

public static boolean
public static boolean
isUsingArchive()

Is the VM using at least one CDS archive?

private static boolean
private static boolean
public static void
private static native void
public static void
logLambdaFormInvoker(String prefix, String holder, String name, String type)

log lambda form invoker holder, name and method type

public static void
logSpeciesType(String prefix, String cn)

log species

public static boolean

Returns:

false only if a call to ensureClassInitialized would have no effect during the application's production run.
needsClassInitBarrier
(Class<?> c)

Detects if we need to emit explicit class initialization checks in AOT-cached MethodHandles and VarHandles before accessing static fields and methods.

private static native boolean
private static void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

BASIC_FORMS_HOLDER_CLASS_NAMEback to summary
pack-priv static final String BASIC_FORMS_HOLDER_CLASS_NAME
configStatusback to summary
private static final int configStatus
DELEGATING_HOLDER_CLASS_NAMEback to summary
pack-priv static final String DELEGATING_HOLDER_CLASS_NAME
DIRECT_HOLDER_CLASS_NAMEback to summary
pack-priv static final String DIRECT_HOLDER_CLASS_NAME
excludeFlagsback to summary
private static String[] excludeFlags
INVOKERS_HOLDER_CLASS_NAMEback to summary
pack-priv static final String INVOKERS_HOLDER_CLASS_NAME
IS_DUMPING_AOT_LINKED_CLASSESback to summary
private static final int IS_DUMPING_AOT_LINKED_CLASSES
IS_DUMPING_ARCHIVEback to summary
private static final int IS_DUMPING_ARCHIVE
IS_DUMPING_METHOD_HANDLESback to summary
private static final int IS_DUMPING_METHOD_HANDLES
IS_DUMPING_STATIC_ARCHIVEback to summary
private static final int IS_DUMPING_STATIC_ARCHIVE
IS_LOGGING_LAMBDA_FORM_INVOKERSback to summary
private static final int IS_LOGGING_LAMBDA_FORM_INVOKERS
IS_USING_ARCHIVEback to summary
private static final int IS_USING_ARCHIVE
keepAliveListback to summary
private static ArrayList<Object> keepAliveList

Constructor Detail

CDSback to summary
public CDS()

Method Detail

containsExcludedFlagsback to summary
private static boolean containsExcludedFlags(String testStr)
defineArchivedModulesback to summary
public static native void defineArchivedModules(ClassLoader platformLoader, ClassLoader systemLoader)

Ensure that the native representation of all archived java.lang.Module objects are properly restored.

drainOutputback to summary
private static String drainOutput(InputStream stream, long pid, String tail, List<String> cmds)
dumpClassListback to summary
private static native void dumpClassList(String listFileName)
dumpDynamicArchiveback to summary
private static native void dumpDynamicArchive(String archiveFileName)
dumpSharedArchiveback to summary
private static String dumpSharedArchive(boolean isStatic, String fileName) throws Exception

called from jcmd VM.cds to dump static or dynamic shared archive

Parameters
isStatic:boolean

true for dump static archive or false for dynnamic archive.

fileName:String

user input archive name, can be null.

Returns:String

The archive name if successfully dumped.

generateLambdaFormHolderClassesback to summary
private static Object[] generateLambdaFormHolderClasses(String[] lines)

called from vm to generate MethodHandle holder classes

Parameters
lines:String[]

in format of LF_RESOLVE or SPECIES_RESOLVE output

Returns:Object[]

Object[] if holder classes can be generated.

getCDSConfigStatusback to summary
private static native int getCDSConfigStatus()
getKeepAliveObjectsback to summary
private static Object[] getKeepAliveObjects()
getRandomSeedForDumpingback to summary
public static native long getRandomSeedForDumping()

Returns a predictable "random" seed derived from the VM's build ID and version, to be used by java.util.ImmutableCollections to ensure that archived ImmutableCollections are always sorted the same order for the same VM build.

initializeFromArchiveback to summary
public static native void initializeFromArchive(Class<?> c)

Initialize archived static fields in the given Class using archived values from CDS dump time. Also initialize the classes of objects in the archived graph referenced by those fields. Those static fields remain as uninitialized if there is no mapped CDS java heap data or there is any error during initialization of the object class in the archived graph.

isBasicTypeCharback to summary
private static boolean isBasicTypeChar(char c)
isDumpingAOTLinkedClassesback to summary
public static boolean isDumpingAOTLinkedClasses()
isDumpingArchiveback to summary
public static boolean isDumpingArchive()

Is the VM writing to a (static or dynamic) CDS archive.

isDumpingStaticArchiveback to summary
public static boolean isDumpingStaticArchive()

Is dumping static archive.

isLoggingLambdaFormInvokersback to summary
public static boolean isLoggingLambdaFormInvokers()

Should we log the use of lambda form invokers?

isSingleThreadVMback to summary
public static boolean isSingleThreadVM()
isUsingArchiveback to summary
public static boolean isUsingArchive()

Is the VM using at least one CDS archive?

isValidHolderNameback to summary
private static boolean isValidHolderName(String name)
isValidMethodTypeback to summary
private static boolean isValidMethodType(String type)
keepAliveback to summary
public static void keepAlive(Object s)
logLambdaFormInvokerback to summary
private static native void logLambdaFormInvoker(String line)
logLambdaFormInvokerback to summary
public static void logLambdaFormInvoker(String prefix, String holder, String name, String type)

log lambda form invoker holder, name and method type

logSpeciesTypeback to summary
public static void logSpeciesType(String prefix, String cn)

log species

needsClassInitBarrierback to summary
public static boolean needsClassInitBarrier(Class<?> c)

Detects if we need to emit explicit class initialization checks in AOT-cached MethodHandles and VarHandles before accessing static fields and methods.

Returns:boolean

false only if a call to ensureClassInitialized would have no effect during the application's production run.

See Also
jdk.internal.misc.Unsafe::shouldBeInitialized
needsClassInitBarrier0back to summary
private static native boolean needsClassInitBarrier0(Class<?> c)
validateInputLinesback to summary
private static void validateInputLines(String[] lines)
jdk.internal.misc back to summary

private Class CDS.ProcessLauncher

extends Object
Class Inheritance

This class is used only by native JVM code to spawn a child JVM process to assemble the AOT cache. args[] are passed in the JAVA_TOOL_OPTIONS environment variable.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
pack-priv static int
execWithJavaToolOptions(String javaLauncher, String[] args)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

ProcessLauncherback to summary
private ProcessLauncher()

Method Detail

execWithJavaToolOptionsback to summary
pack-priv static int execWithJavaToolOptions(String javaLauncher, String[] args) throws IOException, InterruptedException
jdk.internal.misc back to summary

private Class CDS.UnregisteredClassLoader

extends ClassLoader
Class Inheritance

This class is used only by native JVM code at CDS dump time for loading "unregistered classes", which are archived classes that are intended to be loaded by custom class loaders during runtime. See src/hotspot/share/cds/unregisteredClasses.cpp.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
pack-priv static class
pack-priv static interface

Field Summary

Modifier and TypeField and Description
private final HashMap<String, CDS.UnregisteredClassLoader.Source>

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private Class<?>
load(String
the name of the class to be loaded.
name
,
String
path to a directory or a JAR file from which the named class should be loaded.
source
)

Load the class of the given name from the given source.

private CDS.UnregisteredClassLoader.Source
Inherited from java.lang.ClassLoader:
clearAssertionStatusdefineClassdefineClassdefineClassdefineClassdefinePackagefindClassfindClassfindLibraryfindLoadedClassfindResourcefindResourcefindResourcesfindSystemClassgetClassLoadingLockgetDefinedPackagegetDefinedPackagesgetNamegetPackagegetPackagesgetParentgetPlatformClassLoadergetResourcegetResourceAsStreamgetResourcesgetSystemClassLoadergetSystemResourcegetSystemResourceAsStreamgetSystemResourcesgetUnnamedModuleisRegisteredAsParallelCapableloadClassloadClassregisterAsParallelCapableresolveClassresourcessetClassAssertionStatussetDefaultAssertionStatussetPackageAssertionStatussetSigners

Field Detail

sourcesback to summary
private final HashMap<String, CDS.UnregisteredClassLoader.Source> sources

Constructor Detail

UnregisteredClassLoaderback to summary
private UnregisteredClassLoader()

Method Detail

loadback to summary
private Class<?> load(String name, String source) throws IOException

Load the class of the given name from the given source.

All super classes and interfaces of the named class must have already been loaded: either defined by this class loader (unregistered ones) or loaded, possibly indirectly, by the system class loader (registered ones).

If the named class has a registered super class or interface named N there should be no unregistered class or interface named N loaded yet.

Parameters
name:String

the name of the class to be loaded.

source:String

path to a directory or a JAR file from which the named class should be loaded.

resolveSourceback to summary
private CDS.UnregisteredClassLoader.Source resolveSource(String path) throws IOException
jdk.internal.misc back to summary

pack-priv Class CDS.UnregisteredClassLoader.DirSource

extends Object
implements Source
Class Inheritance
All Implemented Interfaces
jdk.internal.misc.CDS.UnregisteredClassLoader.Source

Field Summary

Modifier and TypeField and Description
private final String

Constructor Summary

AccessConstructor and Description
pack-priv

Field Detail

basePathback to summary
private final String basePath

Constructor Detail

DirSourceback to summary
pack-priv DirSource(File dir)

Method Detail

readClassFileback to summary
public byte[] readClassFile(String className) throws IOException

Implements jdk.internal.misc.CDS.UnregisteredClassLoader.Source.readClassFile.

Annotations
@Override
jdk.internal.misc back to summary

pack-priv Class CDS.UnregisteredClassLoader.JarSource

extends Object
implements Source
Class Inheritance
All Implemented Interfaces
jdk.internal.misc.CDS.UnregisteredClassLoader.Source

Field Summary

Modifier and TypeField and Description
private final JarFile

Constructor Summary

AccessConstructor and Description
pack-priv

Field Detail

jarback to summary
private final JarFile jar

Constructor Detail

JarSourceback to summary
pack-priv JarSource(File file) throws IOException

Method Detail

readClassFileback to summary
public byte[] readClassFile(String className) throws IOException

Implements jdk.internal.misc.CDS.UnregisteredClassLoader.Source.readClassFile.

Annotations
@Override
jdk.internal.misc back to summary

pack-priv Interface CDS.UnregisteredClassLoader.Source

Known Direct Implementers
jdk.internal.misc.CDS.UnregisteredClassLoader.JarSource, jdk.internal.misc.CDS.UnregisteredClassLoader.DirSource

Method Summary

Modifier and TypeMethod and Description
public byte[]
readClassFile(String className)

Method Detail

readClassFileback to summary
public byte[] readClassFile(String className) throws IOException