diff src/share/vm/oops/constantPool.hpp @ 12292:084b21cd0228

8025088: Missing cases for JVM_CONSTANT_MethodHandleInError cause crash if debugger steps into error-tagged method handle Summary: Need to refetch each method from InstanceKlass after all safepoints. Removed leaky PreviousVersionInfo code. Reviewed-by: coleenp, sspitsyn
author iklam
date Mon, 23 Sep 2013 08:56:19 -0700
parents a7609ec351d6
children cefad50507d8 b8860472c377
line wrap: on
line diff
--- a/src/share/vm/oops/constantPool.hpp	Sun Sep 22 18:07:43 2013 +0200
+++ b/src/share/vm/oops/constantPool.hpp	Mon Sep 23 08:56:19 2013 -0700
@@ -474,18 +474,42 @@
     return *int_at_addr(which);
   }
 
+ private:
+  int method_handle_ref_kind_at(int which, bool error_ok) {
+    assert(tag_at(which).is_method_handle() ||
+           (error_ok && tag_at(which).is_method_handle_in_error()), "Corrupted constant pool");
+    return extract_low_short_from_int(*int_at_addr(which));  // mask out unwanted ref_index bits
+  }
+  int method_handle_index_at(int which, bool error_ok) {
+    assert(tag_at(which).is_method_handle() ||
+           (error_ok && tag_at(which).is_method_handle_in_error()), "Corrupted constant pool");
+    return extract_high_short_from_int(*int_at_addr(which));  // shift out unwanted ref_kind bits
+  }
+  int method_type_index_at(int which, bool error_ok) {
+    assert(tag_at(which).is_method_type() ||
+           (error_ok && tag_at(which).is_method_type_in_error()), "Corrupted constant pool");
+    return *int_at_addr(which);
+  }
+ public:
   int method_handle_ref_kind_at(int which) {
-    assert(tag_at(which).is_method_handle(), "Corrupted constant pool");
-    return extract_low_short_from_int(*int_at_addr(which));  // mask out unwanted ref_index bits
+    return method_handle_ref_kind_at(which, false);
+  }
+  int method_handle_ref_kind_at_error_ok(int which) {
+    return method_handle_ref_kind_at(which, true);
   }
   int method_handle_index_at(int which) {
-    assert(tag_at(which).is_method_handle(), "Corrupted constant pool");
-    return extract_high_short_from_int(*int_at_addr(which));  // shift out unwanted ref_kind bits
+    return method_handle_index_at(which, false);
+  }
+  int method_handle_index_at_error_ok(int which) {
+    return method_handle_index_at(which, true);
   }
   int method_type_index_at(int which) {
-    assert(tag_at(which).is_method_type(), "Corrupted constant pool");
-    return *int_at_addr(which);
+    return method_type_index_at(which, false);
   }
+  int method_type_index_at_error_ok(int which) {
+    return method_type_index_at(which, true);
+  }
+
   // Derived queries:
   Symbol* method_handle_name_ref_at(int which) {
     int member = method_handle_index_at(which);