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 11254 : 8063137: Never-taken branches should be pruned when GWT LambdaForms are shared
Reviewed-by: ?
rev 11258 : 8069591: Customize LambdaForms which are invoked using MH.invoke/invokeExact
Reviewed-by: ?


  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     static final boolean PROFILE_GWT;

  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] = Integer.getInteger("java.lang.invoke.MethodHandle.COMPILE_THRESHOLD", 0);
  62                     values[5] = Integer.getInteger("java.lang.invoke.MethodHandle.DONT_INLINE_THRESHOLD", 30);
  63                     values[6] = Integer.getInteger("java.lang.invoke.MethodHandle.PROFILE_LEVEL", 0);
  64                     values[7] = Boolean.parseBoolean(System.getProperty("java.lang.invoke.MethodHandle.PROFILE_GWT", "true"));

  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         COMPILE_THRESHOLD         = (Integer) values[4];
  73         DONT_INLINE_THRESHOLD     = (Integer) values[5];
  74         PROFILE_LEVEL             = (Integer) values[6];
  75         PROFILE_GWT               = (Boolean) 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;




  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     static final boolean PROFILE_GWT;
  52     static final int CUSTOMIZE_THRESHOLD;
  53 
  54     static {
  55         final Object[] values = new Object[9];
  56         AccessController.doPrivileged(new PrivilegedAction<Void>() {
  57                 public Void run() {
  58                     values[0] = Boolean.getBoolean("java.lang.invoke.MethodHandle.DEBUG_NAMES");
  59                     values[1] = Boolean.getBoolean("java.lang.invoke.MethodHandle.DUMP_CLASS_FILES");
  60                     values[2] = Boolean.getBoolean("java.lang.invoke.MethodHandle.TRACE_INTERPRETER");
  61                     values[3] = Boolean.getBoolean("java.lang.invoke.MethodHandle.TRACE_METHOD_LINKAGE");
  62                     values[4] = Integer.getInteger("java.lang.invoke.MethodHandle.COMPILE_THRESHOLD", 0);
  63                     values[5] = Integer.getInteger("java.lang.invoke.MethodHandle.DONT_INLINE_THRESHOLD", 30);
  64                     values[6] = Integer.getInteger("java.lang.invoke.MethodHandle.PROFILE_LEVEL", 0);
  65                     values[7] = Boolean.parseBoolean(System.getProperty("java.lang.invoke.MethodHandle.PROFILE_GWT", "true"));
  66                     values[8] = Integer.getInteger("java.lang.invoke.MethodHandle.CUSTOMIZE_THRESHOLD", 127);
  67                     return null;
  68                 }
  69             });
  70         DEBUG_METHOD_HANDLE_NAMES = (Boolean) values[0];
  71         DUMP_CLASS_FILES          = (Boolean) values[1];
  72         TRACE_INTERPRETER         = (Boolean) values[2];
  73         TRACE_METHOD_LINKAGE      = (Boolean) values[3];
  74         COMPILE_THRESHOLD         = (Integer) values[4];
  75         DONT_INLINE_THRESHOLD     = (Integer) values[5];
  76         PROFILE_LEVEL             = (Integer) values[6];
  77         PROFILE_GWT               = (Boolean) values[7];
  78         CUSTOMIZE_THRESHOLD       = (Integer) values[8];
  79 
  80         if (CUSTOMIZE_THRESHOLD < -1 || CUSTOMIZE_THRESHOLD > 127) {
  81             throw newInternalError("CUSTOMIZE_THRESHOLD should be in [-1...127] range");
  82         }
  83     }
  84 
  85     /** Tell if any of the debugging switches are turned on.
  86      *  If this is the case, it is reasonable to perform extra checks or save extra information.
  87      */
  88     /*non-public*/ static boolean debugEnabled() {
  89         return (DEBUG_METHOD_HANDLE_NAMES |
  90                 DUMP_CLASS_FILES |
  91                 TRACE_INTERPRETER |
  92                 TRACE_METHOD_LINKAGE);
  93     }
  94 
  95     /*non-public*/ static String getNameString(MethodHandle target, MethodType type) {
  96         if (type == null)
  97             type = target.type();
  98         MemberName name = null;
  99         if (target != null)
 100             name = target.internalMemberName();
 101         if (name == null)
 102             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