< prev index next >

src/java.base/share/classes/java/lang/invoke/MethodHandleStatics.java

Print this page

 42  * Usage:  {@code import static java.lang.invoke.MethodHandleStatics.*}
 43  * @author John Rose, JSR 292 EG
 44  */
 45 /*non-public*/
 46 class MethodHandleStatics {
 47 
 48     private MethodHandleStatics() { }  // do not instantiate
 49 
 50     static final Unsafe UNSAFE = Unsafe.getUnsafe();
 51     static final int CLASSFILE_VERSION = ClassFileFormatVersion.latest().major();
 52     static final boolean DEBUG_METHOD_HANDLE_NAMES;
 53     static final boolean TRACE_INTERPRETER;
 54     static final boolean TRACE_METHOD_LINKAGE;
 55     static final boolean TRACE_RESOLVE;
 56     static final int COMPILE_THRESHOLD;
 57     static final boolean LOG_LF_COMPILATION_FAILURE;
 58     static final int DONT_INLINE_THRESHOLD;
 59     static final int PROFILE_LEVEL;
 60     static final boolean PROFILE_GWT;
 61     static final int CUSTOMIZE_THRESHOLD;

 62     static final boolean VAR_HANDLE_GUARDS;
 63     static final int MAX_ARITY;
 64     static final boolean VAR_HANDLE_IDENTITY_ADAPT;
 65     static final boolean VAR_HANDLE_SEGMENT_FORCE_EXACT;
 66     static final ClassFileDumper DUMP_CLASS_FILES;
 67 
 68     static {
 69         Properties props = GetPropertyAction.privilegedGetProperties();
 70         DEBUG_METHOD_HANDLE_NAMES = Boolean.parseBoolean(
 71                 props.getProperty("java.lang.invoke.MethodHandle.DEBUG_NAMES"));
 72 
 73         TRACE_INTERPRETER = Boolean.parseBoolean(
 74                 props.getProperty("java.lang.invoke.MethodHandle.TRACE_INTERPRETER"));
 75         TRACE_METHOD_LINKAGE = Boolean.parseBoolean(
 76                 props.getProperty("java.lang.invoke.MethodHandle.TRACE_METHOD_LINKAGE"));
 77         TRACE_RESOLVE = Boolean.parseBoolean(
 78                 props.getProperty("java.lang.invoke.MethodHandle.TRACE_RESOLVE"));
 79         COMPILE_THRESHOLD = Integer.parseInt(
 80                 props.getProperty("java.lang.invoke.MethodHandle.COMPILE_THRESHOLD", "0"));
 81         LOG_LF_COMPILATION_FAILURE = Boolean.parseBoolean(
 82                 props.getProperty("java.lang.invoke.MethodHandle.LOG_LF_COMPILATION_FAILURE", "false"));
 83         DONT_INLINE_THRESHOLD = Integer.parseInt(
 84                 props.getProperty("java.lang.invoke.MethodHandle.DONT_INLINE_THRESHOLD", "30"));
 85         PROFILE_LEVEL = Integer.parseInt(
 86                 props.getProperty("java.lang.invoke.MethodHandle.PROFILE_LEVEL", "0"));
 87         PROFILE_GWT = Boolean.parseBoolean(
 88                 props.getProperty("java.lang.invoke.MethodHandle.PROFILE_GWT", "true"));
 89         CUSTOMIZE_THRESHOLD = Integer.parseInt(
 90                 props.getProperty("java.lang.invoke.MethodHandle.CUSTOMIZE_THRESHOLD", "127"));


 91         VAR_HANDLE_GUARDS = Boolean.parseBoolean(
 92                 props.getProperty("java.lang.invoke.VarHandle.VAR_HANDLE_GUARDS", "true"));
 93         VAR_HANDLE_IDENTITY_ADAPT = Boolean.parseBoolean(
 94                 props.getProperty("java.lang.invoke.VarHandle.VAR_HANDLE_IDENTITY_ADAPT", "false"));
 95         VAR_HANDLE_SEGMENT_FORCE_EXACT = Boolean.parseBoolean(
 96                 props.getProperty("java.lang.invoke.VarHandle.VAR_HANDLE_SEGMENT_FORCE_EXACT", "false"));
 97 
 98         // Do not adjust this except for special platforms:
 99         MAX_ARITY = Integer.parseInt(
100                 props.getProperty("java.lang.invoke.MethodHandleImpl.MAX_ARITY", "255"));
101 
102         DUMP_CLASS_FILES = ClassFileDumper.getInstance("jdk.invoke.MethodHandle.dumpMethodHandleInternals",
103                 "DUMP_METHOD_HANDLE_INTERNALS");
104 
105         if (CUSTOMIZE_THRESHOLD < -1 || CUSTOMIZE_THRESHOLD > 127) {
106             throw newInternalError("CUSTOMIZE_THRESHOLD should be in [-1...127] range");
107         }
108     }
109 
110     /** Tell if any of the debugging switches are turned on.

 42  * Usage:  {@code import static java.lang.invoke.MethodHandleStatics.*}
 43  * @author John Rose, JSR 292 EG
 44  */
 45 /*non-public*/
 46 class MethodHandleStatics {
 47 
 48     private MethodHandleStatics() { }  // do not instantiate
 49 
 50     static final Unsafe UNSAFE = Unsafe.getUnsafe();
 51     static final int CLASSFILE_VERSION = ClassFileFormatVersion.latest().major();
 52     static final boolean DEBUG_METHOD_HANDLE_NAMES;
 53     static final boolean TRACE_INTERPRETER;
 54     static final boolean TRACE_METHOD_LINKAGE;
 55     static final boolean TRACE_RESOLVE;
 56     static final int COMPILE_THRESHOLD;
 57     static final boolean LOG_LF_COMPILATION_FAILURE;
 58     static final int DONT_INLINE_THRESHOLD;
 59     static final int PROFILE_LEVEL;
 60     static final boolean PROFILE_GWT;
 61     static final int CUSTOMIZE_THRESHOLD;
 62     static final boolean NO_SOFT_CACHE; // Don't use SoftReference for some tables so that they can be archived by CDS
 63     static final boolean VAR_HANDLE_GUARDS;
 64     static final int MAX_ARITY;
 65     static final boolean VAR_HANDLE_IDENTITY_ADAPT;
 66     static final boolean VAR_HANDLE_SEGMENT_FORCE_EXACT;
 67     static final ClassFileDumper DUMP_CLASS_FILES;
 68 
 69     static {
 70         Properties props = GetPropertyAction.privilegedGetProperties();
 71         DEBUG_METHOD_HANDLE_NAMES = Boolean.parseBoolean(
 72                 props.getProperty("java.lang.invoke.MethodHandle.DEBUG_NAMES"));
 73 
 74         TRACE_INTERPRETER = Boolean.parseBoolean(
 75                 props.getProperty("java.lang.invoke.MethodHandle.TRACE_INTERPRETER"));
 76         TRACE_METHOD_LINKAGE = Boolean.parseBoolean(
 77                 props.getProperty("java.lang.invoke.MethodHandle.TRACE_METHOD_LINKAGE"));
 78         TRACE_RESOLVE = Boolean.parseBoolean(
 79                 props.getProperty("java.lang.invoke.MethodHandle.TRACE_RESOLVE"));
 80         COMPILE_THRESHOLD = Integer.parseInt(
 81                 props.getProperty("java.lang.invoke.MethodHandle.COMPILE_THRESHOLD", "0"));
 82         LOG_LF_COMPILATION_FAILURE = Boolean.parseBoolean(
 83                 props.getProperty("java.lang.invoke.MethodHandle.LOG_LF_COMPILATION_FAILURE", "false"));
 84         DONT_INLINE_THRESHOLD = Integer.parseInt(
 85                 props.getProperty("java.lang.invoke.MethodHandle.DONT_INLINE_THRESHOLD", "30"));
 86         PROFILE_LEVEL = Integer.parseInt(
 87                 props.getProperty("java.lang.invoke.MethodHandle.PROFILE_LEVEL", "0"));
 88         PROFILE_GWT = Boolean.parseBoolean(
 89                 props.getProperty("java.lang.invoke.MethodHandle.PROFILE_GWT", "true"));
 90         CUSTOMIZE_THRESHOLD = Integer.parseInt(
 91                 props.getProperty("java.lang.invoke.MethodHandle.CUSTOMIZE_THRESHOLD", "127"));
 92         NO_SOFT_CACHE = Boolean.parseBoolean(
 93                 props.getProperty("java.lang.invoke.MethodHandle.NO_SOFT_CACHE", "false"));
 94         VAR_HANDLE_GUARDS = Boolean.parseBoolean(
 95                 props.getProperty("java.lang.invoke.VarHandle.VAR_HANDLE_GUARDS", "true"));
 96         VAR_HANDLE_IDENTITY_ADAPT = Boolean.parseBoolean(
 97                 props.getProperty("java.lang.invoke.VarHandle.VAR_HANDLE_IDENTITY_ADAPT", "false"));
 98         VAR_HANDLE_SEGMENT_FORCE_EXACT = Boolean.parseBoolean(
 99                 props.getProperty("java.lang.invoke.VarHandle.VAR_HANDLE_SEGMENT_FORCE_EXACT", "false"));
100 
101         // Do not adjust this except for special platforms:
102         MAX_ARITY = Integer.parseInt(
103                 props.getProperty("java.lang.invoke.MethodHandleImpl.MAX_ARITY", "255"));
104 
105         DUMP_CLASS_FILES = ClassFileDumper.getInstance("jdk.invoke.MethodHandle.dumpMethodHandleInternals",
106                 "DUMP_METHOD_HANDLE_INTERNALS");
107 
108         if (CUSTOMIZE_THRESHOLD < -1 || CUSTOMIZE_THRESHOLD > 127) {
109             throw newInternalError("CUSTOMIZE_THRESHOLD should be in [-1...127] range");
110         }
111     }
112 
113     /** Tell if any of the debugging switches are turned on.
< prev index next >