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 * 23 */ 24 25 // 26 // Free block maintenance for Concurrent Mark Sweep Generation 27 // 28 // The main data structure for free blocks are 29 // . an indexed array of small free blocks, and 30 // . a dictionary of large free blocks 31 // 32 33 // No virtuals in FreeChunk (don't want any vtables). 34 35 // A FreeChunk is merely a chunk that can be in a doubly linked list 36 // and has a size field. NOTE: FreeChunks are distinguished from allocated 37 // objects in two ways (by the sweeper), depending on whether the VM is 32 or 38 // 64 bits. 39 // In 32 bits or 64 bits without CompressedOops, the second word (prev) has the 40 // LSB set to indicate a free chunk; allocated objects' klass() pointers 41 // don't have their LSB set. The corresponding bit in the CMSBitMap is 42 // set when the chunk is allocated. There are also blocks that "look free" 43 // but are not part of the free list and should not be coalesced into larger 44 // free blocks. These free blocks have their two LSB's set. 124 set_mark(markOopDesc::prototype()); 125 } 126 #endif 127 assert(!isFree(), "Error"); 128 } 129 130 // Return the address past the end of this chunk 131 HeapWord* end() const { return ((HeapWord*) this) + size(); } 132 133 // debugging 134 void verify() const PRODUCT_RETURN; 135 void verifyList() const PRODUCT_RETURN; 136 void mangleAllocated(size_t size) PRODUCT_RETURN; 137 void mangleFreed(size_t size) PRODUCT_RETURN; 138 139 void print_on(outputStream* st); 140 }; 141 142 extern size_t MinChunkSize; 143 | 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 * 23 */ 24 25 #ifndef SHARE_VM_GC_IMPLEMENTATION_CONCURRENTMARKSWEEP_FREECHUNK_HPP 26 #define SHARE_VM_GC_IMPLEMENTATION_CONCURRENTMARKSWEEP_FREECHUNK_HPP 27 28 #include "memory/allocation.hpp" 29 #include "memory/memRegion.hpp" 30 #include "oops/markOop.hpp" 31 #include "runtime/mutex.hpp" 32 #include "utilities/debug.hpp" 33 #include "utilities/globalDefinitions.hpp" 34 #include "utilities/ostream.hpp" 35 36 // 37 // Free block maintenance for Concurrent Mark Sweep Generation 38 // 39 // The main data structure for free blocks are 40 // . an indexed array of small free blocks, and 41 // . a dictionary of large free blocks 42 // 43 44 // No virtuals in FreeChunk (don't want any vtables). 45 46 // A FreeChunk is merely a chunk that can be in a doubly linked list 47 // and has a size field. NOTE: FreeChunks are distinguished from allocated 48 // objects in two ways (by the sweeper), depending on whether the VM is 32 or 49 // 64 bits. 50 // In 32 bits or 64 bits without CompressedOops, the second word (prev) has the 51 // LSB set to indicate a free chunk; allocated objects' klass() pointers 52 // don't have their LSB set. The corresponding bit in the CMSBitMap is 53 // set when the chunk is allocated. There are also blocks that "look free" 54 // but are not part of the free list and should not be coalesced into larger 55 // free blocks. These free blocks have their two LSB's set. 135 set_mark(markOopDesc::prototype()); 136 } 137 #endif 138 assert(!isFree(), "Error"); 139 } 140 141 // Return the address past the end of this chunk 142 HeapWord* end() const { return ((HeapWord*) this) + size(); } 143 144 // debugging 145 void verify() const PRODUCT_RETURN; 146 void verifyList() const PRODUCT_RETURN; 147 void mangleAllocated(size_t size) PRODUCT_RETURN; 148 void mangleFreed(size_t size) PRODUCT_RETURN; 149 150 void print_on(outputStream* st); 151 }; 152 153 extern size_t MinChunkSize; 154 155 156 #endif // SHARE_VM_GC_IMPLEMENTATION_CONCURRENTMARKSWEEP_FREECHUNK_HPP |