hotspot/src/share/vm/prims/methodHandles.cpp
changeset 24322 c2978d1578e3
parent 22250 fe165bf76695
child 24424 2658d7834c6e
equal deleted inserted replaced
24320:394d55c783dc 24322:c2978d1578e3
    57 
    57 
    58 //------------------------------------------------------------------------------
    58 //------------------------------------------------------------------------------
    59 // MethodHandles::generate_adapters
    59 // MethodHandles::generate_adapters
    60 //
    60 //
    61 void MethodHandles::generate_adapters() {
    61 void MethodHandles::generate_adapters() {
    62   if (!EnableInvokeDynamic || SystemDictionary::MethodHandle_klass() == NULL)  return;
    62   if (SystemDictionary::MethodHandle_klass() == NULL)  return;
    63 
    63 
    64   assert(_adapter_code == NULL, "generate only once");
    64   assert(_adapter_code == NULL, "generate only once");
    65 
    65 
    66   ResourceMark rm;
    66   ResourceMark rm;
    67   TraceTime timer("MethodHandles adapters generation", TraceStartupTime);
    67   TraceTime timer("MethodHandles adapters generation", TraceStartupTime);
    96   }
    96   }
    97 }
    97 }
    98 
    98 
    99 void MethodHandles::set_enabled(bool z) {
    99 void MethodHandles::set_enabled(bool z) {
   100   if (_enabled != z) {
   100   if (_enabled != z) {
   101     guarantee(z && EnableInvokeDynamic, "can only enable once, and only if -XX:+EnableInvokeDynamic");
   101     guarantee(z, "can only enable once");
   102     _enabled = z;
   102     _enabled = z;
   103   }
   103   }
   104 }
   104 }
   105 
   105 
   106 // MemberName support
   106 // MemberName support
  1372 
  1372 
  1373 /**
  1373 /**
  1374  * This one function is exported, used by NativeLookup.
  1374  * This one function is exported, used by NativeLookup.
  1375  */
  1375  */
  1376 JVM_ENTRY(void, JVM_RegisterMethodHandleMethods(JNIEnv *env, jclass MHN_class)) {
  1376 JVM_ENTRY(void, JVM_RegisterMethodHandleMethods(JNIEnv *env, jclass MHN_class)) {
  1377   if (!EnableInvokeDynamic) {
       
  1378     warning("JSR 292 is disabled in this JVM.  Use -XX:+UnlockDiagnosticVMOptions -XX:+EnableInvokeDynamic to enable.");
       
  1379     return;  // bind nothing
       
  1380   }
       
  1381 
       
  1382   assert(!MethodHandles::enabled(), "must not be enabled");
  1377   assert(!MethodHandles::enabled(), "must not be enabled");
  1383   bool enable_MH = true;
  1378   bool enable_MH = true;
  1384 
  1379 
  1385   jclass MH_class = NULL;
  1380   jclass MH_class = NULL;
  1386   if (SystemDictionary::MethodHandle_klass() == NULL) {
  1381   if (SystemDictionary::MethodHandle_klass() == NULL) {