Mercurial > hg > truffle
comparison src/share/vm/utilities/bitMap.cpp @ 10992:b9d151496930
8016556: G1: Use ArrayAllocator for BitMaps
Reviewed-by: tschatzl, dholmes, coleenp, johnc
author | brutisso |
---|---|
date | Tue, 18 Jun 2013 22:45:32 +0200 |
parents | 7b835924c31c |
children | de6a9e811145 bdd155477289 |
comparison
equal
deleted
inserted
replaced
10991:01522ca68fc7 | 10992:b9d151496930 |
---|---|
39 # include "os_bsd.inline.hpp" | 39 # include "os_bsd.inline.hpp" |
40 #endif | 40 #endif |
41 | 41 |
42 | 42 |
43 BitMap::BitMap(bm_word_t* map, idx_t size_in_bits) : | 43 BitMap::BitMap(bm_word_t* map, idx_t size_in_bits) : |
44 _map(map), _size(size_in_bits) | 44 _map(map), _size(size_in_bits), _map_allocator(false) |
45 { | 45 { |
46 assert(sizeof(bm_word_t) == BytesPerWord, "Implementation assumption."); | 46 assert(sizeof(bm_word_t) == BytesPerWord, "Implementation assumption."); |
47 assert(size_in_bits >= 0, "just checking"); | 47 assert(size_in_bits >= 0, "just checking"); |
48 } | 48 } |
49 | 49 |
50 | 50 |
51 BitMap::BitMap(idx_t size_in_bits, bool in_resource_area) : | 51 BitMap::BitMap(idx_t size_in_bits, bool in_resource_area) : |
52 _map(NULL), _size(0) | 52 _map(NULL), _size(0), _map_allocator(false) |
53 { | 53 { |
54 assert(sizeof(bm_word_t) == BytesPerWord, "Implementation assumption."); | 54 assert(sizeof(bm_word_t) == BytesPerWord, "Implementation assumption."); |
55 resize(size_in_bits, in_resource_area); | 55 resize(size_in_bits, in_resource_area); |
56 } | 56 } |
57 | 57 |
63 _size = size_in_bits; | 63 _size = size_in_bits; |
64 idx_t new_size_in_words = size_in_words(); | 64 idx_t new_size_in_words = size_in_words(); |
65 if (in_resource_area) { | 65 if (in_resource_area) { |
66 _map = NEW_RESOURCE_ARRAY(bm_word_t, new_size_in_words); | 66 _map = NEW_RESOURCE_ARRAY(bm_word_t, new_size_in_words); |
67 } else { | 67 } else { |
68 if (old_map != NULL) FREE_C_HEAP_ARRAY(bm_word_t, _map, mtInternal); | 68 if (old_map != NULL) { |
69 _map = NEW_C_HEAP_ARRAY(bm_word_t, new_size_in_words, mtInternal); | 69 _map_allocator.free(); |
70 } | |
71 _map = _map_allocator.allocate(new_size_in_words); | |
70 } | 72 } |
71 Copy::disjoint_words((HeapWord*)old_map, (HeapWord*) _map, | 73 Copy::disjoint_words((HeapWord*)old_map, (HeapWord*) _map, |
72 MIN2(old_size_in_words, new_size_in_words)); | 74 MIN2(old_size_in_words, new_size_in_words)); |
73 if (new_size_in_words > old_size_in_words) { | 75 if (new_size_in_words > old_size_in_words) { |
74 clear_range_of_words(old_size_in_words, size_in_words()); | 76 clear_range_of_words(old_size_in_words, size_in_words()); |