diff src/share/vm/graal/graalRuntime.cpp @ 10953:97e282186b5b

Add heap sanity checker with premature hard crash for debugging write barriers
author Christos Kotselidis <christos.kotselidis@oracle.com>
date Fri, 02 Aug 2013 19:03:05 +0200
parents 554f67e4ff3f
children 359f7e70ae7f 0991c12c4186
line wrap: on
line diff
--- a/src/share/vm/graal/graalRuntime.cpp	Fri Aug 02 18:29:49 2013 +0200
+++ b/src/share/vm/graal/graalRuntime.cpp	Fri Aug 02 19:03:05 2013 +0200
@@ -372,6 +372,21 @@
   thread->dirty_card_queue().enqueue(card_addr);
 JRT_END
 
+JRT_LEAF(jboolean, GraalRuntime::validate_object(JavaThread* thread,oopDesc* parent, oopDesc* child))
+  bool ret = true;
+  if(!Universe::heap()->is_in_closed_subset(parent)) {
+    tty->print_cr("Parent Object "INTPTR_FORMAT" not in heap", parent);
+    parent->print();
+    ret=false;
+  }
+  if(!Universe::heap()->is_in_closed_subset(child)) {
+    tty->print_cr("Child Object "INTPTR_FORMAT" not in heap", child);
+    child->print();
+    ret=false;
+  }
+  return (jint)ret;
+JRT_END
+
 JRT_ENTRY(void, GraalRuntime::vm_error(JavaThread* thread, oop where, oop format, jlong value))
   ResourceMark rm;
   assert(where == NULL || java_lang_String::is_instance(where), "must be");