changeset 4583:597bc897257d

Made DebugInformationRecorder::describe_scope() take both a methodHandle _and_ a ciMethod* parameter to avoid creating handles in scopes where it is not allowed.
author Doug Simon <doug.simon@oracle.com>
date Mon, 13 Feb 2012 23:15:53 +0100
parents b24386206122
children 7e5d8d1c74a1 c148bec9398a 717589e14dbd
files hotspot/.project src/share/vm/c1/c1_IR.hpp src/share/vm/c1/c1_LIRAssembler.cpp src/share/vm/ci/ciMethod.cpp src/share/vm/code/debugInfoRec.cpp src/share/vm/code/debugInfoRec.hpp src/share/vm/graal/graalCodeInstaller.cpp src/share/vm/opto/output.cpp src/share/vm/shark/sharkCacheDecache.cpp
diffstat 9 files changed, 39 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/hotspot/.project	Mon Feb 13 23:13:37 2012 +0100
+++ b/hotspot/.project	Mon Feb 13 23:15:53 2012 +0100
@@ -96,6 +96,11 @@
 			<locationURI>PARENT-1-PROJECT_LOC/build/linux/linux_amd64_graal/generated</locationURI>
 		</link>
 		<link>
+			<name>make</name>
+			<type>2</type>
+			<locationURI>WORKSPACE_LOC/make</locationURI>
+		</link>
+		<link>
 			<name>os</name>
 			<type>2</type>
 			<locationURI>PARENT-1-PROJECT_LOC/src/os/linux</locationURI>
--- a/src/share/vm/c1/c1_IR.hpp	Mon Feb 13 23:13:37 2012 +0100
+++ b/src/share/vm/c1/c1_IR.hpp	Mon Feb 13 23:15:53 2012 +0100
@@ -237,8 +237,8 @@
     // reexecute allowed only for the topmost frame
     bool reexecute = topmost ? should_reexecute() : false;
     bool return_oop = false; // This flag will be ignored since it used only for C2 with escape analysis.
-    ResetNoHandleMark rnhm;
-    recorder->describe_scope(pc_offset, (methodOop)scope()->method()->get_oop(), bci(), reexecute, false, is_method_handle_invoke, return_oop, locvals, expvals, monvals);
+    methodHandle null_mh;
+    recorder->describe_scope(pc_offset, null_mh, scope()->method(), bci(), reexecute, false, is_method_handle_invoke, return_oop, locvals, expvals, monvals);
   }
 };
 
--- a/src/share/vm/c1/c1_LIRAssembler.cpp	Mon Feb 13 23:13:37 2012 +0100
+++ b/src/share/vm/c1/c1_LIRAssembler.cpp	Mon Feb 13 23:15:53 2012 +0100
@@ -405,8 +405,8 @@
     if (s == NULL)  break;
     IRScope* scope = s->scope();
     //Always pass false for reexecute since these ScopeDescs are never used for deopt
-    ResetNoHandleMark rnhm;
-    debug_info->describe_scope(pc_offset, (methodOop)scope->method()->get_oop(), s->bci(), false/*reexecute*/, false/*rethrow_exception*/);
+    methodHandle null_mh;
+    debug_info->describe_scope(pc_offset, null_mh, scope->method(), s->bci(), false/*reexecute*/);
   }
 
   debug_info->end_non_safepoint(pc_offset);
--- a/src/share/vm/ci/ciMethod.cpp	Mon Feb 13 23:13:37 2012 +0100
+++ b/src/share/vm/ci/ciMethod.cpp	Mon Feb 13 23:15:53 2012 +0100
@@ -97,12 +97,11 @@
   ciEnv *env = CURRENT_ENV;
   if (env->jvmti_can_hotswap_or_post_breakpoint() && can_be_compiled()) {
     // 6328518 check hotswap conditions under the right lock.
-    // TODO(tw): Check if we need that.
-    //MutexLocker locker(Compile_lock);
-    //if (Dependencies::check_evol_method(h_m()) != NULL) {
-    //  _is_c1_compilable = false;
-    //  _is_c2_compilable = false;
-    //}
+    MutexLocker locker(Compile_lock);
+    if (Dependencies::check_evol_method(h_m()) != NULL) {
+      _is_c1_compilable = false;
+      _is_c2_compilable = false;
+    }
   } else {
     CHECK_UNHANDLED_OOPS_ONLY(Thread::current()->clear_unhandled_oops());
   }
