mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
8327138: Clean up status management in cdsConfig.hpp and CDS.java
Reviewed-by: ccheung, matsaave
This commit is contained in:
parent
53628f2ea9
commit
761ed250ec
19 changed files with 162 additions and 162 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2012, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2024, 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
|
||||
|
@ -255,7 +255,7 @@ import static jdk.internal.org.objectweb.asm.Opcodes.*;
|
|||
private Class<?> spinInnerClass() throws LambdaConversionException {
|
||||
// CDS does not handle disableEagerInitialization or useImplMethodHandle
|
||||
if (!disableEagerInitialization && !useImplMethodHandle) {
|
||||
if (CDS.isSharingEnabled()) {
|
||||
if (CDS.isUsingArchive()) {
|
||||
// load from CDS archive if present
|
||||
Class<?> innerClass = LambdaProxyClassArchive.find(targetClass,
|
||||
interfaceMethodName,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2020, 2024, 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
|
||||
|
@ -102,7 +102,7 @@ final class LambdaProxyClassArchive {
|
|||
Class<?>[] altInterfaces,
|
||||
MethodType[] altMethods) {
|
||||
if (!loadedByBuiltinLoader(caller) ||
|
||||
!CDS.isSharingEnabled() || isSerializable || altInterfaces.length > 0 || altMethods.length > 0)
|
||||
!CDS.isUsingArchive() || isSerializable || altInterfaces.length > 0 || altMethods.length > 0)
|
||||
return null;
|
||||
|
||||
return findFromArchive(caller, interfaceMethodName, factoryType, interfaceMethodType,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2011, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2011, 2024, 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
|
||||
|
@ -134,8 +134,8 @@ class MethodHandleStatics {
|
|||
shortenSignature(basicTypeSignature(type)) +
|
||||
(resolvedMember != null ? " (success)" : " (fail)"));
|
||||
}
|
||||
if (CDS.isDumpingClassList()) {
|
||||
CDS.traceLambdaFormInvoker("[LF_RESOLVE]", holder.getName(), name, shortenSignature(basicTypeSignature(type)));
|
||||
if (CDS.isLoggingLambdaFormInvokers()) {
|
||||
CDS.logLambdaFormInvoker("[LF_RESOLVE]", holder.getName(), name, shortenSignature(basicTypeSignature(type)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -148,8 +148,8 @@ class MethodHandleStatics {
|
|||
if (TRACE_RESOLVE) {
|
||||
System.out.println("[SPECIES_RESOLVE] " + cn + (salvage != null ? " (salvaged)" : " (generated)"));
|
||||
}
|
||||
if (CDS.isDumpingClassList()) {
|
||||
CDS.traceSpeciesType("[SPECIES_RESOLVE]", cn);
|
||||
if (CDS.isLoggingLambdaFormInvokers()) {
|
||||
CDS.logSpeciesType("[SPECIES_RESOLVE]", cn);
|
||||
}
|
||||
}
|
||||
// handy shared exception makers (they simplify the common case code)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2020, 2024, 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
|
||||
|
@ -41,48 +41,42 @@ 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;
|
||||
}
|
||||
// Must be in sync with cdsConfig.hpp
|
||||
private static final int IS_DUMPING_ARCHIVE = 1 << 0;
|
||||
private static final int IS_DUMPING_STATIC_ARCHIVE = 1 << 1;
|
||||
private static final int IS_LOGGING_LAMBDA_FORM_INVOKERS = 1 << 2;
|
||||
private static final int IS_USING_ARCHIVE = 1 << 3;
|
||||
private static final int configStatus = getCDSConfigStatus();
|
||||
|
||||
/**
|
||||
* indicator for dumping class list.
|
||||
*/
|
||||
public static boolean isDumpingClassList() {
|
||||
return isDumpingClassList;
|
||||
* Should we log the use of lambda form invokers?
|
||||
*/
|
||||
public static boolean isLoggingLambdaFormInvokers() {
|
||||
return (configStatus & IS_LOGGING_LAMBDA_FORM_INVOKERS) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is the VM writing to a (static or dynamic) CDS archive.
|
||||
*/
|
||||
public static boolean isDumpingArchive() {
|
||||
return isDumpingArchive;
|
||||
return (configStatus & IS_DUMPING_ARCHIVE) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is sharing enabled.
|
||||
* Is the VM using at least one CDS archive?
|
||||
*/
|
||||
public static boolean isSharingEnabled() {
|
||||
return isSharingEnabled;
|
||||
public static boolean isUsingArchive() {
|
||||
return (configStatus & IS_USING_ARCHIVE) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is dumping static archive.
|
||||
*/
|
||||
public static boolean isDumpingStaticArchive() {
|
||||
return isDumpingStaticArchive;
|
||||
return (configStatus & IS_DUMPING_STATIC_ARCHIVE) != 0;
|
||||
}
|
||||
|
||||
private static native boolean isDumpingClassList0();
|
||||
private static native boolean isDumpingArchive0();
|
||||
private static native boolean isSharingEnabled0();
|
||||
private static native int getCDSConfigStatus();
|
||||
private static native void logLambdaFormInvoker(String line);
|
||||
|
||||
/**
|
||||
|
@ -112,8 +106,8 @@ public class CDS {
|
|||
/**
|
||||
* log lambda form invoker holder, name and method type
|
||||
*/
|
||||
public static void traceLambdaFormInvoker(String prefix, String holder, String name, String type) {
|
||||
if (isDumpingClassList) {
|
||||
public static void logLambdaFormInvoker(String prefix, String holder, String name, String type) {
|
||||
if (isLoggingLambdaFormInvokers()) {
|
||||
logLambdaFormInvoker(prefix + " " + holder + " " + name + " " + type);
|
||||
}
|
||||
}
|
||||
|
@ -121,8 +115,8 @@ public class CDS {
|
|||
/**
|
||||
* log species
|
||||
*/
|
||||
public static void traceSpeciesType(String prefix, String cn) {
|
||||
if (isDumpingClassList) {
|
||||
public static void logSpeciesType(String prefix, String cn) {
|
||||
if (isLoggingLambdaFormInvokers()) {
|
||||
logLambdaFormInvoker(prefix + " " + cn);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue