changeset 12229:3577291c1a50

8167299: -XX:+PrintRelocations crashes the VM Reviewed-by: kvn
author simonis
date Thu, 06 Oct 2016 18:04:11 +0200
parents 820e8a4db30d
children 830b86a4ead5
files src/share/vm/code/relocInfo.cpp
diffstat 1 files changed, 12 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/code/relocInfo.cpp	Fri Oct 21 22:26:51 2016 -0400
+++ b/src/share/vm/code/relocInfo.cpp	Thu Oct 06 18:04:11 2016 +0200
@@ -743,7 +743,9 @@
 }
 
 Method* virtual_call_Relocation::method_value() {
-  Metadata* m = code()->metadata_at(_method_index);
+  CompiledMethod* cm = code();
+  if (cm == NULL) return (Method*)NULL;
+  Metadata* m = cm->metadata_at(_method_index);
   assert(m != NULL || _method_index == 0, "should be non-null for non-zero index");
   assert(m == NULL || m->is_method(), "not a method");
   return (Method*)m;
@@ -769,7 +771,9 @@
 }
 
 Method* opt_virtual_call_Relocation::method_value() {
-  Metadata* m = code()->metadata_at(_method_index);
+  CompiledMethod* cm = code();
+  if (cm == NULL) return (Method*)NULL;
+  Metadata* m = cm->metadata_at(_method_index);
   assert(m != NULL || _method_index == 0, "should be non-null for non-zero index");
   assert(m == NULL || m->is_method(), "not a method");
   return (Method*)m;
@@ -800,7 +804,9 @@
 }
 
 Method* static_call_Relocation::method_value() {
-  Metadata* m = code()->metadata_at(_method_index);
+  CompiledMethod* cm = code();
+  if (cm == NULL) return (Method*)NULL;
+  Metadata* m = cm->metadata_at(_method_index);
   assert(m != NULL || _method_index == 0, "should be non-null for non-zero index");
   assert(m == NULL || m->is_method(), "not a method");
   return (Method*)m;
@@ -970,7 +976,9 @@
       // work even during GC or other inconvenient times.
       if (WizardMode && oop_value != NULL) {
         tty->print("oop_value=" INTPTR_FORMAT ": ", p2i(oop_value));
-        oop_value->print_value_on(tty);
+        if (oop_value->is_oop()) {
+          oop_value->print_value_on(tty);
+        }
       }
       break;
     }