src/java.base/share/classes/java/lang/invoke/MethodHandleStatics.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File jdk Sdiff src/java.base/share/classes/java/lang/invoke

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

Print this page
rev 10938 : [mq]: remove.use_lf_editor


  28 import java.security.AccessController;
  29 import java.security.PrivilegedAction;
  30 import sun.misc.Unsafe;
  31 
  32 /**
  33  * This class consists exclusively of static names internal to the
  34  * method handle implementation.
  35  * Usage:  {@code import static java.lang.invoke.MethodHandleStatics.*}
  36  * @author John Rose, JSR 292 EG
  37  */
  38 /*non-public*/ class MethodHandleStatics {
  39 
  40     private MethodHandleStatics() { }  // do not instantiate
  41 
  42     static final Unsafe UNSAFE = Unsafe.getUnsafe();
  43 
  44     static final boolean DEBUG_METHOD_HANDLE_NAMES;
  45     static final boolean DUMP_CLASS_FILES;
  46     static final boolean TRACE_INTERPRETER;
  47     static final boolean TRACE_METHOD_LINKAGE;
  48     static final boolean USE_LAMBDA_FORM_EDITOR;
  49     static final int COMPILE_THRESHOLD;
  50     static final int DONT_INLINE_THRESHOLD;
  51     static final int PROFILE_LEVEL;
  52 
  53     static {
  54         final Object[] values = new Object[8];
  55         AccessController.doPrivileged(new PrivilegedAction<Void>() {
  56                 public Void run() {
  57                     values[0] = Boolean.getBoolean("java.lang.invoke.MethodHandle.DEBUG_NAMES");
  58                     values[1] = Boolean.getBoolean("java.lang.invoke.MethodHandle.DUMP_CLASS_FILES");
  59                     values[2] = Boolean.getBoolean("java.lang.invoke.MethodHandle.TRACE_INTERPRETER");
  60                     values[3] = Boolean.getBoolean("java.lang.invoke.MethodHandle.TRACE_METHOD_LINKAGE");
  61                     values[4] = Boolean.getBoolean("java.lang.invoke.MethodHandle.USE_LF_EDITOR");
  62                     values[5] = Integer.getInteger("java.lang.invoke.MethodHandle.COMPILE_THRESHOLD", 30);
  63                     values[6] = Integer.getInteger("java.lang.invoke.MethodHandle.DONT_INLINE_THRESHOLD", 30);
  64                     values[7] = Integer.getInteger("java.lang.invoke.MethodHandle.PROFILE_LEVEL", 0);
  65                     return null;
  66                 }
  67             });
  68         DEBUG_METHOD_HANDLE_NAMES = (Boolean) values[0];
  69         DUMP_CLASS_FILES          = (Boolean) values[1];
  70         TRACE_INTERPRETER         = (Boolean) values[2];
  71         TRACE_METHOD_LINKAGE      = (Boolean) values[3];
  72         USE_LAMBDA_FORM_EDITOR    = (Boolean) values[4];
  73         COMPILE_THRESHOLD         = (Integer) values[5];
  74         DONT_INLINE_THRESHOLD     = (Integer) values[6];
  75         PROFILE_LEVEL             = (Integer) values[7];
  76     }
  77 
  78     /** Tell if any of the debugging switches are turned on.
  79      *  If this is the case, it is reasonable to perform extra checks or save extra information.
  80      */
  81     /*non-public*/ static boolean debugEnabled() {
  82         return (DEBUG_METHOD_HANDLE_NAMES |
  83                 DUMP_CLASS_FILES |
  84                 TRACE_INTERPRETER |
  85                 TRACE_METHOD_LINKAGE);
  86     }
  87 
  88     /*non-public*/ static String getNameString(MethodHandle target, MethodType type) {
  89         if (type == null)
  90             type = target.type();
  91         MemberName name = null;
  92         if (target != null)
  93             name = target.internalMemberName();
  94         if (name == null)
  95             return "invoke" + type;




  28 import java.security.AccessController;
  29 import java.security.PrivilegedAction;
  30 import sun.misc.Unsafe;
  31 
  32 /**
  33  * This class consists exclusively of static names internal to the
  34  * method handle implementation.
  35  * Usage:  {@code import static java.lang.invoke.MethodHandleStatics.*}
  36  * @author John Rose, JSR 292 EG
  37  */
  38 /*non-public*/ class MethodHandleStatics {
  39 
  40     private MethodHandleStatics() { }  // do not instantiate
  41 
  42     static final Unsafe UNSAFE = Unsafe.getUnsafe();
  43 
  44     static final boolean DEBUG_METHOD_HANDLE_NAMES;
  45     static final boolean DUMP_CLASS_FILES;
  46     static final boolean TRACE_INTERPRETER;
  47     static final boolean TRACE_METHOD_LINKAGE;

  48     static final int COMPILE_THRESHOLD;
  49     static final int DONT_INLINE_THRESHOLD;
  50     static final int PROFILE_LEVEL;
  51 
  52     static {
  53         final Object[] values = new Object[7];
  54         AccessController.doPrivileged(new PrivilegedAction<Void>() {
  55                 public Void run() {
  56                     values[0] = Boolean.getBoolean("java.lang.invoke.MethodHandle.DEBUG_NAMES");
  57                     values[1] = Boolean.getBoolean("java.lang.invoke.MethodHandle.DUMP_CLASS_FILES");
  58                     values[2] = Boolean.getBoolean("java.lang.invoke.MethodHandle.TRACE_INTERPRETER");
  59                     values[3] = Boolean.getBoolean("java.lang.invoke.MethodHandle.TRACE_METHOD_LINKAGE");
  60                     values[4] = Integer.getInteger("java.lang.invoke.MethodHandle.COMPILE_THRESHOLD", 30);
  61                     values[5] = Integer.getInteger("java.lang.invoke.MethodHandle.DONT_INLINE_THRESHOLD", 30);
  62                     values[6] = Integer.getInteger("java.lang.invoke.MethodHandle.PROFILE_LEVEL", 0);

  63                     return null;
  64                 }
  65             });
  66         DEBUG_METHOD_HANDLE_NAMES = (Boolean) values[0];
  67         DUMP_CLASS_FILES          = (Boolean) values[1];
  68         TRACE_INTERPRETER         = (Boolean) values[2];
  69         TRACE_METHOD_LINKAGE      = (Boolean) values[3];
  70         COMPILE_THRESHOLD         = (Integer) values[4];
  71         DONT_INLINE_THRESHOLD     = (Integer) values[5];
  72         PROFILE_LEVEL             = (Integer) values[6];

  73     }
  74 
  75     /** Tell if any of the debugging switches are turned on.
  76      *  If this is the case, it is reasonable to perform extra checks or save extra information.
  77      */
  78     /*non-public*/ static boolean debugEnabled() {
  79         return (DEBUG_METHOD_HANDLE_NAMES |
  80                 DUMP_CLASS_FILES |
  81                 TRACE_INTERPRETER |
  82                 TRACE_METHOD_LINKAGE);
  83     }
  84 
  85     /*non-public*/ static String getNameString(MethodHandle target, MethodType type) {
  86         if (type == null)
  87             type = target.type();
  88         MemberName name = null;
  89         if (target != null)
  90             name = target.internalMemberName();
  91         if (name == null)
  92             return "invoke" + type;


src/java.base/share/classes/java/lang/invoke/MethodHandleStatics.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File