< prev index next >

src/share/vm/memory/binaryTreeDictionary.cpp

Print this page
rev 13203 : [mq]: freebldict
rev 13204 : imported patch dither
rev 13205 : imported patch copyyear

*** 1,7 **** /* ! * Copyright (c) 2001, 2015, 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. --- 1,7 ---- /* ! * Copyright (c) 2001, 2017, 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.
*** 25,35 **** #include "precompiled.hpp" #include "gc/cms/allocationStats.hpp" #include "gc/shared/spaceDecorator.hpp" #include "logging/logStream.inline.hpp" #include "memory/binaryTreeDictionary.hpp" - #include "memory/freeBlockDictionary.hpp" #include "memory/freeList.hpp" #include "memory/metachunk.hpp" #include "memory/resourceArea.hpp" #include "runtime/globals.hpp" #include "utilities/macros.hpp" --- 25,34 ----
*** 424,436 **** } // Get a free block of size at least size from tree, or NULL. template <class Chunk_t, class FreeList_t> TreeChunk<Chunk_t, FreeList_t>* ! BinaryTreeDictionary<Chunk_t, FreeList_t>::get_chunk_from_tree( ! size_t size, ! enum FreeBlockDictionary<Chunk_t>::Dither dither) { TreeList<Chunk_t, FreeList_t> *curTL, *prevTL; TreeChunk<Chunk_t, FreeList_t>* retTC = NULL; assert((size >= min_size()), "minimum chunk size"); --- 423,433 ---- } // Get a free block of size at least size from tree, or NULL. template <class Chunk_t, class FreeList_t> TreeChunk<Chunk_t, FreeList_t>* ! BinaryTreeDictionary<Chunk_t, FreeList_t>::get_chunk_from_tree(size_t size) { TreeList<Chunk_t, FreeList_t> *curTL, *prevTL; TreeChunk<Chunk_t, FreeList_t>* retTC = NULL; assert((size >= min_size()), "minimum chunk size");
*** 451,462 **** curTL = curTL->left(); } } if (curTL == NULL) { // couldn't find exact match - if (dither == FreeBlockDictionary<Chunk_t>::exactly) return NULL; - // try and find the next larger size by walking back up the search path for (curTL = prevTL; curTL != NULL;) { if (curTL->size() >= size) break; else curTL = curTL->parent(); } --- 448,457 ----
*** 770,780 **** } } template <class Chunk_t, class FreeList_t> size_t BinaryTreeDictionary<Chunk_t, FreeList_t>::max_chunk_size() const { ! FreeBlockDictionary<Chunk_t>::verify_par_locked(); TreeList<Chunk_t, FreeList_t>* tc = root(); if (tc == NULL) return 0; for (; tc->right() != NULL; tc = tc->right()); return tc->size(); } --- 765,775 ---- } } template <class Chunk_t, class FreeList_t> size_t BinaryTreeDictionary<Chunk_t, FreeList_t>::max_chunk_size() const { ! verify_par_locked(); TreeList<Chunk_t, FreeList_t>* tc = root(); if (tc == NULL) return 0; for (; tc->right() != NULL; tc = tc->right()); return tc->size(); }
*** 1110,1119 **** --- 1105,1135 ---- size_t BinaryTreeDictionary<Chunk_t, FreeList_t>::total_count() { treeCountClosure<Chunk_t, FreeList_t> ctc(0); ctc.do_tree(root()); return ctc.count; } + + template <class Chunk_t, class FreeList_t> + Mutex* BinaryTreeDictionary<Chunk_t, FreeList_t>::par_lock() const { + return _lock; + } + + template <class Chunk_t, class FreeList_t> + void BinaryTreeDictionary<Chunk_t, FreeList_t>::set_par_lock(Mutex* lock) { + _lock = lock; + } + + template <class Chunk_t, class FreeList_t> + void BinaryTreeDictionary<Chunk_t, FreeList_t>::verify_par_locked() const { + #ifdef ASSERT + Thread* my_thread = Thread::current(); + if (my_thread->is_GC_task_thread()) { + assert(par_lock() != NULL, "Should be using locking?"); + assert_lock_strong(par_lock()); + } + #endif // ASSERT + } #endif // PRODUCT // Calculate surpluses for the lists in the tree. template <class Chunk_t, class FreeList_t> class setTreeSurplusClosure : public AscendTreeCensusClosure<Chunk_t, FreeList_t> {
*** 1200,1210 **** } // Print summary statistics template <class Chunk_t, class FreeList_t> void BinaryTreeDictionary<Chunk_t, FreeList_t>::report_statistics(outputStream* st) const { ! FreeBlockDictionary<Chunk_t>::verify_par_locked(); st->print_cr("Statistics for BinaryTreeDictionary:"); st->print_cr("------------------------------------"); size_t total_size = total_chunk_size(debug_only(NULL)); size_t free_blocks = num_free_blocks(); st->print_cr("Total Free Space: " SIZE_FORMAT, total_size); --- 1216,1226 ---- } // Print summary statistics template <class Chunk_t, class FreeList_t> void BinaryTreeDictionary<Chunk_t, FreeList_t>::report_statistics(outputStream* st) const { ! verify_par_locked(); st->print_cr("Statistics for BinaryTreeDictionary:"); st->print_cr("------------------------------------"); size_t total_size = total_chunk_size(debug_only(NULL)); size_t free_blocks = num_free_blocks(); st->print_cr("Total Free Space: " SIZE_FORMAT, total_size);
< prev index next >