< prev index next >
src/share/vm/memory/binaryTreeDictionary.hpp
Print this page
rev 13203 : [mq]: freebldict
rev 13204 : imported patch dither
rev 13205 : imported patch copyyear
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * 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.
@@ -23,11 +23,10 @@
*/
#ifndef SHARE_VM_MEMORY_BINARYTREEDICTIONARY_HPP
#define SHARE_VM_MEMORY_BINARYTREEDICTIONARY_HPP
-#include "memory/freeBlockDictionary.hpp"
#include "memory/freeList.hpp"
/*
* A binary tree based search structure for free blocks.
* This is currently used in the Concurrent Mark&Sweep implementation, but
@@ -170,22 +169,21 @@
// debugging
void verify_tree_chunk_list() const;
void assert_is_mangled() const;
};
-
template <class Chunk_t, class FreeList_t>
-class BinaryTreeDictionary: public FreeBlockDictionary<Chunk_t> {
+class BinaryTreeDictionary: public CHeapObj<mtGC> {
friend class VMStructs;
size_t _total_size;
size_t _total_free_blocks;
TreeList<Chunk_t, FreeList_t>* _root;
// private accessors
void set_total_size(size_t v) { _total_size = v; }
- virtual void inc_total_size(size_t v);
- virtual void dec_total_size(size_t v);
+ void inc_total_size(size_t v);
+ void dec_total_size(size_t v);
void set_total_free_blocks(size_t v) { _total_free_blocks = v; }
TreeList<Chunk_t, FreeList_t>* root() const { return _root; }
void set_root(TreeList<Chunk_t, FreeList_t>* v) { _root = v; }
// This field is added and can be set to point to the
@@ -196,11 +194,11 @@
// 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
// from the tree.
- TreeChunk<Chunk_t, FreeList_t>* get_chunk_from_tree(size_t size, enum FreeBlockDictionary<Chunk_t>::Dither dither);
+ TreeChunk<Chunk_t, FreeList_t>* get_chunk_from_tree(size_t size);
// Remove this chunk from the tree. If the removal results
// in an empty list in the tree, remove the empty list.
TreeChunk<Chunk_t, FreeList_t>* remove_chunk_from_tree(TreeChunk<Chunk_t, FreeList_t>* tc);
// Remove the node in the trees starting at tl that has the
// minimum value and return it. Repair the tree as needed.
@@ -255,27 +253,25 @@
// Reset the dictionary to be empty.
void reset();
// Return a chunk of size "size" or greater from
// the tree.
- Chunk_t* get_chunk(size_t size, enum FreeBlockDictionary<Chunk_t>::Dither dither) {
- FreeBlockDictionary<Chunk_t>::verify_par_locked();
- Chunk_t* res = get_chunk_from_tree(size, dither);
+ Chunk_t* get_chunk(size_t size) {
+ verify_par_locked();
+ Chunk_t* res = get_chunk_from_tree(size);
assert(res == NULL || res->is_free(),
"Should be returning a free chunk");
- assert(dither != FreeBlockDictionary<Chunk_t>::exactly ||
- res == NULL || res->size() == size, "Not correct size");
return res;
}
void return_chunk(Chunk_t* chunk) {
- FreeBlockDictionary<Chunk_t>::verify_par_locked();
+ verify_par_locked();
insert_chunk_in_tree(chunk);
}
void remove_chunk(Chunk_t* chunk) {
- FreeBlockDictionary<Chunk_t>::verify_par_locked();
+ verify_par_locked();
remove_chunk_from_tree((TreeChunk<Chunk_t, FreeList_t>*)chunk);
assert(chunk->is_free(), "Should still be a free chunk");
}
size_t max_chunk_size() const;
@@ -336,8 +332,12 @@
size_t total_count() PRODUCT_RETURN0;
void report_statistics(outputStream* st) const;
void verify() const;
+
+ Mutex* par_lock() const PRODUCT_RETURN0;
+ void set_par_lock(Mutex* lock) PRODUCT_RETURN;
+ void verify_par_locked() const PRODUCT_RETURN;
};
#endif // SHARE_VM_MEMORY_BINARYTREEDICTIONARY_HPP
< prev index next >