changeset 20502:13dbe89e447c

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
author iveresov
date Fri, 26 Sep 2014 20:09:02 -0700
parents c204e2044c29
children fa56205f142c 8ba0078861d4
files src/share/vm/classfile/systemDictionary.cpp
diffstat 1 files changed, 8 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/classfile/systemDictionary.cpp	Mon Sep 29 13:12:48 2014 +0200
+++ b/src/share/vm/classfile/systemDictionary.cpp	Fri Sep 26 20:09:02 2014 -0700
@@ -2276,12 +2276,14 @@
     spe = NULL;
     // Must create lots of stuff here, but outside of the SystemDictionary lock.
     m = Method::make_method_handle_intrinsic(iid, signature, CHECK_(empty));
-    CompileBroker::compile_method(m, InvocationEntryBci, CompLevel_highest_tier,
-                                  methodHandle(), CompileThreshold, "MH", CHECK_(empty));
-    // Check if we need to have compiled code but we don't.
-    if (!Arguments::is_interpreter_only() && !m->has_compiled_code()) {
-      THROW_MSG_(vmSymbols::java_lang_VirtualMachineError(),
-                 "out of space in CodeCache for method handle intrinsic", empty);
+    if (!Arguments::is_interpreter_only()) {
+      // Generate a compiled form of the MH intrinsic.
+      AdapterHandlerLibrary::create_native_wrapper(m);
+      // Check if have the compiled code.
+      if (!m->has_compiled_code()) {
+        THROW_MSG_(vmSymbols::java_lang_VirtualMachineError(),
+                   "out of space in CodeCache for method handle intrinsic", empty);
+      }
     }
     // Now grab the lock.  We might have to throw away the new method,
     // if a racing thread has managed to install one at the same time.