src/share/vm/prims/methodHandles.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File 7010180 Cdiff src/share/vm/prims/methodHandles.cpp

src/share/vm/prims/methodHandles.cpp

Print this page

        

*** 109,119 **** //------------------------------------------------------------------------------ // MethodHandles::generate_adapters // ! void MethodHandles::generate_adapters(TRAPS) { if (!EnableMethodHandles || SystemDictionary::MethodHandle_klass() == NULL) return; assert(_adapter_code == NULL, "generate only once"); ResourceMark rm; --- 109,119 ---- //------------------------------------------------------------------------------ // MethodHandles::generate_adapters // ! void MethodHandles::generate_adapters() { if (!EnableMethodHandles || SystemDictionary::MethodHandle_klass() == NULL) return; assert(_adapter_code == NULL, "generate only once"); ResourceMark rm;
*** 121,144 **** _adapter_code = MethodHandlesAdapterBlob::create(_adapter_code_size); if (_adapter_code == NULL) vm_exit_out_of_memory(_adapter_code_size, "CodeCache: no room for MethodHandles adapters"); CodeBuffer code(_adapter_code); MethodHandlesAdapterGenerator g(&code); ! g.generate(CHECK); } //------------------------------------------------------------------------------ // MethodHandlesAdapterGenerator::generate // ! void MethodHandlesAdapterGenerator::generate(TRAPS) { // Generate generic method handle adapters. for (MethodHandles::EntryKind ek = MethodHandles::_EK_FIRST; ek < MethodHandles::_EK_LIMIT; ek = MethodHandles::EntryKind(1 + (int)ek)) { StubCodeMark mark(this, "MethodHandle", MethodHandles::entry_name(ek)); ! MethodHandles::generate_method_handle_stub(_masm, ek, CHECK); } } void MethodHandles::set_enabled(bool z) { --- 121,144 ---- _adapter_code = MethodHandlesAdapterBlob::create(_adapter_code_size); if (_adapter_code == NULL) vm_exit_out_of_memory(_adapter_code_size, "CodeCache: no room for MethodHandles adapters"); CodeBuffer code(_adapter_code); MethodHandlesAdapterGenerator g(&code); ! g.generate(); } //------------------------------------------------------------------------------ // MethodHandlesAdapterGenerator::generate // ! void MethodHandlesAdapterGenerator::generate() { // Generate generic method handle adapters. for (MethodHandles::EntryKind ek = MethodHandles::_EK_FIRST; ek < MethodHandles::_EK_LIMIT; ek = MethodHandles::EntryKind(1 + (int)ek)) { StubCodeMark mark(this, "MethodHandle", MethodHandles::entry_name(ek)); ! MethodHandles::generate_method_handle_stub(_masm, ek); } } void MethodHandles::set_enabled(bool z) {
*** 2619,2632 **** --- 2619,2642 ---- MethodHandles::set_raise_exception_method(raiseException_method); } else { warning("JSR 292 method handle code is mismatched to this JVM. Disabling support."); enable_MH = false; } + } else { + enable_MH = false; } } if (enable_MH) { + // We need to link the MethodHandleImpl klass before we generate + // the method handle adapters as the _raise_exception adapter uses + // one of its methods (and its c2i-adapter). + KlassHandle k = SystemDictionaryHandles::MethodHandleImpl_klass(); + instanceKlass* ik = instanceKlass::cast(k()); + ik->link_class(CHECK); + + MethodHandles::generate_adapters(); MethodHandles::set_enabled(true); } if (!EnableInvokeDynamic) { warning("JSR 292 invokedynamic is disabled in this JVM. Use -XX:+UnlockExperimentalVMOptions -XX:+EnableInvokeDynamic to enable.");
*** 2643,2654 **** env->ExceptionClear(); } else { MethodHandles::set_enabled(true); } } - - // Generate method handles adapters if enabled. - if (MethodHandles::enabled()) { - MethodHandles::generate_adapters(CHECK); - } } JVM_END --- 2653,2659 ----
src/share/vm/prims/methodHandles.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File