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

Tue, 23 Nov 2010 13:22:55 -0800

author
stefank
date
Tue, 23 Nov 2010 13:22:55 -0800
changeset 2314
f95d63e2154a
parent 1907
c18cbe5936b8
permissions
-rw-r--r--

6989984: Use standard include model for Hospot
Summary: Replaced MakeDeps and the includeDB files with more standardized solutions.
Reviewed-by: coleenp, kvn, kamg

duke@435 1 /*
stefank@2314 2 * Copyright (c) 2001, 2010, Oracle and/or its affiliates. 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 *
trims@1907 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
trims@1907 20 * or visit www.oracle.com if you need additional information or have any
trims@1907 21 * questions.
duke@435 22 *
duke@435 23 */
duke@435 24
stefank@2314 25 #ifndef SHARE_VM_GC_IMPLEMENTATION_CONCURRENTMARKSWEEP_FREEBLOCKDICTIONARY_HPP
stefank@2314 26 #define SHARE_VM_GC_IMPLEMENTATION_CONCURRENTMARKSWEEP_FREEBLOCKDICTIONARY_HPP
stefank@2314 27
stefank@2314 28 #include "gc_implementation/concurrentMarkSweep/freeChunk.hpp"
stefank@2314 29 #include "memory/allocation.hpp"
stefank@2314 30 #include "memory/memRegion.hpp"
stefank@2314 31 #include "runtime/mutex.hpp"
stefank@2314 32 #include "utilities/debug.hpp"
stefank@2314 33 #include "utilities/globalDefinitions.hpp"
stefank@2314 34 #include "utilities/ostream.hpp"
stefank@2314 35
duke@435 36 // A FreeBlockDictionary is an abstract superclass that will allow
duke@435 37 // a number of alternative implementations in the future.
duke@435 38 class FreeBlockDictionary: public CHeapObj {
duke@435 39 public:
duke@435 40 enum Dither {
duke@435 41 atLeast,
duke@435 42 exactly,
duke@435 43 roughly
duke@435 44 };
duke@435 45 enum DictionaryChoice {
duke@435 46 dictionaryBinaryTree = 0,
duke@435 47 dictionarySplayTree = 1,
duke@435 48 dictionarySkipList = 2
duke@435 49 };
duke@435 50
duke@435 51 private:
duke@435 52 NOT_PRODUCT(Mutex* _lock;)
duke@435 53
duke@435 54 public:
duke@435 55 virtual void removeChunk(FreeChunk* fc) = 0;
duke@435 56 virtual FreeChunk* getChunk(size_t size, Dither dither = atLeast) = 0;
duke@435 57 virtual void returnChunk(FreeChunk* chunk) = 0;
duke@435 58 virtual size_t totalChunkSize(debug_only(const Mutex* lock)) const = 0;
duke@435 59 virtual size_t maxChunkSize() const = 0;
duke@435 60 virtual size_t minSize() const = 0;
duke@435 61 // Reset the dictionary to the initial conditions for a single
duke@435 62 // block.
duke@435 63 virtual void reset(HeapWord* addr, size_t size) = 0;
duke@435 64 virtual void reset() = 0;
duke@435 65
duke@435 66 virtual void dictCensusUpdate(size_t size, bool split, bool birth) = 0;
duke@435 67 virtual bool coalDictOverPopulated(size_t size) = 0;
duke@435 68 virtual void beginSweepDictCensus(double coalSurplusPercent,
ysr@1580 69 float inter_sweep_current, float inter_sweep_estimate,
ysr@1580 70 float intra__sweep_current) = 0;
duke@435 71 virtual void endSweepDictCensus(double splitSurplusPercent) = 0;
duke@435 72 virtual FreeChunk* findLargestDict() const = 0;
duke@435 73 // verify that the given chunk is in the dictionary.
duke@435 74 virtual bool verifyChunkInFreeLists(FreeChunk* tc) const = 0;
duke@435 75
duke@435 76 // Sigma_{all_free_blocks} (block_size^2)
duke@435 77 virtual double sum_of_squared_block_sizes() const = 0;
duke@435 78
duke@435 79 virtual FreeChunk* find_chunk_ends_at(HeapWord* target) const = 0;
duke@435 80 virtual void inc_totalSize(size_t v) = 0;
duke@435 81 virtual void dec_totalSize(size_t v) = 0;
duke@435 82
duke@435 83 NOT_PRODUCT (
duke@435 84 virtual size_t sumDictReturnedBytes() = 0;
duke@435 85 virtual void initializeDictReturnedBytes() = 0;
duke@435 86 virtual size_t totalCount() = 0;
duke@435 87 )
duke@435 88
duke@435 89 virtual void reportStatistics() const {
duke@435 90 gclog_or_tty->print("No statistics available");
duke@435 91 }
duke@435 92
duke@435 93 virtual void printDictCensus() const = 0;
ysr@1580 94 virtual void print_free_lists(outputStream* st) const = 0;
duke@435 95
duke@435 96 virtual void verify() const = 0;
duke@435 97
duke@435 98 Mutex* par_lock() const PRODUCT_RETURN0;
duke@435 99 void set_par_lock(Mutex* lock) PRODUCT_RETURN;
duke@435 100 void verify_par_locked() const PRODUCT_RETURN;
duke@435 101 };
stefank@2314 102
stefank@2314 103 #endif // SHARE_VM_GC_IMPLEMENTATION_CONCURRENTMARKSWEEP_FREEBLOCKDICTIONARY_HPP

mercurial