src/share/vm/gc_implementation/concurrentMarkSweep/freeBlockDictionary.hpp

Mon, 28 Jul 2008 15:30:23 -0700

author
jmasa
date
Mon, 28 Jul 2008 15:30:23 -0700
changeset 704
850fdf70db2b
parent 631
d1605aabd0a1
parent 698
12eea04c8b06
child 1580
e018e6884bd8
permissions
-rw-r--r--

Merge

duke@435 1 /*
xdono@631 2 * Copyright 2001-2008 Sun Microsystems, Inc. All Rights Reserved.
duke@435 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@435 4 *
duke@435 5 * This code is free software; you can redistribute it and/or modify it
duke@435 6 * under the terms of the GNU General Public License version 2 only, as
duke@435 7 * published by the Free Software Foundation.
duke@435 8 *
duke@435 9 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@435 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@435 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@435 12 * version 2 for more details (a copy is included in the LICENSE file that
duke@435 13 * accompanied this code).
duke@435 14 *
duke@435 15 * You should have received a copy of the GNU General Public License version
duke@435 16 * 2 along with this work; if not, write to the Free Software Foundation,
duke@435 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@435 18 *
duke@435 19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
duke@435 20 * CA 95054 USA or visit www.sun.com if you need additional information or
duke@435 21 * have any questions.
duke@435 22 *
duke@435 23 */
duke@435 24
duke@435 25 // A FreeBlockDictionary is an abstract superclass that will allow
duke@435 26 // a number of alternative implementations in the future.
duke@435 27 class FreeBlockDictionary: public CHeapObj {
duke@435 28 public:
duke@435 29 enum Dither {
duke@435 30 atLeast,
duke@435 31 exactly,
duke@435 32 roughly
duke@435 33 };
duke@435 34 enum DictionaryChoice {
duke@435 35 dictionaryBinaryTree = 0,
duke@435 36 dictionarySplayTree = 1,
duke@435 37 dictionarySkipList = 2
duke@435 38 };
duke@435 39
duke@435 40 private:
duke@435 41 NOT_PRODUCT(Mutex* _lock;)
duke@435 42
duke@435 43 public:
duke@435 44 virtual void removeChunk(FreeChunk* fc) = 0;
duke@435 45 virtual FreeChunk* getChunk(size_t size, Dither dither = atLeast) = 0;
duke@435 46 virtual void returnChunk(FreeChunk* chunk) = 0;
duke@435 47 virtual size_t totalChunkSize(debug_only(const Mutex* lock)) const = 0;
duke@435 48 virtual size_t maxChunkSize() const = 0;
duke@435 49 virtual size_t minSize() const = 0;
duke@435 50 // Reset the dictionary to the initial conditions for a single
duke@435 51 // block.
duke@435 52 virtual void reset(HeapWord* addr, size_t size) = 0;
duke@435 53 virtual void reset() = 0;
duke@435 54
duke@435 55 virtual void dictCensusUpdate(size_t size, bool split, bool birth) = 0;
duke@435 56 virtual bool coalDictOverPopulated(size_t size) = 0;
duke@435 57 virtual void beginSweepDictCensus(double coalSurplusPercent,
duke@435 58 float sweep_current, float sweep_ewstimate) = 0;
duke@435 59 virtual void endSweepDictCensus(double splitSurplusPercent) = 0;
duke@435 60 virtual FreeChunk* findLargestDict() const = 0;
duke@435 61 // verify that the given chunk is in the dictionary.
duke@435 62 virtual bool verifyChunkInFreeLists(FreeChunk* tc) const = 0;
duke@435 63
duke@435 64 // Sigma_{all_free_blocks} (block_size^2)
duke@435 65 virtual double sum_of_squared_block_sizes() const = 0;
duke@435 66
duke@435 67 virtual FreeChunk* find_chunk_ends_at(HeapWord* target) const = 0;
duke@435 68 virtual void inc_totalSize(size_t v) = 0;
duke@435 69 virtual void dec_totalSize(size_t v) = 0;
duke@435 70
duke@435 71 NOT_PRODUCT (
duke@435 72 virtual size_t sumDictReturnedBytes() = 0;
duke@435 73 virtual void initializeDictReturnedBytes() = 0;
duke@435 74 virtual size_t totalCount() = 0;
duke@435 75 )
duke@435 76
duke@435 77 virtual void reportStatistics() const {
duke@435 78 gclog_or_tty->print("No statistics available");
duke@435 79 }
duke@435 80
duke@435 81 virtual void printDictCensus() const = 0;
duke@435 82
duke@435 83 virtual void verify() const = 0;
duke@435 84
duke@435 85 Mutex* par_lock() const PRODUCT_RETURN0;
duke@435 86 void set_par_lock(Mutex* lock) PRODUCT_RETURN;
duke@435 87 void verify_par_locked() const PRODUCT_RETURN;
duke@435 88 };

mercurial