1 /*
2 * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
1423 // associated "continues humongous" regions.
1424 void set_bit_for_region(HeapRegion* hr) {
1425 assert(!hr->is_continues_humongous(), "should have filtered those out");
1426
1427 BitMap::idx_t index = (BitMap::idx_t) hr->hrm_index();
1428 if (!hr->is_starts_humongous()) {
1429 // Normal (non-humongous) case: just set the bit.
1430 _region_bm->par_at_put(index, true);
1431 } else {
1432 // Starts humongous case: calculate how many regions are part of
1433 // this humongous region and then set the bit range.
1434 BitMap::idx_t end_index = (BitMap::idx_t) hr->last_hc_index();
1435 _region_bm->par_at_put_range(index, end_index, true);
1436 }
1437 }
1438
1439 public:
1440 CMCountDataClosureBase(G1CollectedHeap* g1h,
1441 BitMap* region_bm, BitMap* card_bm):
1442 _g1h(g1h), _cm(g1h->concurrent_mark()),
1443 _ct_bs((CardTableModRefBS*) (g1h->barrier_set())),
1444 _region_bm(region_bm), _card_bm(card_bm) { }
1445 };
1446
1447 // Closure that calculates the # live objects per region. Used
1448 // for verification purposes during the cleanup pause.
1449 class CalcLiveObjectsClosure: public CMCountDataClosureBase {
1450 CMBitMapRO* _bm;
1451 size_t _region_marked_bytes;
1452
1453 public:
1454 CalcLiveObjectsClosure(CMBitMapRO *bm, G1CollectedHeap* g1h,
1455 BitMap* region_bm, BitMap* card_bm) :
1456 CMCountDataClosureBase(g1h, region_bm, card_bm),
1457 _bm(bm), _region_marked_bytes(0) { }
1458
1459 bool doHeapRegion(HeapRegion* hr) {
1460
1461 if (hr->is_continues_humongous()) {
1462 // We will ignore these here and process them when their
1463 // associated "starts humongous" region is processed (see
3094 }
3095 }
3096 }
3097 }
3098 #endif // PRODUCT
3099
3100 // Aggregate the counting data that was constructed concurrently
3101 // with marking.
3102 class AggregateCountDataHRClosure: public HeapRegionClosure {
3103 G1CollectedHeap* _g1h;
3104 ConcurrentMark* _cm;
3105 CardTableModRefBS* _ct_bs;
3106 BitMap* _cm_card_bm;
3107 uint _max_worker_id;
3108
3109 public:
3110 AggregateCountDataHRClosure(G1CollectedHeap* g1h,
3111 BitMap* cm_card_bm,
3112 uint max_worker_id) :
3113 _g1h(g1h), _cm(g1h->concurrent_mark()),
3114 _ct_bs((CardTableModRefBS*) (g1h->barrier_set())),
3115 _cm_card_bm(cm_card_bm), _max_worker_id(max_worker_id) { }
3116
3117 bool doHeapRegion(HeapRegion* hr) {
3118 if (hr->is_continues_humongous()) {
3119 // We will ignore these here and process them when their
3120 // associated "starts humongous" region is processed.
3121 // Note that we cannot rely on their associated
3122 // "starts humongous" region to have their bit set to 1
3123 // since, due to the region chunking in the parallel region
3124 // iteration, a "continues humongous" region might be visited
3125 // before its associated "starts humongous".
3126 return false;
3127 }
3128
3129 HeapWord* start = hr->bottom();
3130 HeapWord* limit = hr->next_top_at_mark_start();
3131 HeapWord* end = hr->end();
3132
3133 assert(start <= limit && limit <= hr->top() && hr->top() <= hr->end(),
3134 err_msg("Preconditions not met - "
|
1 /*
2 * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
1423 // associated "continues humongous" regions.
1424 void set_bit_for_region(HeapRegion* hr) {
1425 assert(!hr->is_continues_humongous(), "should have filtered those out");
1426
1427 BitMap::idx_t index = (BitMap::idx_t) hr->hrm_index();
1428 if (!hr->is_starts_humongous()) {
1429 // Normal (non-humongous) case: just set the bit.
1430 _region_bm->par_at_put(index, true);
1431 } else {
1432 // Starts humongous case: calculate how many regions are part of
1433 // this humongous region and then set the bit range.
1434 BitMap::idx_t end_index = (BitMap::idx_t) hr->last_hc_index();
1435 _region_bm->par_at_put_range(index, end_index, true);
1436 }
1437 }
1438
1439 public:
1440 CMCountDataClosureBase(G1CollectedHeap* g1h,
1441 BitMap* region_bm, BitMap* card_bm):
1442 _g1h(g1h), _cm(g1h->concurrent_mark()),
1443 _ct_bs(barrier_set_cast<CardTableModRefBS>(g1h->barrier_set())),
1444 _region_bm(region_bm), _card_bm(card_bm) { }
1445 };
1446
1447 // Closure that calculates the # live objects per region. Used
1448 // for verification purposes during the cleanup pause.
1449 class CalcLiveObjectsClosure: public CMCountDataClosureBase {
1450 CMBitMapRO* _bm;
1451 size_t _region_marked_bytes;
1452
1453 public:
1454 CalcLiveObjectsClosure(CMBitMapRO *bm, G1CollectedHeap* g1h,
1455 BitMap* region_bm, BitMap* card_bm) :
1456 CMCountDataClosureBase(g1h, region_bm, card_bm),
1457 _bm(bm), _region_marked_bytes(0) { }
1458
1459 bool doHeapRegion(HeapRegion* hr) {
1460
1461 if (hr->is_continues_humongous()) {
1462 // We will ignore these here and process them when their
1463 // associated "starts humongous" region is processed (see
3094 }
3095 }
3096 }
3097 }
3098 #endif // PRODUCT
3099
3100 // Aggregate the counting data that was constructed concurrently
3101 // with marking.
3102 class AggregateCountDataHRClosure: public HeapRegionClosure {
3103 G1CollectedHeap* _g1h;
3104 ConcurrentMark* _cm;
3105 CardTableModRefBS* _ct_bs;
3106 BitMap* _cm_card_bm;
3107 uint _max_worker_id;
3108
3109 public:
3110 AggregateCountDataHRClosure(G1CollectedHeap* g1h,
3111 BitMap* cm_card_bm,
3112 uint max_worker_id) :
3113 _g1h(g1h), _cm(g1h->concurrent_mark()),
3114 _ct_bs(barrier_set_cast<CardTableModRefBS>(g1h->barrier_set())),
3115 _cm_card_bm(cm_card_bm), _max_worker_id(max_worker_id) { }
3116
3117 bool doHeapRegion(HeapRegion* hr) {
3118 if (hr->is_continues_humongous()) {
3119 // We will ignore these here and process them when their
3120 // associated "starts humongous" region is processed.
3121 // Note that we cannot rely on their associated
3122 // "starts humongous" region to have their bit set to 1
3123 // since, due to the region chunking in the parallel region
3124 // iteration, a "continues humongous" region might be visited
3125 // before its associated "starts humongous".
3126 return false;
3127 }
3128
3129 HeapWord* start = hr->bottom();
3130 HeapWord* limit = hr->next_top_at_mark_start();
3131 HeapWord* end = hr->end();
3132
3133 assert(start <= limit && limit <= hr->top() && hr->top() <= hr->end(),
3134 err_msg("Preconditions not met - "
|