Code Review Request: 6812428: G1: Error: assert(ret or obj_in_cs(obj),"sanity") (XXXS)

Tony Printezis Antonios.Printezis at
Tue Mar 3 16:17:55 UTC 2009

 From the CR blurb:

The problem is caused by my fix for the evacuation pause efficiency improvements (6484956 <>). When I set up the byte vector which denotes which regions are in the collection set (the vector for the fast cset test), I used n_regions() to decide its size. However, the number of regions can actually be increased during the GC. If this happens and we try to look up into the fast cset test vector, we'll fall off its edge and read junk.

The very straightforward fix is to use max_regions() (i.e., the number of reserved regions) instead of n_regions() (i.e., the number of committed regions at the beginning of the GC) when setting up the fast cset test vector.

I won't bother with a webrev. Here's the diff:

--- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
+++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
@@ -2493,7 +2493,7 @@ G1CollectedHeap::do_collection_pause_at_
     guarantee(_in_cset_fast_test == NULL, "invariant");
     guarantee(_in_cset_fast_test_base == NULL, "invariant");
-    _in_cset_fast_test_length = n_regions();
+    _in_cset_fast_test_length = max_regions();
     _in_cset_fast_test_base =
     memset(_in_cset_fast_test_base, false,


| Tony Printezis, Staff Engineer    | Sun Microsystems Inc.          |
|                                   | MS BUR02-311                   |
| e-mail: tony.printezis at    | 35 Network Drive               |
| office: +1 781 442 0998 (x20998)  | Burlington, MA01803-0902, USA  |
e-mail client: Thunderbird (Solaris)

More information about the hotspot-gc-dev mailing list