mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8247666: Support Lambda proxy classes in static CDS archive
Reviewed-by: iklam, mchung
This commit is contained in:
parent
e2e11d3449
commit
74ac77e2b1
38 changed files with 1960 additions and 130 deletions
|
@ -29,28 +29,6 @@ import jdk.internal.loader.BuiltinClassLoader;
|
|||
import jdk.internal.misc.CDS;
|
||||
|
||||
final class LambdaProxyClassArchive {
|
||||
private static final boolean dumpArchive;
|
||||
private static final boolean sharingEnabled;
|
||||
|
||||
static {
|
||||
dumpArchive = CDS.isDynamicDumpingEnabled();
|
||||
sharingEnabled = CDS.isSharingEnabled();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if CDS dynamic dump is enabled.
|
||||
*/
|
||||
static boolean isDumpArchive() {
|
||||
return dumpArchive;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if CDS sharing is enabled.
|
||||
*/
|
||||
static boolean isSharingEnabled() {
|
||||
return sharingEnabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the class is loaded by a built-in class loader.
|
||||
*/
|
||||
|
@ -94,7 +72,7 @@ final class LambdaProxyClassArchive {
|
|||
Class<?>[] markerInterfaces,
|
||||
MethodType[] additionalBridges,
|
||||
Class<?> lambdaProxyClass) {
|
||||
if (!isDumpArchive())
|
||||
if (!CDS.isDumpingArchive())
|
||||
throw new IllegalStateException("should only register lambda proxy class at dump time");
|
||||
|
||||
if (loadedByBuiltinLoader(caller) &&
|
||||
|
@ -125,11 +103,11 @@ final class LambdaProxyClassArchive {
|
|||
Class<?>[] markerInterfaces,
|
||||
MethodType[] additionalBridges,
|
||||
boolean initialize) {
|
||||
if (isDumpArchive())
|
||||
if (CDS.isDumpingArchive())
|
||||
throw new IllegalStateException("cannot load class from CDS archive at dump time");
|
||||
|
||||
if (!loadedByBuiltinLoader(caller) ||
|
||||
!isSharingEnabled() || isSerializable || markerInterfaces.length > 0 || additionalBridges.length > 0)
|
||||
if (!loadedByBuiltinLoader(caller) || !initialize ||
|
||||
!CDS.isSharingEnabled() || isSerializable || markerInterfaces.length > 0 || additionalBridges.length > 0)
|
||||
return null;
|
||||
|
||||
return findFromArchive(caller, invokedName, invokedType, samMethodType,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue