hotspot/src/share/vm/classfile/systemDictionary.cpp
changeset 26585 2048b8d90c91
parent 26583 2ef7b85da46b
child 26911 8f2c7a83220f
equal deleted inserted replaced
26584:43335aea982b 26585:2048b8d90c91
    50 #include "oops/oop.inline.hpp"
    50 #include "oops/oop.inline.hpp"
    51 #include "oops/oop.inline2.hpp"
    51 #include "oops/oop.inline2.hpp"
    52 #include "oops/typeArrayKlass.hpp"
    52 #include "oops/typeArrayKlass.hpp"
    53 #include "prims/jvmtiEnvBase.hpp"
    53 #include "prims/jvmtiEnvBase.hpp"
    54 #include "prims/methodHandles.hpp"
    54 #include "prims/methodHandles.hpp"
       
    55 #include "runtime/arguments.hpp"
    55 #include "runtime/biasedLocking.hpp"
    56 #include "runtime/biasedLocking.hpp"
    56 #include "runtime/fieldType.hpp"
    57 #include "runtime/fieldType.hpp"
    57 #include "runtime/handles.inline.hpp"
    58 #include "runtime/handles.inline.hpp"
    58 #include "runtime/java.hpp"
    59 #include "runtime/java.hpp"
    59 #include "runtime/javaCalls.hpp"
    60 #include "runtime/javaCalls.hpp"
  2272     spe = NULL;
  2273     spe = NULL;
  2273     // Must create lots of stuff here, but outside of the SystemDictionary lock.
  2274     // Must create lots of stuff here, but outside of the SystemDictionary lock.
  2274     m = Method::make_method_handle_intrinsic(iid, signature, CHECK_(empty));
  2275     m = Method::make_method_handle_intrinsic(iid, signature, CHECK_(empty));
  2275     CompileBroker::compile_method(m, InvocationEntryBci, CompLevel_highest_tier,
  2276     CompileBroker::compile_method(m, InvocationEntryBci, CompLevel_highest_tier,
  2276                                   methodHandle(), CompileThreshold, "MH", CHECK_(empty));
  2277                                   methodHandle(), CompileThreshold, "MH", CHECK_(empty));
  2277 
  2278     // Check if we need to have compiled code but we don't.
       
  2279     if (!Arguments::is_interpreter_only() && !m->has_compiled_code()) {
       
  2280       THROW_MSG_(vmSymbols::java_lang_VirtualMachineError(),
       
  2281                  "out of space in CodeCache for method handle intrinsic", empty);
       
  2282     }
  2278     // Now grab the lock.  We might have to throw away the new method,
  2283     // Now grab the lock.  We might have to throw away the new method,
  2279     // if a racing thread has managed to install one at the same time.
  2284     // if a racing thread has managed to install one at the same time.
  2280     {
  2285     {
  2281       MutexLocker ml(SystemDictionary_lock, THREAD);
  2286       MutexLocker ml(SystemDictionary_lock, THREAD);
  2282       spe = invoke_method_table()->find_entry(index, hash, signature, iid);
  2287       spe = invoke_method_table()->find_entry(index, hash, signature, iid);
  2286         spe->set_method(m());
  2291         spe->set_method(m());
  2287     }
  2292     }
  2288   }
  2293   }
  2289 
  2294 
  2290   assert(spe != NULL && spe->method() != NULL, "");
  2295   assert(spe != NULL && spe->method() != NULL, "");
  2291   assert(!UseCompiler || (spe->method()->has_compiled_code() &&
  2296   assert(Arguments::is_interpreter_only() || (spe->method()->has_compiled_code() &&
  2292          spe->method()->code()->entry_point() == spe->method()->from_compiled_entry()),
  2297          spe->method()->code()->entry_point() == spe->method()->from_compiled_entry()),
  2293          "MH intrinsic invariant");
  2298          "MH intrinsic invariant");
  2294   return spe->method();
  2299   return spe->method();
  2295 }
  2300 }
  2296 
  2301