mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
8304846: Provide a shared utility to dump generated classes defined via Lookup API
Reviewed-by: jvernee
This commit is contained in:
parent
2ee4245105
commit
dd59471798
11 changed files with 440 additions and 393 deletions
|
@ -27,9 +27,11 @@ package java.lang.invoke;
|
|||
|
||||
import jdk.internal.misc.CDS;
|
||||
import jdk.internal.misc.Unsafe;
|
||||
import jdk.internal.util.ClassFileDumper;
|
||||
import sun.security.action.GetPropertyAction;
|
||||
|
||||
import java.lang.reflect.ClassFileFormatVersion;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Properties;
|
||||
|
||||
import static java.lang.invoke.LambdaForm.basicTypeSignature;
|
||||
|
@ -49,7 +51,6 @@ class MethodHandleStatics {
|
|||
static final Unsafe UNSAFE = Unsafe.getUnsafe();
|
||||
static final int CLASSFILE_VERSION = ClassFileFormatVersion.latest().major();
|
||||
static final boolean DEBUG_METHOD_HANDLE_NAMES;
|
||||
static final boolean DUMP_CLASS_FILES;
|
||||
static final boolean TRACE_INTERPRETER;
|
||||
static final boolean TRACE_METHOD_LINKAGE;
|
||||
static final boolean TRACE_RESOLVE;
|
||||
|
@ -62,13 +63,13 @@ class MethodHandleStatics {
|
|||
static final boolean VAR_HANDLE_GUARDS;
|
||||
static final int MAX_ARITY;
|
||||
static final boolean VAR_HANDLE_IDENTITY_ADAPT;
|
||||
static final ClassFileDumper DUMP_CLASS_FILES;
|
||||
|
||||
static {
|
||||
Properties props = GetPropertyAction.privilegedGetProperties();
|
||||
DEBUG_METHOD_HANDLE_NAMES = Boolean.parseBoolean(
|
||||
props.getProperty("java.lang.invoke.MethodHandle.DEBUG_NAMES"));
|
||||
DUMP_CLASS_FILES = Boolean.parseBoolean(
|
||||
props.getProperty("java.lang.invoke.MethodHandle.DUMP_CLASS_FILES"));
|
||||
|
||||
TRACE_INTERPRETER = Boolean.parseBoolean(
|
||||
props.getProperty("java.lang.invoke.MethodHandle.TRACE_INTERPRETER"));
|
||||
TRACE_METHOD_LINKAGE = Boolean.parseBoolean(
|
||||
|
@ -96,6 +97,9 @@ class MethodHandleStatics {
|
|||
MAX_ARITY = Integer.parseInt(
|
||||
props.getProperty("java.lang.invoke.MethodHandleImpl.MAX_ARITY", "255"));
|
||||
|
||||
DUMP_CLASS_FILES = ClassFileDumper.getInstance("jdk.invoke.MethodHandle.dumpMethodHandleInternals",
|
||||
Path.of("DUMP_METHOD_HANDLE_INTERNALS"));
|
||||
|
||||
if (CUSTOMIZE_THRESHOLD < -1 || CUSTOMIZE_THRESHOLD > 127) {
|
||||
throw newInternalError("CUSTOMIZE_THRESHOLD should be in [-1...127] range");
|
||||
}
|
||||
|
@ -107,12 +111,16 @@ class MethodHandleStatics {
|
|||
/*non-public*/
|
||||
static boolean debugEnabled() {
|
||||
return (DEBUG_METHOD_HANDLE_NAMES |
|
||||
DUMP_CLASS_FILES |
|
||||
DUMP_CLASS_FILES.isEnabled() |
|
||||
TRACE_INTERPRETER |
|
||||
TRACE_METHOD_LINKAGE |
|
||||
LOG_LF_COMPILATION_FAILURE);
|
||||
}
|
||||
|
||||
static ClassFileDumper dumper() {
|
||||
return DUMP_CLASS_FILES;
|
||||
}
|
||||
|
||||
/**
|
||||
* If requested, logs the result of resolving the LambdaForm to stdout
|
||||
* and informs the CDS subsystem about it.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue