changeset 20458:0d78074d2444

8058092: Test vm/mlvm/meth/stress/compiler/deoptimize. Assert in src/share/vm/classfile/systemDictionary.cpp: MH intrinsic invariant Summary: Throw exception if unable to compile an MH intrinsic Reviewed-by: kvn
author iveresov
date Wed, 10 Sep 2014 19:08:17 -0700
parents 631667807de7
children a98dd542cd25
files src/share/vm/classfile/systemDictionary.cpp src/share/vm/runtime/arguments.hpp
diffstat 2 files changed, 10 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/classfile/systemDictionary.cpp	Thu Sep 11 12:18:26 2014 -0700
+++ b/src/share/vm/classfile/systemDictionary.cpp	Wed Sep 10 19:08:17 2014 -0700
@@ -51,6 +51,7 @@
 #include "oops/typeArrayKlass.hpp"
 #include "prims/jvmtiEnvBase.hpp"
 #include "prims/methodHandles.hpp"
+#include "runtime/arguments.hpp"
 #include "runtime/biasedLocking.hpp"
 #include "runtime/fieldType.hpp"
 #include "runtime/handles.inline.hpp"
@@ -2277,7 +2278,11 @@
     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);
+    }
     // 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.
     {
@@ -2291,7 +2296,7 @@
   }
 
   assert(spe != NULL && spe->method() != NULL, "");
-  assert(!UseCompiler || (spe->method()->has_compiled_code() &&
+  assert(Arguments::is_interpreter_only() || (spe->method()->has_compiled_code() &&
          spe->method()->code()->entry_point() == spe->method()->from_compiled_entry()),
          "MH intrinsic invariant");
   return spe->method();
--- a/src/share/vm/runtime/arguments.hpp	Thu Sep 11 12:18:26 2014 -0700
+++ b/src/share/vm/runtime/arguments.hpp	Wed Sep 10 19:08:17 2014 -0700
@@ -601,7 +601,9 @@
   static void  fix_appclasspath();
 
   // Operation modi
-  static Mode mode()                        { return _mode; }
+  static Mode mode()                { return _mode; }
+  static bool is_interpreter_only() { return mode() == _int; }
+
 
   // Utility: copies src into buf, replacing "%%" with "%" and "%p" with pid.
   static bool copy_expand_pid(const char* src, size_t srclen, char* buf, size_t buflen);