< prev index next >

src/share/vm/gc_implementation/g1/heapRegion.cpp

Print this page
rev 7698 : [mq]: fix-iterate-oop-kim

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.

@@ -432,37 +432,35 @@
   }
 
   // If we finish the above loop...We have a parseable object that
   // begins on or before the start of the memory region, and ends
   // inside or spans the entire region.
-
   assert(cur <= start, "Loop postcondition");
+  assert(obj->klass_or_null() != NULL, "Loop invariant");
 
   do {
-    assert(obj->klass_or_null() != NULL, "Loop invariant");
+    obj = oop(cur);
     assert((cur + block_size(cur)) > (HeapWord*)obj, "Loop invariant");
-    assert(obj == oop(cur), "Loop invariant");
     if (obj->klass_or_null() == NULL) {
       // Ran into an unparseable point.
       return cur;
     }
 
     // Advance the current pointer. "obj" still points to the object to iterate.
     cur = cur + block_size(cur);
 
     if (!g1h->is_obj_dead(obj)) {
-      // Non-object arrays are sometimes marked imprecise at the object start. We
+      // Non-objArrays are sometimes marked imprecise at the object start. We
       // always need to iterate over them in full.
       // We only iterate over object arrays in full if they are completely contained
       // in the memory region.
       if (!obj->is_objArray() || (((HeapWord*)obj) >= start && cur < end)) {
         obj->oop_iterate(cl);
       } else {
         obj->oop_iterate(cl, mr);
       }
     }
-    obj = oop(cur);
   } while (cur < end);
 
   return NULL;
 }
 

@@ -673,11 +671,10 @@
 #endif // PRODUCT
   }
 
   template <class T>
   void do_oop_work(T* p) {
-//      gclog_or_tty->print_cr("Verifying address " PTR_FORMAT, p2i(p));
     assert(_containing_obj != NULL, "Precondition");
     assert(!_g1h->is_obj_dead_cond(_containing_obj, _vo),
            "Precondition");
     T heap_oop = oopDesc::load_heap_oop(p);
     if (!oopDesc::is_null(heap_oop)) {
< prev index next >