--- a/src/share/vm/code/debugInfoRec.cpp	Mon Feb 13 23:13:37 2012 +0100
+++ b/src/share/vm/code/debugInfoRec.cpp	Mon Feb 13 23:15:53 2012 +0100
@@ -280,7 +280,8 @@
 // must call add_safepoint before: it sets PcDesc and this routine uses
 // the last PcDesc set
 void DebugInformationRecorder::describe_scope(int         pc_offset,
-                                              methodHandle   method,
+                                              methodHandle methodH,
+                                              ciMethod*   method,
                                               int         bci,
                                               bool        reexecute,
                                               bool        rethrow_exception,
@@ -307,13 +308,24 @@
   stream()->write_int(sender_stream_offset);
 
   // serialize scope
-  jobject method_enc = JNIHandles::make_local(Thread::current(), method());
+  jobject method_enc;
+  if (method != NULL) {
+    method_enc = method->constant_encoding();
+  } else if (methodH.not_null()) {
+    method_enc = JNIHandles::make_local(Thread::current(), methodH());
+  } else {
+    method_enc = NULL;
+  }
   stream()->write_int(oop_recorder()->find_index(method_enc));
   stream()->write_bci(bci);
   assert(method == NULL ||
          (method->is_native() && bci == 0) ||
          (!method->is_native() && 0 <= bci && bci < method->code_size()) ||
          bci == -1, "illegal bci");
+  assert(methodH.is_null() ||
+         (methodH->is_native() && bci == 0) ||
+         (!methodH->is_native() && 0 <= bci && bci < methodH->code_size()) ||
+         bci == -1, "illegal bci");
 
   // serialize the locals/expressions/monitors
   stream()->write_int((intptr_t) locals);
--- a/src/share/vm/code/debugInfoRec.hpp	Mon Feb 13 23:13:37 2012 +0100
+++ b/src/share/vm/code/debugInfoRec.hpp	Mon Feb 13 23:15:53 2012 +0100
@@ -98,7 +98,8 @@
   // by add_non_safepoint, and the locals, expressions, and monitors
   // must all be null.
   void describe_scope(int         pc_offset,
-                      methodHandle   method,
+                      methodHandle methodH,
+                      ciMethod*   method,
                       int         bci,
                       bool        reexecute,
                       bool        rethrow_exception = false,
--- a/src/share/vm/graal/graalCodeInstaller.cpp	Mon Feb 13 23:13:37 2012 +0100
+++ b/src/share/vm/graal/graalCodeInstaller.cpp	Mon Feb 13 23:15:53 2012 +0100
@@ -536,9 +536,9 @@
       throw_exception = true;
     }
 
-    _debug_recorder->describe_scope(pc_offset, method, bci, reexecute, throw_exception, false, false, locals_token, expressions_token, monitors_token);
+    _debug_recorder->describe_scope(pc_offset, method, NULL, bci, reexecute, throw_exception, false, false, locals_token, expressions_token, monitors_token);
   } else {
-    _debug_recorder->describe_scope(pc_offset, method, bci, reexecute, false, false, false, NULL, NULL, NULL);
+    _debug_recorder->describe_scope(pc_offset, method, NULL, bci, reexecute, false, false, false, NULL, NULL, NULL);
   }
 }
 
--- a/src/share/vm/opto/output.cpp	Mon Feb 13 23:13:37 2012 +0100
+++ b/src/share/vm/opto/output.cpp	Mon Feb 13 23:15:53 2012 +0100
@@ -944,7 +944,9 @@
     assert(jvms->bci() >= InvocationEntryBci && jvms->bci() <= 0x10000, "must be a valid or entry BCI");
     assert(!jvms->should_reexecute() || depth == max_depth, "reexecute allowed only for the youngest");
     // Now we can describe the scope.
-    debug_info()->describe_scope(safepoint_pc_offset, (methodOop)scope_method->get_oop(), jvms->bci(), jvms->should_reexecute(), is_method_handle_invoke, return_oop, locvals, expvals, monvals);
+    methodHandle null_mh;
+    bool rethrow_exception = false;
+    debug_info()->describe_scope(safepoint_pc_offset, null_mh, scope_method, jvms->bci(), jvms->should_reexecute(), rethrow_exception, is_method_handle_invoke, return_oop, locvals, expvals, monvals);
   } // End jvms loop
 
   // Mark the end of the scope set.
@@ -1027,7 +1029,8 @@
     JVMState* jvms = youngest_jvms->of_depth(depth);
     ciMethod* method = jvms->has_method() ? jvms->method() : NULL;
     assert(!jvms->should_reexecute() || depth==max_depth, "reexecute allowed only for the youngest");
-    debug_info->describe_scope(pc_offset, (methodOop)method->get_oop(), jvms->bci(), jvms->should_reexecute());
+    methodHandle null_mh;
+    debug_info->describe_scope(pc_offset, null_mh, method, jvms->bci(), jvms->should_reexecute());
   }
 
   // Mark the end of the scope set.
--- a/src/share/vm/shark/sharkCacheDecache.cpp	Mon Feb 13 23:13:37 2012 +0100
+++ b/src/share/vm/shark/sharkCacheDecache.cpp	Mon Feb 13 23:15:53 2012 +0100
@@ -151,8 +151,10 @@
 
 void SharkDecacher::end_frame() {
   // Record the scope
+  methodHandle null_mh;
   debug_info()->describe_scope(
     pc_offset(),
+    null_mh,
     target(),
     bci(),
     true,