6866585: debug code in ciObjectFactory too slow for large objects
authorjcoomes
Tue, 11 Aug 2009 23:24:41 -0700
changeset 3609 5f16c48e608a
parent 3608 6b6768abef45
child 3610 06ee2f982ea6
6866585: debug code in ciObjectFactory too slow for large objects Reviewed-by: ysr, never, kvn
hotspot/src/share/vm/ci/ciObjectFactory.cpp
hotspot/src/share/vm/runtime/globals.hpp
--- a/hotspot/src/share/vm/ci/ciObjectFactory.cpp	Sun Aug 09 17:03:51 2009 -0700
+++ b/hotspot/src/share/vm/ci/ciObjectFactory.cpp	Tue Aug 11 23:24:41 2009 -0700
@@ -219,24 +219,27 @@
   ASSERT_IN_VM;
 
 #ifdef ASSERT
-  oop last = NULL;
-  for (int j = 0; j< _ci_objects->length(); j++) {
-    oop o = _ci_objects->at(j)->get_oop();
-    assert(last < o, "out of order");
-    last = o;
+  if (CIObjectFactoryVerify) {
+    oop last = NULL;
+    for (int j = 0; j< _ci_objects->length(); j++) {
+      oop o = _ci_objects->at(j)->get_oop();
+      assert(last < o, "out of order");
+      last = o;
+    }
   }
 #endif // ASSERT
   int len = _ci_objects->length();
   int index = find(key, _ci_objects);
 #ifdef ASSERT
-  for (int i=0; i<_ci_objects->length(); i++) {
-    if (_ci_objects->at(i)->get_oop() == key) {
-      assert(index == i, " bad lookup");
+  if (CIObjectFactoryVerify) {
+    for (int i=0; i<_ci_objects->length(); i++) {
+      if (_ci_objects->at(i)->get_oop() == key) {
+        assert(index == i, " bad lookup");
+      }
     }
   }
 #endif
   if (!is_found_at(index, key, _ci_objects)) {
-
     // Check in the non-perm area before putting it in the list.
     NonPermObject* &bucket = find_non_perm(key);
     if (bucket != NULL) {
@@ -539,11 +542,13 @@
     objects->at_put(index, obj);
   }
 #ifdef ASSERT
-  oop last = NULL;
-  for (int j = 0; j< objects->length(); j++) {
-    oop o = objects->at(j)->get_oop();
-    assert(last < o, "out of order");
-    last = o;
+  if (CIObjectFactoryVerify) {
+    oop last = NULL;
+    for (int j = 0; j< objects->length(); j++) {
+      oop o = objects->at(j)->get_oop();
+      assert(last < o, "out of order");
+      last = o;
+    }
   }
 #endif // ASSERT
 }
--- a/hotspot/src/share/vm/runtime/globals.hpp	Sun Aug 09 17:03:51 2009 -0700
+++ b/hotspot/src/share/vm/runtime/globals.hpp	Tue Aug 11 23:24:41 2009 -0700
@@ -3034,6 +3034,9 @@
           "Wait for this many CI accesses to occur in all compiles before " \
           "beginning to throw OutOfMemoryErrors in each compile")           \
                                                                             \
+  notproduct(bool, CIObjectFactoryVerify, false,                            \
+          "enable potentially expensive verification in ciObjectFactory")   \
+                                                                            \
   /* Priorities */                                                          \
   product_pd(bool, UseThreadPriorities,  "Use native thread priorities")    \
                                                                             \