diff src/share/vm/graal/graalEnv.cpp @ 19426:dd8989d5547f

provide more detail when Graal code installation fails due to a failed dependency check
author Doug Simon <doug.simon@oracle.com>
date Tue, 17 Feb 2015 14:49:05 +0100
parents 98592ae4b1fa
children fb38e004503c
line wrap: on
line diff
--- a/src/share/vm/graal/graalEnv.cpp	Tue Feb 17 14:07:13 2015 +0100
+++ b/src/share/vm/graal/graalEnv.cpp	Tue Feb 17 14:49:05 2015 +0100
@@ -421,11 +421,12 @@
 // ------------------------------------------------------------------
 // Check for changes to the system dictionary during compilation
 // class loads, evolution, breakpoints
-bool GraalEnv::check_for_system_dictionary_modification(Dependencies* dependencies, GraalEnv* env) {
+bool GraalEnv::check_for_system_dictionary_modification(Dependencies* dependencies, Handle compiled_code, GraalEnv* env, TRAPS) {
   // If JVMTI capabilities were enabled during compile, the compilation is invalidated.
   if (env != NULL) {
     if (!env->_jvmti_can_hotswap_or_post_breakpoint && JvmtiExport::can_hotswap_or_post_breakpoint()) {
-      // Hotswapping or breakpointing was enabled during compilation
+      Handle message = java_lang_String::create_from_str("Hotswapping or breakpointing was enabled during compilation", THREAD);
+      HotSpotCompiledNmethod::set_installationFailureMessage(compiled_code, message());
       return false;
     }
   }
@@ -440,8 +441,13 @@
   }
 
   for (Dependencies::DepStream deps(dependencies); deps.next(); ) {
-    Klass*  witness = deps.check_dependency();
+    Klass* witness = deps.check_dependency();
     if (witness != NULL) {
+      ResourceMark rm;
+      stringStream st;
+      deps.print_dependency(witness, true, &st);
+      Handle message = java_lang_String::create_from_str(st.as_string(), THREAD);
+      HotSpotCompiledNmethod::set_installationFailureMessage(compiled_code, message());
       return false;
     }
     if (LogCompilation) {
@@ -470,6 +476,7 @@
                                 int compile_id,
                                 bool has_unsafe_access,
                                 Handle installed_code,
+                                Handle compiled_code,
                                 Handle speculation_log) {
   GRAAL_EXCEPTION_CONTEXT;
   NMethodSweeper::possibly_sweep();
@@ -487,7 +494,7 @@
     dependencies->encode_content_bytes();
 
     // Check for {class loads, evolution, breakpoints} during compilation
-    if (!check_for_system_dictionary_modification(dependencies, env)) {
+    if (!check_for_system_dictionary_modification(dependencies, compiled_code, env, THREAD)) {
       // While not a true deoptimization, it is a preemptive decompile.
       MethodData* mdp = method()->method_data();
       if (mdp != NULL) {