8058536: java/lang/instrument/NativeMethodPrefixAgent.java fails due to VirtualMachineError: out of space in CodeCache for method handle intrinsic

Fri, 26 Sep 2014 20:09:02 -0700

author
iveresov
date
Fri, 26 Sep 2014 20:09:02 -0700
changeset 7216
13dbe89e447c
parent 7215
c204e2044c29
child 7217
fa56205f142c
child 7219
8ba0078861d4

8058536: java/lang/instrument/NativeMethodPrefixAgent.java fails due to VirtualMachineError: out of space in CodeCache for method handle intrinsic
Summary: Make sure MH intrinsics can be created before compiler instances
Reviewed-by: kvn

src/share/vm/classfile/systemDictionary.cpp file | annotate | diff | comparison | revisions
     1.1 --- a/src/share/vm/classfile/systemDictionary.cpp	Mon Sep 29 13:12:48 2014 +0200
     1.2 +++ b/src/share/vm/classfile/systemDictionary.cpp	Fri Sep 26 20:09:02 2014 -0700
     1.3 @@ -2276,12 +2276,14 @@
     1.4      spe = NULL;
     1.5      // Must create lots of stuff here, but outside of the SystemDictionary lock.
     1.6      m = Method::make_method_handle_intrinsic(iid, signature, CHECK_(empty));
     1.7 -    CompileBroker::compile_method(m, InvocationEntryBci, CompLevel_highest_tier,
     1.8 -                                  methodHandle(), CompileThreshold, "MH", CHECK_(empty));
     1.9 -    // Check if we need to have compiled code but we don't.
    1.10 -    if (!Arguments::is_interpreter_only() && !m->has_compiled_code()) {
    1.11 -      THROW_MSG_(vmSymbols::java_lang_VirtualMachineError(),
    1.12 -                 "out of space in CodeCache for method handle intrinsic", empty);
    1.13 +    if (!Arguments::is_interpreter_only()) {
    1.14 +      // Generate a compiled form of the MH intrinsic.
    1.15 +      AdapterHandlerLibrary::create_native_wrapper(m);
    1.16 +      // Check if have the compiled code.
    1.17 +      if (!m->has_compiled_code()) {
    1.18 +        THROW_MSG_(vmSymbols::java_lang_VirtualMachineError(),
    1.19 +                   "out of space in CodeCache for method handle intrinsic", empty);
    1.20 +      }
    1.21      }
    1.22      // Now grab the lock.  We might have to throw away the new method,
    1.23      // if a racing thread has managed to install one at the same time.

mercurial