freeChunk.hpp revision 1636
0N/A * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 0N/A * published by the Free Software Foundation. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 0N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 0N/A// Free block maintenance for Concurrent Mark Sweep Generation 0N/A// The main data structure for free blocks are 0N/A// . an indexed array of small free blocks, and 0N/A// . a dictionary of large free blocks 0N/A// No virtuals in FreeChunk (don't want any vtables). 0N/A// A FreeChunk is merely a chunk that can be in a doubly linked list 0N/A// and has a size field. NOTE: FreeChunks are distinguished from allocated 0N/A// objects in two ways (by the sweeper), depending on whether the VM is 32 or 0N/A// In 32 bits or 64 bits without CompressedOops, the second word (prev) has the 0N/A// LSB set to indicate a free chunk; allocated objects' klass() pointers 0N/A// don't have their LSB set. The corresponding bit in the CMSBitMap is 0N/A// set when the chunk is allocated. There are also blocks that "look free" 0N/A// but are not part of the free list and should not be coalesced into larger 0N/A// free blocks. These free blocks have their two LSB's set. 0N/A // For 64 bit compressed oops, the markOop encodes both the size and the 0N/A // indication that this is a FreeChunk and not an object. 0N/A // Returns "true" if the address indicates that the block represents 0N/A // Force volatile read from addr because value might change between 0N/A // calls. We really want the read of _mark and _prev from this pointer 0N/A // to be volatile but making the fields volatile causes all sorts of 0N/A // compilation errors. 0N/A // the block should be free // Set _prev (klass) to null before (if) clearing the mark word below // Return the address past the end of this chunk