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 *
296 }
297
298 // Auxiliary functions for scan_and_{forward,adjust_pointers,compact} support.
299 // See comments for CompactibleSpace for more information.
300 inline HeapWord* scan_limit() const {
301 return end();
302 }
303
304 inline bool scanned_block_is_obj(const HeapWord* addr) const {
305 return CompactibleFreeListSpace::block_is_obj(addr); // Avoid virtual call
306 }
307
308 inline size_t scanned_block_size(const HeapWord* addr) const {
309 return CompactibleFreeListSpace::block_size(addr); // Avoid virtual call
310 }
311
312 inline size_t adjust_obj_size(size_t size) const {
313 return adjustObjectSize(size);
314 }
315
316 inline size_t obj_size(const HeapWord* addr) const {
317 return adjustObjectSize(oop(addr)->size());
318 }
319
320 protected:
321 // Reset the indexed free list to its initial empty condition.
322 void resetIndexedFreeListArray();
323 // Reset to an initial state with a single free block described
324 // by the MemRegion parameter.
325 void reset(MemRegion mr);
326 // Return the total number of words in the indexed free lists.
327 size_t totalSizeInIndexedFreeLists() const;
328
329 public:
330 // Constructor
331 CompactibleFreeListSpace(BlockOffsetSharedArray* bs, MemRegion mr);
332 // Accessors
333 bool bestFitFirst() { return _fitStrategy == FreeBlockBestFitFirst; }
334 FreeBlockDictionary<FreeChunk>* dictionary() const { return _dictionary; }
335 HeapWord* nearLargestChunk() const { return _nearLargestChunk; }
336 void set_nearLargestChunk(HeapWord* v) { _nearLargestChunk = v; }
337
338 // Set CMS global values.
|
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 *
296 }
297
298 // Auxiliary functions for scan_and_{forward,adjust_pointers,compact} support.
299 // See comments for CompactibleSpace for more information.
300 inline HeapWord* scan_limit() const {
301 return end();
302 }
303
304 inline bool scanned_block_is_obj(const HeapWord* addr) const {
305 return CompactibleFreeListSpace::block_is_obj(addr); // Avoid virtual call
306 }
307
308 inline size_t scanned_block_size(const HeapWord* addr) const {
309 return CompactibleFreeListSpace::block_size(addr); // Avoid virtual call
310 }
311
312 inline size_t adjust_obj_size(size_t size) const {
313 return adjustObjectSize(size);
314 }
315
316 inline size_t obj_size(const HeapWord* addr) const;
317
318 protected:
319 // Reset the indexed free list to its initial empty condition.
320 void resetIndexedFreeListArray();
321 // Reset to an initial state with a single free block described
322 // by the MemRegion parameter.
323 void reset(MemRegion mr);
324 // Return the total number of words in the indexed free lists.
325 size_t totalSizeInIndexedFreeLists() const;
326
327 public:
328 // Constructor
329 CompactibleFreeListSpace(BlockOffsetSharedArray* bs, MemRegion mr);
330 // Accessors
331 bool bestFitFirst() { return _fitStrategy == FreeBlockBestFitFirst; }
332 FreeBlockDictionary<FreeChunk>* dictionary() const { return _dictionary; }
333 HeapWord* nearLargestChunk() const { return _nearLargestChunk; }
334 void set_nearLargestChunk(HeapWord* v) { _nearLargestChunk = v; }
335
336 // Set CMS global values.
|