diff src/share/vm/code/debugInfoRec.cpp @ 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 0e8a2a629afb
children 51111665eda6
line wrap: on
line diff
--- 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);