diff options
author | ehelin <none@none> | 2013-06-20 10:03:58 +0200 |
---|---|---|
committer | ehelin <none@none> | 2013-06-20 10:03:58 +0200 |
commit | 274b53932a161c8fad5e4d221aaefc30af99a647 (patch) | |
tree | f860b9471ffc4d2e86b2ae21da3572b5e5fd3631 /src/share/vm/utilities | |
parent | 78db18d707d3cb0e9a21fec9fd0d36f9c2626985 (diff) | |
parent | c2330cee5b159083e0969ba9d56f2fe6f442959b (diff) |
Merge
Diffstat (limited to 'src/share/vm/utilities')
-rw-r--r-- | src/share/vm/utilities/bitMap.cpp | 10 | ||||
-rw-r--r-- | src/share/vm/utilities/bitMap.hpp | 3 |
2 files changed, 8 insertions, 5 deletions
diff --git a/src/share/vm/utilities/bitMap.cpp b/src/share/vm/utilities/bitMap.cpp index 152b40d39..01825d302 100644 --- a/src/share/vm/utilities/bitMap.cpp +++ b/src/share/vm/utilities/bitMap.cpp @@ -41,7 +41,7 @@ BitMap::BitMap(bm_word_t* map, idx_t size_in_bits) : - _map(map), _size(size_in_bits) + _map(map), _size(size_in_bits), _map_allocator(false) { assert(sizeof(bm_word_t) == BytesPerWord, "Implementation assumption."); assert(size_in_bits >= 0, "just checking"); @@ -49,7 +49,7 @@ BitMap::BitMap(bm_word_t* map, idx_t size_in_bits) : BitMap::BitMap(idx_t size_in_bits, bool in_resource_area) : - _map(NULL), _size(0) + _map(NULL), _size(0), _map_allocator(false) { assert(sizeof(bm_word_t) == BytesPerWord, "Implementation assumption."); resize(size_in_bits, in_resource_area); @@ -65,8 +65,10 @@ void BitMap::resize(idx_t size_in_bits, bool in_resource_area) { if (in_resource_area) { _map = NEW_RESOURCE_ARRAY(bm_word_t, new_size_in_words); } else { - if (old_map != NULL) FREE_C_HEAP_ARRAY(bm_word_t, _map, mtInternal); - _map = NEW_C_HEAP_ARRAY(bm_word_t, new_size_in_words, mtInternal); + if (old_map != NULL) { + _map_allocator.free(); + } + _map = _map_allocator.allocate(new_size_in_words); } Copy::disjoint_words((HeapWord*)old_map, (HeapWord*) _map, MIN2(old_size_in_words, new_size_in_words)); diff --git a/src/share/vm/utilities/bitMap.hpp b/src/share/vm/utilities/bitMap.hpp index 2486533ab..c4cac118b 100644 --- a/src/share/vm/utilities/bitMap.hpp +++ b/src/share/vm/utilities/bitMap.hpp @@ -48,6 +48,7 @@ class BitMap VALUE_OBJ_CLASS_SPEC { } RangeSizeHint; private: + ArrayAllocator<bm_word_t, mtInternal> _map_allocator; bm_word_t* _map; // First word in bitmap idx_t _size; // Size of bitmap (in bits) @@ -113,7 +114,7 @@ class BitMap VALUE_OBJ_CLASS_SPEC { public: // Constructs a bitmap with no map, and size 0. - BitMap() : _map(NULL), _size(0) {} + BitMap() : _map(NULL), _size(0), _map_allocator(false) {} // Constructs a bitmap with the given map and size. BitMap(bm_word_t* map, idx_t size_in_bits); |