diff src/share/vm/code/oopRecorder.cpp @ 17376:9928ad27a80e

OopRecorder should check for duplicates
author Tom Rodriguez <tom.rodriguez@oracle.com>
date Wed, 08 Oct 2014 11:48:00 -0700
parents da91efe96a93
children 44b83285b645
line wrap: on
line diff
--- a/src/share/vm/code/oopRecorder.cpp	Wed Oct 08 11:46:00 2014 -0700
+++ b/src/share/vm/code/oopRecorder.cpp	Wed Oct 08 11:48:00 2014 -0700
@@ -34,9 +34,17 @@
 template <class T> int ValueRecorder<T>::_find_index_calls = 0;
 template <class T> int ValueRecorder<T>::_hit_indexes      = 0;
 template <class T> int ValueRecorder<T>::_missed_indexes   = 0;
+
+void OopRecorder::check_for_duplicates(int index, jobject h) {
+  oop o = JNIHandles::resolve(h);
+  for (int i = 1; i < oop_count(); i++) {
+    if (o == JNIHandles::resolve(oop_at(i)) && index != i) {
+      assert(false, "duplicate found");
+    }
+  }
+}
 #endif //ASSERT
 
-
 template <class T> ValueRecorder<T>::ValueRecorder(Arena* arena) {
   _handles  = NULL;
   _indexes  = NULL;