comparison src/share/vm/gc_implementation/g1/heapRegionRemSet.hpp @ 2173:97ba643ea3ed

7014261: G1: RSet-related failures Summary: A race between the concurrent cleanup thread and the VM thread while it is processing the "expanded sparse table list" causes both threads to try to free the same sparse table entry and either causes one of the threads to fail or leaves the entry in an inconsistent state. The solution is purge all entries on the expanded list that correspond go regions that are being cleaned up. Reviewed-by: brutisso, johnc
author tonyp
date Tue, 25 Jan 2011 17:58:19 -0500
parents f95d63e2154a
children e8b0b0392037
comparison
equal deleted inserted replaced
2172:a672e43650cc 2173:97ba643ea3ed
1 /* 1 /*
2 * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
36 class HeapRegion; 36 class HeapRegion;
37 class HeapRegionRemSetIterator; 37 class HeapRegionRemSetIterator;
38 class PosParPRT; 38 class PosParPRT;
39 class SparsePRT; 39 class SparsePRT;
40 40
41 // Essentially a wrapper around SparsePRTCleanupTask. See
42 // sparsePRT.hpp for more details.
43 class HRRSCleanupTask : public SparsePRTCleanupTask {
44 };
41 45
42 // The "_coarse_map" is a bitmap with one bit for each region, where set 46 // The "_coarse_map" is a bitmap with one bit for each region, where set
43 // bits indicate that the corresponding region may contain some pointer 47 // bits indicate that the corresponding region may contain some pointer
44 // into the owning region. 48 // into the owning region.
45 49
154 void clear_fcc(); 158 void clear_fcc();
155 159
156 // "from_hr" is being cleared; remove any entries from it. 160 // "from_hr" is being cleared; remove any entries from it.
157 void clear_incoming_entry(HeapRegion* from_hr); 161 void clear_incoming_entry(HeapRegion* from_hr);
158 162
163 void do_cleanup_work(HRRSCleanupTask* hrrs_cleanup_task);
164
159 // Declare the heap size (in # of regions) to the OtherRegionsTable. 165 // Declare the heap size (in # of regions) to the OtherRegionsTable.
160 // (Uses it to initialize from_card_cache). 166 // (Uses it to initialize from_card_cache).
161 static void init_from_card_cache(size_t max_regions); 167 static void init_from_card_cache(size_t max_regions);
162 168
163 // Declares that only regions i s.t. 0 <= i < new_n_regs are in use. 169 // Declares that only regions i s.t. 0 <= i < new_n_regs are in use.
164 // Make sure any entries for higher regions are invalid. 170 // Make sure any entries for higher regions are invalid.
165 static void shrink_from_card_cache(size_t new_n_regs); 171 static void shrink_from_card_cache(size_t new_n_regs);
166 172
167 static void print_from_card_cache(); 173 static void print_from_card_cache();
168
169 }; 174 };
170
171 175
172 class HeapRegionRemSet : public CHeapObj { 176 class HeapRegionRemSet : public CHeapObj {
173 friend class VMStructs; 177 friend class VMStructs;
174 friend class HeapRegionRemSetIterator; 178 friend class HeapRegionRemSetIterator;
175 179
340 344
341 static void record(HeapRegion* hr, OopOrNarrowOopStar f); 345 static void record(HeapRegion* hr, OopOrNarrowOopStar f);
342 static void print_recorded(); 346 static void print_recorded();
343 static void record_event(Event evnt); 347 static void record_event(Event evnt);
344 348
349 // These are wrappers for the similarly-named methods on
350 // SparsePRT. Look at sparsePRT.hpp for more details.
351 static void reset_for_cleanup_tasks();
352 void do_cleanup_work(HRRSCleanupTask* hrrs_cleanup_task);
353 static void finish_cleanup_task(HRRSCleanupTask* hrrs_cleanup_task);
354
345 // Run unit tests. 355 // Run unit tests.
346 #ifndef PRODUCT 356 #ifndef PRODUCT
347 static void test(); 357 static void test();
348 #endif 358 #endif
349
350 }; 359 };
351 360
352 class HeapRegionRemSetIterator : public CHeapObj { 361 class HeapRegionRemSetIterator : public CHeapObj {
353 362
354 // The region over which we're iterating. 363 // The region over which we're iterating.