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 *
200 // contiguous and noncontiguous spaces.
201
202 HeapWord* CompactibleFreeListSpace::cross_threshold(HeapWord* start, HeapWord* the_end) {
203 _bt.single_block(start, the_end);
204 return end();
205 }
206
207 // Initialize them to NULL.
208 void CompactibleFreeListSpace::initializeIndexedFreeListArray() {
209 for (size_t i = 0; i < IndexSetSize; i++) {
210 // Note that on platforms where objects are double word aligned,
211 // the odd array elements are not used. It is convenient, however,
212 // to map directly from the object size to the array element.
213 _indexedFreeList[i].reset(IndexSetSize);
214 _indexedFreeList[i].set_size(i);
215 assert(_indexedFreeList[i].count() == 0, "reset check failed");
216 assert(_indexedFreeList[i].head() == NULL, "reset check failed");
217 assert(_indexedFreeList[i].tail() == NULL, "reset check failed");
218 assert(_indexedFreeList[i].hint() == IndexSetSize, "reset check failed");
219 }
220 }
221
222 void CompactibleFreeListSpace::resetIndexedFreeListArray() {
223 for (size_t i = 1; i < IndexSetSize; i++) {
224 assert(_indexedFreeList[i].size() == (size_t) i,
225 "Indexed free list sizes are incorrect");
226 _indexedFreeList[i].reset(IndexSetSize);
227 assert(_indexedFreeList[i].count() == 0, "reset check failed");
228 assert(_indexedFreeList[i].head() == NULL, "reset check failed");
229 assert(_indexedFreeList[i].tail() == NULL, "reset check failed");
230 assert(_indexedFreeList[i].hint() == IndexSetSize, "reset check failed");
231 }
232 }
233
234 void CompactibleFreeListSpace::reset(MemRegion mr) {
235 resetIndexedFreeListArray();
236 dictionary()->reset();
237 if (BlockOffsetArrayUseUnallocatedBlock) {
238 assert(end() == mr.end(), "We are compacting to the bottom of CMS gen");
239 // Everything's allocated until proven otherwise.
|
1 /*
2 * Copyright (c) 2001, 2016, 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 *
200 // contiguous and noncontiguous spaces.
201
202 HeapWord* CompactibleFreeListSpace::cross_threshold(HeapWord* start, HeapWord* the_end) {
203 _bt.single_block(start, the_end);
204 return end();
205 }
206
207 // Initialize them to NULL.
208 void CompactibleFreeListSpace::initializeIndexedFreeListArray() {
209 for (size_t i = 0; i < IndexSetSize; i++) {
210 // Note that on platforms where objects are double word aligned,
211 // the odd array elements are not used. It is convenient, however,
212 // to map directly from the object size to the array element.
213 _indexedFreeList[i].reset(IndexSetSize);
214 _indexedFreeList[i].set_size(i);
215 assert(_indexedFreeList[i].count() == 0, "reset check failed");
216 assert(_indexedFreeList[i].head() == NULL, "reset check failed");
217 assert(_indexedFreeList[i].tail() == NULL, "reset check failed");
218 assert(_indexedFreeList[i].hint() == IndexSetSize, "reset check failed");
219 }
220 }
221
222 size_t CompactibleFreeListSpace::obj_size(const HeapWord* addr) const {
223 return adjustObjectSize(oop(addr)->size());
224 }
225
226 void CompactibleFreeListSpace::resetIndexedFreeListArray() {
227 for (size_t i = 1; i < IndexSetSize; i++) {
228 assert(_indexedFreeList[i].size() == (size_t) i,
229 "Indexed free list sizes are incorrect");
230 _indexedFreeList[i].reset(IndexSetSize);
231 assert(_indexedFreeList[i].count() == 0, "reset check failed");
232 assert(_indexedFreeList[i].head() == NULL, "reset check failed");
233 assert(_indexedFreeList[i].tail() == NULL, "reset check failed");
234 assert(_indexedFreeList[i].hint() == IndexSetSize, "reset check failed");
235 }
236 }
237
238 void CompactibleFreeListSpace::reset(MemRegion mr) {
239 resetIndexedFreeListArray();
240 dictionary()->reset();
241 if (BlockOffsetArrayUseUnallocatedBlock) {
242 assert(end() == mr.end(), "We are compacting to the bottom of CMS gen");
243 // Everything's allocated until proven otherwise.
|