8183923: Get rid of FreeBlockDictionary and dithering
Reviewed-by: ehelin, kbarrett
This commit is contained in:
parent
c1af106f51
commit
6be7a36028
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -26,7 +26,6 @@
|
|||||||
#include "gc/cms/adaptiveFreeList.hpp"
|
#include "gc/cms/adaptiveFreeList.hpp"
|
||||||
#include "gc/cms/freeChunk.hpp"
|
#include "gc/cms/freeChunk.hpp"
|
||||||
#include "gc/shared/collectedHeap.hpp"
|
#include "gc/shared/collectedHeap.hpp"
|
||||||
#include "memory/freeBlockDictionary.hpp"
|
|
||||||
#include "runtime/globals.hpp"
|
#include "runtime/globals.hpp"
|
||||||
#include "runtime/mutex.hpp"
|
#include "runtime/mutex.hpp"
|
||||||
#include "runtime/orderAccess.inline.hpp"
|
#include "runtime/orderAccess.inline.hpp"
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2001, 2016, 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.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -1533,8 +1533,7 @@ CompactibleFreeListSpace::getChunkFromIndexedFreeListHelper(size_t size,
|
|||||||
FreeChunk*
|
FreeChunk*
|
||||||
CompactibleFreeListSpace::getChunkFromDictionary(size_t size) {
|
CompactibleFreeListSpace::getChunkFromDictionary(size_t size) {
|
||||||
assert_locked();
|
assert_locked();
|
||||||
FreeChunk* fc = _dictionary->get_chunk(size,
|
FreeChunk* fc = _dictionary->get_chunk(size);
|
||||||
FreeBlockDictionary<FreeChunk>::atLeast);
|
|
||||||
if (fc == NULL) {
|
if (fc == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -1551,8 +1550,7 @@ CompactibleFreeListSpace::getChunkFromDictionary(size_t size) {
|
|||||||
FreeChunk*
|
FreeChunk*
|
||||||
CompactibleFreeListSpace::getChunkFromDictionaryExact(size_t size) {
|
CompactibleFreeListSpace::getChunkFromDictionaryExact(size_t size) {
|
||||||
assert_locked();
|
assert_locked();
|
||||||
FreeChunk* fc = _dictionary->get_chunk(size,
|
FreeChunk* fc = _dictionary->get_chunk(size);
|
||||||
FreeBlockDictionary<FreeChunk>::atLeast);
|
|
||||||
if (fc == NULL) {
|
if (fc == NULL) {
|
||||||
return fc;
|
return fc;
|
||||||
}
|
}
|
||||||
@ -1565,8 +1563,7 @@ CompactibleFreeListSpace::getChunkFromDictionaryExact(size_t size) {
|
|||||||
if (fc->size() < size + MinChunkSize) {
|
if (fc->size() < size + MinChunkSize) {
|
||||||
// Return the chunk to the dictionary and go get a bigger one.
|
// Return the chunk to the dictionary and go get a bigger one.
|
||||||
returnChunkToDictionary(fc);
|
returnChunkToDictionary(fc);
|
||||||
fc = _dictionary->get_chunk(size + MinChunkSize,
|
fc = _dictionary->get_chunk(size + MinChunkSize);
|
||||||
FreeBlockDictionary<FreeChunk>::atLeast);
|
|
||||||
if (fc == NULL) {
|
if (fc == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -2679,8 +2676,7 @@ FreeChunk* CompactibleFreeListSpace::get_n_way_chunk_to_split(size_t word_sz, si
|
|||||||
MutexLockerEx x(parDictionaryAllocLock(),
|
MutexLockerEx x(parDictionaryAllocLock(),
|
||||||
Mutex::_no_safepoint_check_flag);
|
Mutex::_no_safepoint_check_flag);
|
||||||
while (n > 0) {
|
while (n > 0) {
|
||||||
fc = dictionary()->get_chunk(MAX2(n * word_sz, _dictionary->min_size()),
|
fc = dictionary()->get_chunk(MAX2(n * word_sz, _dictionary->min_size()));
|
||||||
FreeBlockDictionary<FreeChunk>::atLeast);
|
|
||||||
if (fc != NULL) {
|
if (fc != NULL) {
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2001, 2016, 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.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -331,7 +331,7 @@ class CompactibleFreeListSpace: public CompactibleSpace {
|
|||||||
CompactibleFreeListSpace(BlockOffsetSharedArray* bs, MemRegion mr);
|
CompactibleFreeListSpace(BlockOffsetSharedArray* bs, MemRegion mr);
|
||||||
// Accessors
|
// Accessors
|
||||||
bool bestFitFirst() { return _fitStrategy == FreeBlockBestFitFirst; }
|
bool bestFitFirst() { return _fitStrategy == FreeBlockBestFitFirst; }
|
||||||
FreeBlockDictionary<FreeChunk>* dictionary() const { return _dictionary; }
|
AFLBinaryTreeDictionary* dictionary() const { return _dictionary; }
|
||||||
HeapWord* nearLargestChunk() const { return _nearLargestChunk; }
|
HeapWord* nearLargestChunk() const { return _nearLargestChunk; }
|
||||||
void set_nearLargestChunk(HeapWord* v) { _nearLargestChunk = v; }
|
void set_nearLargestChunk(HeapWord* v) { _nearLargestChunk = v; }
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2001, 2016, 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.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -36,7 +36,6 @@
|
|||||||
#include "gc/shared/space.hpp"
|
#include "gc/shared/space.hpp"
|
||||||
#include "gc/shared/taskqueue.hpp"
|
#include "gc/shared/taskqueue.hpp"
|
||||||
#include "logging/log.hpp"
|
#include "logging/log.hpp"
|
||||||
#include "memory/freeBlockDictionary.hpp"
|
|
||||||
#include "memory/iterator.hpp"
|
#include "memory/iterator.hpp"
|
||||||
#include "memory/virtualspace.hpp"
|
#include "memory/virtualspace.hpp"
|
||||||
#include "runtime/mutexLocker.hpp"
|
#include "runtime/mutexLocker.hpp"
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2001, 2015, 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.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -24,7 +24,6 @@
|
|||||||
|
|
||||||
#include "precompiled.hpp"
|
#include "precompiled.hpp"
|
||||||
#include "gc/cms/freeChunk.hpp"
|
#include "gc/cms/freeChunk.hpp"
|
||||||
#include "memory/freeBlockDictionary.hpp"
|
|
||||||
#include "utilities/copy.hpp"
|
#include "utilities/copy.hpp"
|
||||||
|
|
||||||
#ifndef PRODUCT
|
#ifndef PRODUCT
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -60,8 +60,7 @@
|
|||||||
declare_toplevel_type(CompactibleFreeListSpace*) \
|
declare_toplevel_type(CompactibleFreeListSpace*) \
|
||||||
declare_toplevel_type(CMSCollector*) \
|
declare_toplevel_type(CMSCollector*) \
|
||||||
declare_toplevel_type(AFLBinaryTreeDictionary) \
|
declare_toplevel_type(AFLBinaryTreeDictionary) \
|
||||||
declare_toplevel_type(LinearAllocBlock) \
|
declare_toplevel_type(LinearAllocBlock)
|
||||||
declare_toplevel_type(FreeBlockDictionary<FreeChunk>)
|
|
||||||
|
|
||||||
#define VM_INT_CONSTANTS_CMS(declare_constant) \
|
#define VM_INT_CONSTANTS_CMS(declare_constant) \
|
||||||
declare_constant(Generation::ConcurrentMarkSweep) \
|
declare_constant(Generation::ConcurrentMarkSweep) \
|
||||||
|
@ -27,7 +27,6 @@
|
|||||||
#include "gc/shared/spaceDecorator.hpp"
|
#include "gc/shared/spaceDecorator.hpp"
|
||||||
#include "logging/logStream.inline.hpp"
|
#include "logging/logStream.inline.hpp"
|
||||||
#include "memory/binaryTreeDictionary.hpp"
|
#include "memory/binaryTreeDictionary.hpp"
|
||||||
#include "memory/freeBlockDictionary.hpp"
|
|
||||||
#include "memory/freeList.hpp"
|
#include "memory/freeList.hpp"
|
||||||
#include "memory/metachunk.hpp"
|
#include "memory/metachunk.hpp"
|
||||||
#include "memory/resourceArea.hpp"
|
#include "memory/resourceArea.hpp"
|
||||||
@ -423,9 +422,7 @@ void BinaryTreeDictionary<Chunk_t, FreeList_t>::reset() {
|
|||||||
// Get a free block of size at least size from tree, or NULL.
|
// Get a free block of size at least size from tree, or NULL.
|
||||||
template <class Chunk_t, class FreeList_t>
|
template <class Chunk_t, class FreeList_t>
|
||||||
TreeChunk<Chunk_t, FreeList_t>*
|
TreeChunk<Chunk_t, FreeList_t>*
|
||||||
BinaryTreeDictionary<Chunk_t, FreeList_t>::get_chunk_from_tree(
|
BinaryTreeDictionary<Chunk_t, FreeList_t>::get_chunk_from_tree(size_t size)
|
||||||
size_t size,
|
|
||||||
enum FreeBlockDictionary<Chunk_t>::Dither dither)
|
|
||||||
{
|
{
|
||||||
TreeList<Chunk_t, FreeList_t> *curTL, *prevTL;
|
TreeList<Chunk_t, FreeList_t> *curTL, *prevTL;
|
||||||
TreeChunk<Chunk_t, FreeList_t>* retTC = NULL;
|
TreeChunk<Chunk_t, FreeList_t>* retTC = NULL;
|
||||||
@ -450,8 +447,6 @@ BinaryTreeDictionary<Chunk_t, FreeList_t>::get_chunk_from_tree(
|
|||||||
}
|
}
|
||||||
if (curTL == NULL) { // couldn't find exact match
|
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
|
// try and find the next larger size by walking back up the search path
|
||||||
for (curTL = prevTL; curTL != NULL;) {
|
for (curTL = prevTL; curTL != NULL;) {
|
||||||
if (curTL->size() >= size) break;
|
if (curTL->size() >= size) break;
|
||||||
@ -769,7 +764,7 @@ void BinaryTreeDictionary<Chunk_t, FreeList_t>::insert_chunk_in_tree(Chunk_t* fc
|
|||||||
|
|
||||||
template <class Chunk_t, class FreeList_t>
|
template <class Chunk_t, class FreeList_t>
|
||||||
size_t BinaryTreeDictionary<Chunk_t, FreeList_t>::max_chunk_size() const {
|
size_t BinaryTreeDictionary<Chunk_t, FreeList_t>::max_chunk_size() const {
|
||||||
FreeBlockDictionary<Chunk_t>::verify_par_locked();
|
verify_par_locked();
|
||||||
TreeList<Chunk_t, FreeList_t>* tc = root();
|
TreeList<Chunk_t, FreeList_t>* tc = root();
|
||||||
if (tc == NULL) return 0;
|
if (tc == NULL) return 0;
|
||||||
for (; tc->right() != NULL; tc = tc->right());
|
for (; tc->right() != NULL; tc = tc->right());
|
||||||
@ -1109,6 +1104,27 @@ size_t BinaryTreeDictionary<Chunk_t, FreeList_t>::total_count() {
|
|||||||
ctc.do_tree(root());
|
ctc.do_tree(root());
|
||||||
return ctc.count;
|
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
|
#endif // PRODUCT
|
||||||
|
|
||||||
// Calculate surpluses for the lists in the tree.
|
// Calculate surpluses for the lists in the tree.
|
||||||
@ -1199,7 +1215,7 @@ void BinaryTreeDictionary<Chunk_t, FreeList_t>::end_sweep_dict_census(double spl
|
|||||||
// Print summary statistics
|
// Print summary statistics
|
||||||
template <class Chunk_t, class FreeList_t>
|
template <class Chunk_t, class FreeList_t>
|
||||||
void BinaryTreeDictionary<Chunk_t, FreeList_t>::report_statistics(outputStream* st) const {
|
void BinaryTreeDictionary<Chunk_t, FreeList_t>::report_statistics(outputStream* st) const {
|
||||||
FreeBlockDictionary<Chunk_t>::verify_par_locked();
|
verify_par_locked();
|
||||||
st->print_cr("Statistics for BinaryTreeDictionary:");
|
st->print_cr("Statistics for BinaryTreeDictionary:");
|
||||||
st->print_cr("------------------------------------");
|
st->print_cr("------------------------------------");
|
||||||
size_t total_size = total_chunk_size(debug_only(NULL));
|
size_t total_size = total_chunk_size(debug_only(NULL));
|
||||||
|
@ -25,7 +25,6 @@
|
|||||||
#ifndef SHARE_VM_MEMORY_BINARYTREEDICTIONARY_HPP
|
#ifndef SHARE_VM_MEMORY_BINARYTREEDICTIONARY_HPP
|
||||||
#define SHARE_VM_MEMORY_BINARYTREEDICTIONARY_HPP
|
#define SHARE_VM_MEMORY_BINARYTREEDICTIONARY_HPP
|
||||||
|
|
||||||
#include "memory/freeBlockDictionary.hpp"
|
|
||||||
#include "memory/freeList.hpp"
|
#include "memory/freeList.hpp"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -176,7 +175,7 @@ template <class Chunk_t, class FreeList_t>
|
|||||||
size_t TreeChunk<Chunk_t, FreeList_t>::min_size() { return _min_tree_chunk_size; }
|
size_t TreeChunk<Chunk_t, FreeList_t>::min_size() { return _min_tree_chunk_size; }
|
||||||
|
|
||||||
template <class Chunk_t, class FreeList_t>
|
template <class Chunk_t, class FreeList_t>
|
||||||
class BinaryTreeDictionary: public FreeBlockDictionary<Chunk_t> {
|
class BinaryTreeDictionary: public CHeapObj<mtGC> {
|
||||||
friend class VMStructs;
|
friend class VMStructs;
|
||||||
size_t _total_size;
|
size_t _total_size;
|
||||||
size_t _total_free_blocks;
|
size_t _total_free_blocks;
|
||||||
@ -184,8 +183,8 @@ class BinaryTreeDictionary: public FreeBlockDictionary<Chunk_t> {
|
|||||||
|
|
||||||
// private accessors
|
// private accessors
|
||||||
void set_total_size(size_t v) { _total_size = v; }
|
void set_total_size(size_t v) { _total_size = v; }
|
||||||
virtual void inc_total_size(size_t v);
|
void inc_total_size(size_t v);
|
||||||
virtual void dec_total_size(size_t v);
|
void dec_total_size(size_t v);
|
||||||
void set_total_free_blocks(size_t v) { _total_free_blocks = v; }
|
void set_total_free_blocks(size_t v) { _total_free_blocks = v; }
|
||||||
TreeList<Chunk_t, FreeList_t>* root() const { return _root; }
|
TreeList<Chunk_t, FreeList_t>* root() const { return _root; }
|
||||||
void set_root(TreeList<Chunk_t, FreeList_t>* v) { _root = v; }
|
void set_root(TreeList<Chunk_t, FreeList_t>* v) { _root = v; }
|
||||||
@ -200,7 +199,7 @@ class BinaryTreeDictionary: public FreeBlockDictionary<Chunk_t> {
|
|||||||
// return it. If the chunk
|
// return it. If the chunk
|
||||||
// is the last chunk of that size, remove the node for that size
|
// is the last chunk of that size, remove the node for that size
|
||||||
// from the tree.
|
// 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
|
// Remove this chunk from the tree. If the removal results
|
||||||
// in an empty list in the tree, remove the empty list.
|
// 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);
|
TreeChunk<Chunk_t, FreeList_t>* remove_chunk_from_tree(TreeChunk<Chunk_t, FreeList_t>* tc);
|
||||||
@ -259,23 +258,21 @@ class BinaryTreeDictionary: public FreeBlockDictionary<Chunk_t> {
|
|||||||
|
|
||||||
// Return a chunk of size "size" or greater from
|
// Return a chunk of size "size" or greater from
|
||||||
// the tree.
|
// the tree.
|
||||||
Chunk_t* get_chunk(size_t size, enum FreeBlockDictionary<Chunk_t>::Dither dither) {
|
Chunk_t* get_chunk(size_t size) {
|
||||||
FreeBlockDictionary<Chunk_t>::verify_par_locked();
|
verify_par_locked();
|
||||||
Chunk_t* res = get_chunk_from_tree(size, dither);
|
Chunk_t* res = get_chunk_from_tree(size);
|
||||||
assert(res == NULL || res->is_free(),
|
assert(res == NULL || res->is_free(),
|
||||||
"Should be returning a free chunk");
|
"Should be returning a free chunk");
|
||||||
assert(dither != FreeBlockDictionary<Chunk_t>::exactly ||
|
|
||||||
res == NULL || res->size() == size, "Not correct size");
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
void return_chunk(Chunk_t* chunk) {
|
void return_chunk(Chunk_t* chunk) {
|
||||||
FreeBlockDictionary<Chunk_t>::verify_par_locked();
|
verify_par_locked();
|
||||||
insert_chunk_in_tree(chunk);
|
insert_chunk_in_tree(chunk);
|
||||||
}
|
}
|
||||||
|
|
||||||
void remove_chunk(Chunk_t* 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);
|
remove_chunk_from_tree((TreeChunk<Chunk_t, FreeList_t>*)chunk);
|
||||||
assert(chunk->is_free(), "Should still be a free chunk");
|
assert(chunk->is_free(), "Should still be a free chunk");
|
||||||
}
|
}
|
||||||
@ -340,6 +337,10 @@ class BinaryTreeDictionary: public FreeBlockDictionary<Chunk_t> {
|
|||||||
void report_statistics(outputStream* st) const;
|
void report_statistics(outputStream* st) const;
|
||||||
|
|
||||||
void verify() 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
|
#endif // SHARE_VM_MEMORY_BINARYTREEDICTIONARY_HPP
|
||||||
|
@ -1,60 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2002, 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.
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
* questions.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "precompiled.hpp"
|
|
||||||
#include "memory/freeBlockDictionary.hpp"
|
|
||||||
#include "memory/metachunk.hpp"
|
|
||||||
#include "runtime/thread.inline.hpp"
|
|
||||||
#include "utilities/macros.hpp"
|
|
||||||
#if INCLUDE_ALL_GCS
|
|
||||||
#include "gc/cms/freeChunk.hpp"
|
|
||||||
#endif // INCLUDE_ALL_GCS
|
|
||||||
|
|
||||||
#ifndef PRODUCT
|
|
||||||
template <class Chunk> Mutex* FreeBlockDictionary<Chunk>::par_lock() const {
|
|
||||||
return _lock;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class Chunk> void FreeBlockDictionary<Chunk>::set_par_lock(Mutex* lock) {
|
|
||||||
_lock = lock;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class Chunk> void FreeBlockDictionary<Chunk>::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
|
|
||||||
|
|
||||||
template class FreeBlockDictionary<Metablock>;
|
|
||||||
template class FreeBlockDictionary<Metachunk>;
|
|
||||||
|
|
||||||
#if INCLUDE_ALL_GCS
|
|
||||||
// Explicitly instantiate for FreeChunk
|
|
||||||
template class FreeBlockDictionary<FreeChunk>;
|
|
||||||
#endif // INCLUDE_ALL_GCS
|
|
@ -1,106 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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
|
|
||||||
* questions.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef SHARE_VM_MEMORY_FREEBLOCKDICTIONARY_HPP
|
|
||||||
#define SHARE_VM_MEMORY_FREEBLOCKDICTIONARY_HPP
|
|
||||||
|
|
||||||
#include "memory/allocation.hpp"
|
|
||||||
#include "runtime/mutex.hpp"
|
|
||||||
#include "utilities/debug.hpp"
|
|
||||||
#include "utilities/globalDefinitions.hpp"
|
|
||||||
#include "utilities/ostream.hpp"
|
|
||||||
|
|
||||||
// A FreeBlockDictionary is an abstract superclass that will allow
|
|
||||||
// a number of alternative implementations in the future.
|
|
||||||
template <class Chunk>
|
|
||||||
class FreeBlockDictionary: public CHeapObj<mtGC> {
|
|
||||||
public:
|
|
||||||
enum Dither {
|
|
||||||
atLeast,
|
|
||||||
exactly,
|
|
||||||
roughly
|
|
||||||
};
|
|
||||||
enum DictionaryChoice {
|
|
||||||
dictionaryBinaryTree = 0,
|
|
||||||
dictionarySplayTree = 1,
|
|
||||||
dictionarySkipList = 2
|
|
||||||
};
|
|
||||||
|
|
||||||
private:
|
|
||||||
// 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.
|
|
||||||
NOT_PRODUCT(Mutex* _lock;)
|
|
||||||
|
|
||||||
public:
|
|
||||||
virtual void remove_chunk(Chunk* fc) = 0;
|
|
||||||
virtual Chunk* get_chunk(size_t size, Dither dither = atLeast) = 0;
|
|
||||||
virtual void return_chunk(Chunk* chunk) = 0;
|
|
||||||
virtual size_t total_chunk_size(debug_only(const Mutex* lock)) const = 0;
|
|
||||||
virtual size_t max_chunk_size() const = 0;
|
|
||||||
virtual size_t min_size() const = 0;
|
|
||||||
// Reset the dictionary to the initial conditions for a single
|
|
||||||
// block.
|
|
||||||
virtual void reset(HeapWord* addr, size_t size) = 0;
|
|
||||||
virtual void reset() = 0;
|
|
||||||
|
|
||||||
virtual void dict_census_update(size_t size, bool split, bool birth) = 0;
|
|
||||||
virtual bool coal_dict_over_populated(size_t size) = 0;
|
|
||||||
virtual void begin_sweep_dict_census(double coalSurplusPercent,
|
|
||||||
float inter_sweep_current, float inter_sweep_estimate,
|
|
||||||
float intra__sweep_current) = 0;
|
|
||||||
virtual void end_sweep_dict_census(double splitSurplusPercent) = 0;
|
|
||||||
virtual Chunk* find_largest_dict() const = 0;
|
|
||||||
// verify that the given chunk is in the dictionary.
|
|
||||||
virtual bool verify_chunk_in_free_list(Chunk* tc) const = 0;
|
|
||||||
|
|
||||||
// Sigma_{all_free_blocks} (block_size^2)
|
|
||||||
virtual double sum_of_squared_block_sizes() const = 0;
|
|
||||||
|
|
||||||
virtual Chunk* find_chunk_ends_at(HeapWord* target) const = 0;
|
|
||||||
virtual void inc_total_size(size_t v) = 0;
|
|
||||||
virtual void dec_total_size(size_t v) = 0;
|
|
||||||
|
|
||||||
NOT_PRODUCT (
|
|
||||||
virtual size_t sum_dict_returned_bytes() = 0;
|
|
||||||
virtual void initialize_dict_returned_bytes() = 0;
|
|
||||||
virtual size_t total_count() = 0;
|
|
||||||
)
|
|
||||||
|
|
||||||
virtual void report_statistics(outputStream* st) const {
|
|
||||||
st->print_cr("No statistics available");
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void print_dict_census(outputStream* st) const = 0;
|
|
||||||
virtual void print_free_lists(outputStream* st) const = 0;
|
|
||||||
|
|
||||||
virtual void verify() const = 0;
|
|
||||||
|
|
||||||
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_FREEBLOCKDICTIONARY_HPP
|
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2001, 2015, 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.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -24,7 +24,6 @@
|
|||||||
|
|
||||||
#include "precompiled.hpp"
|
#include "precompiled.hpp"
|
||||||
#include "gc/shared/collectedHeap.hpp"
|
#include "gc/shared/collectedHeap.hpp"
|
||||||
#include "memory/freeBlockDictionary.hpp"
|
|
||||||
#include "memory/freeList.hpp"
|
#include "memory/freeList.hpp"
|
||||||
#include "memory/metachunk.hpp"
|
#include "memory/metachunk.hpp"
|
||||||
#include "runtime/globals.hpp"
|
#include "runtime/globals.hpp"
|
||||||
|
@ -940,8 +940,7 @@ MetaWord* BlockFreelist::get_block(size_t word_size) {
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Metablock* free_block =
|
Metablock* free_block = dictionary()->get_chunk(word_size);
|
||||||
dictionary()->get_chunk(word_size, FreeBlockDictionary<Metablock>::atLeast);
|
|
||||||
if (free_block == NULL) {
|
if (free_block == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -1912,9 +1911,7 @@ Metachunk* ChunkManager::free_chunks_get(size_t word_size) {
|
|||||||
log_trace(gc, metaspace, freelist)("ChunkManager::free_chunks_get: free_list " PTR_FORMAT " head " PTR_FORMAT " size " SIZE_FORMAT,
|
log_trace(gc, metaspace, freelist)("ChunkManager::free_chunks_get: free_list " PTR_FORMAT " head " PTR_FORMAT " size " SIZE_FORMAT,
|
||||||
p2i(free_list), p2i(chunk), chunk->word_size());
|
p2i(free_list), p2i(chunk), chunk->word_size());
|
||||||
} else {
|
} else {
|
||||||
chunk = humongous_dictionary()->get_chunk(
|
chunk = humongous_dictionary()->get_chunk(word_size);
|
||||||
word_size,
|
|
||||||
FreeBlockDictionary<Metachunk>::atLeast);
|
|
||||||
|
|
||||||
if (chunk == NULL) {
|
if (chunk == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -60,7 +60,6 @@
|
|||||||
#include "interpreter/interpreter.hpp"
|
#include "interpreter/interpreter.hpp"
|
||||||
#include "memory/allocation.hpp"
|
#include "memory/allocation.hpp"
|
||||||
#include "memory/allocation.inline.hpp"
|
#include "memory/allocation.inline.hpp"
|
||||||
#include "memory/freeBlockDictionary.hpp"
|
|
||||||
#include "memory/heap.hpp"
|
#include "memory/heap.hpp"
|
||||||
#include "memory/metachunk.hpp"
|
#include "memory/metachunk.hpp"
|
||||||
#include "memory/referenceType.hpp"
|
#include "memory/referenceType.hpp"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user