binaryTreeDictionary.hpp revision 3786
* Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * A binary tree based search structure for free blocks. * This is currently used in the Concurrent Mark&Sweep implementation, but * will be used for free block management for metadata. // A TreeList is a FreeList which can be used to maintain a // binary tree of free lists. // Explicitly import these names into our namespace to fix name lookup with templates // Accessors for links in tree. // For constructing a TreeList from a Tree chunk or // Returns the head of the free list as a pointer to a TreeChunk. // Returns the first available chunk in the free list as a pointer // Returns the block with the largest heap address amongst // those in the list for this size; potentially slow and expensive, // remove_chunk_replace_if_needed() removes the given "tc" from the TreeList. // If "tc" is the first chunk in the list, it is also the // TreeList that is the node in the tree. remove_chunk_replace_if_needed() // returns the possibly replaced TreeList* for the node in // the tree. It also updates the parent of the original // node to point to the new node. // A TreeChunk is a subclass of a Chunk that additionally // maintains a pointer to the free list on which it is currently // A TreeChunk is also used as a node in the binary tree. This // allows the binary tree to be maintained without any additional // storage (the free chunks are used). In a binary tree the first // chunk in the free list is also the tree node. Note that the // TreeChunk has an embedded TreeList for this purpose. Because // the first chunk in the list is distinguished in this fashion // (also is the node in the tree), it is the last chunk to be found // on the free list for a node in the tree and is only removed if // it is the last chunk on the free list. // Initialize fields in a TreeChunk that should be // initialized when the TreeChunk is being added to // a free list in the tree. // This field is added and can be set to point to the // the Mutex used to synchronize access to the // dictionary so that assertion checking can be done. // For example it is set to point to _parDictionaryAllocLock. // Remove a chunk of size "size" or larger from the tree and // return it. If the chunk // is the last chunk of that size, remove the node for that size // Return a list of the specified size or NULL from the tree. // The list is not removed from the tree. // Remove this chunk from the tree. If the removal results // in an empty list in the tree, remove the empty list. // Remove the node in the trees starting at tl that has the // minimum value and return it. Repair the tree as needed. // Add this free chunk to the tree. // verify that the given chunk is in the tree. // Returns the total number of chunks in the list. // Returns the total number of words in the chunks in the tree // Returns the sum of the square of the size of each block // in the tree starting at "tl". // Returns the total number of free blocks in the tree starting // Reset the dictionary to the initial conditions with // Reset the dictionary to be empty. // Return a chunk of size "size" or greater from // want a better dynamic splay strategy for the future. "Should be returning a free chunk");
"_total_size inconsistency");
// Find the list with size "size" in the binary tree and update // the statistics in the list according to "split" (chunk was // split or coalesce) and "birth" (chunk was added or removed). // Return true if the dictionary is overpopulated (more chunks of // this size than desired) for size "size". // Methods called at the beginning of a sweep to prepare the // statistics for the sweep. // Methods called after the end of a sweep to modify the // statistics for the sweep. // Return the largest free chunk in the tree. // Accessors for statistics // Reset statistics for all the lists in the tree. // Print the statistcis for all the lists in the tree. Also may // For debugging. Returns the sum of the _returned_bytes for // all lists in the tree. // Sets the _returned_bytes for all the lists in the tree to zero. // For debugging. Return the total number of chunks in the dictionary. #
endif // SHARE_VM_MEMORY_BINARYTREEDICTIONARY_HPP