Mathieu Chartier | b062fdd | 2012-07-03 09:51:48 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2008 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #ifndef ART_SRC_SPACE_BITMAP_H_ |
| 18 | #define ART_SRC_SPACE_BITMAP_H_ |
| 19 | |
| 20 | #include <limits.h> |
Mathieu Chartier | e0f0cb3 | 2012-08-28 11:26:00 -0700 | [diff] [blame] | 21 | #include <set> |
Mathieu Chartier | b062fdd | 2012-07-03 09:51:48 -0700 | [diff] [blame] | 22 | #include <stdint.h> |
| 23 | #include <vector> |
| 24 | |
Mathieu Chartier | 02b6a78 | 2012-10-26 13:51:26 -0700 | [diff] [blame] | 25 | #include "cutils/atomic.h" |
| 26 | #include "cutils/atomic-inline.h" |
Mathieu Chartier | b062fdd | 2012-07-03 09:51:48 -0700 | [diff] [blame] | 27 | #include "UniquePtr.h" |
| 28 | #include "globals.h" |
| 29 | #include "logging.h" |
| 30 | #include "mem_map.h" |
| 31 | #include "utils.h" |
| 32 | |
| 33 | namespace art { |
| 34 | |
| 35 | class Object; |
| 36 | |
| 37 | class SpaceBitmap { |
| 38 | public: |
| 39 | static const size_t kAlignment = 8; |
| 40 | |
| 41 | typedef void Callback(Object* obj, void* arg); |
| 42 | |
| 43 | typedef void ScanCallback(Object* obj, void* finger, void* arg); |
| 44 | |
| 45 | typedef void SweepCallback(size_t ptr_count, Object** ptrs, void* arg); |
| 46 | |
| 47 | // Initialize a HeapBitmap so that it points to a bitmap large enough to cover a heap at |
| 48 | // heap_begin of heap_capacity bytes, where objects are guaranteed to be kAlignment-aligned. |
| 49 | static SpaceBitmap* Create(const std::string& name, byte* heap_begin, size_t heap_capacity); |
| 50 | |
| 51 | ~SpaceBitmap(); |
| 52 | |
| 53 | // <offset> is the difference from .base to a pointer address. |
| 54 | // <index> is the index of .bits that contains the bit representing |
| 55 | // <offset>. |
| 56 | static size_t OffsetToIndex(size_t offset) { |
| 57 | return offset / kAlignment / kBitsPerWord; |
| 58 | } |
| 59 | |
| 60 | static uintptr_t IndexToOffset(size_t index) { |
| 61 | return static_cast<uintptr_t>(index * kAlignment * kBitsPerWord); |
| 62 | } |
| 63 | |
| 64 | // Pack the bits in backwards so they come out in address order when using CLZ. |
| 65 | static word OffsetToMask(uintptr_t offset_) { |
Mathieu Chartier | dcf8d72 | 2012-08-02 14:55:54 -0700 | [diff] [blame] | 66 | return static_cast<uintptr_t>(kWordHighBitMask) >> ((offset_ / kAlignment) % kBitsPerWord); |
Mathieu Chartier | b062fdd | 2012-07-03 09:51:48 -0700 | [diff] [blame] | 67 | } |
| 68 | |
Mathieu Chartier | 02b6a78 | 2012-10-26 13:51:26 -0700 | [diff] [blame] | 69 | inline bool Set(const Object* obj) { |
| 70 | return Modify(obj, true); |
Mathieu Chartier | b062fdd | 2012-07-03 09:51:48 -0700 | [diff] [blame] | 71 | } |
| 72 | |
Mathieu Chartier | 02b6a78 | 2012-10-26 13:51:26 -0700 | [diff] [blame] | 73 | inline bool Clear(const Object* obj) { |
| 74 | return Modify(obj, false); |
| 75 | } |
| 76 | |
| 77 | // Returns true if the object was previously marked. |
| 78 | inline bool AtomicTestAndSet(const Object* obj) { |
| 79 | uintptr_t addr = reinterpret_cast<uintptr_t>(obj); |
| 80 | DCHECK_GE(addr, heap_begin_); |
| 81 | const uintptr_t offset = addr - heap_begin_; |
| 82 | const size_t index = OffsetToIndex(offset); |
| 83 | const word mask = OffsetToMask(offset); |
| 84 | word* const address = &bitmap_begin_[index]; |
| 85 | DCHECK_LT(index, bitmap_size_ / kWordSize) << " bitmap_size_ = " << bitmap_size_; |
| 86 | word old_word; |
| 87 | do { |
| 88 | old_word = *address; |
| 89 | // Fast path: The bit is already set. |
| 90 | if ((old_word & mask) != 0) { |
| 91 | return true; |
| 92 | } |
| 93 | } while (UNLIKELY(android_atomic_cas(old_word, old_word | mask, address) != 0)); |
| 94 | return false; |
Mathieu Chartier | b062fdd | 2012-07-03 09:51:48 -0700 | [diff] [blame] | 95 | } |
| 96 | |
| 97 | void Clear(); |
| 98 | |
| 99 | inline bool Test(const Object* obj) const { |
| 100 | uintptr_t addr = reinterpret_cast<uintptr_t>(obj); |
| 101 | DCHECK(HasAddress(obj)) << obj; |
| 102 | DCHECK(bitmap_begin_ != NULL); |
| 103 | DCHECK_GE(addr, heap_begin_); |
Mathieu Chartier | 357e9be | 2012-08-01 11:00:14 -0700 | [diff] [blame] | 104 | const uintptr_t offset = addr - heap_begin_; |
| 105 | return (bitmap_begin_[OffsetToIndex(offset)] & OffsetToMask(offset)) != 0; |
Mathieu Chartier | b062fdd | 2012-07-03 09:51:48 -0700 | [diff] [blame] | 106 | } |
| 107 | |
Ian Rogers | 506de0c | 2012-09-17 15:39:06 -0700 | [diff] [blame] | 108 | // Return true iff <obj> is within the range of pointers that this bitmap could potentially cover, |
| 109 | // even if a bit has not been set for it. |
| 110 | bool HasAddress(const void* obj) const { |
| 111 | // If obj < heap_begin_ then offset underflows to some very large value past the end of the |
| 112 | // bitmap. |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame^] | 113 | const uintptr_t offset = reinterpret_cast<uintptr_t>(obj) - heap_begin_; |
Ian Rogers | 506de0c | 2012-09-17 15:39:06 -0700 | [diff] [blame] | 114 | const size_t index = OffsetToIndex(offset); |
| 115 | return index < bitmap_size_ / kWordSize; |
| 116 | } |
Mathieu Chartier | b062fdd | 2012-07-03 09:51:48 -0700 | [diff] [blame] | 117 | |
| 118 | void VisitRange(uintptr_t base, uintptr_t max, Callback* visitor, void* arg) const; |
| 119 | |
| 120 | class ClearVisitor { |
| 121 | public: |
| 122 | explicit ClearVisitor(SpaceBitmap* const bitmap) |
| 123 | : bitmap_(bitmap) { |
| 124 | } |
| 125 | |
| 126 | void operator ()(Object* obj) const { |
| 127 | bitmap_->Clear(obj); |
| 128 | } |
| 129 | private: |
| 130 | SpaceBitmap* const bitmap_; |
| 131 | }; |
| 132 | |
| 133 | template <typename Visitor> |
| 134 | void VisitRange(uintptr_t visit_begin, uintptr_t visit_end, const Visitor& visitor) const { |
| 135 | for (; visit_begin < visit_end; visit_begin += kAlignment ) { |
| 136 | visitor(reinterpret_cast<Object*>(visit_begin)); |
| 137 | } |
| 138 | } |
| 139 | |
Mathieu Chartier | 357e9be | 2012-08-01 11:00:14 -0700 | [diff] [blame] | 140 | template <typename Visitor, typename FingerVisitor> |
| 141 | void VisitMarkedRange(uintptr_t visit_begin, uintptr_t visit_end, |
| 142 | const Visitor& visitor, const FingerVisitor& finger_visitor) const |
Ian Rogers | b726dcb | 2012-09-05 08:57:23 -0700 | [diff] [blame] | 143 | EXCLUSIVE_LOCKS_REQUIRED(Locks::heap_bitmap_lock_) { |
Mathieu Chartier | cc236d7 | 2012-07-20 10:29:05 -0700 | [diff] [blame] | 144 | DCHECK_LT(visit_begin, visit_end); |
| 145 | |
Mathieu Chartier | 357e9be | 2012-08-01 11:00:14 -0700 | [diff] [blame] | 146 | const size_t word_span = kAlignment * kBitsPerWord; // Equals IndexToOffset(1). |
Mathieu Chartier | cc236d7 | 2012-07-20 10:29:05 -0700 | [diff] [blame] | 147 | const size_t bit_index_start = (visit_begin - heap_begin_) / kAlignment; |
| 148 | const size_t bit_index_end = (visit_end - heap_begin_ - 1) / kAlignment; |
| 149 | |
| 150 | size_t word_start = bit_index_start / kBitsPerWord; |
| 151 | size_t word_end = bit_index_end / kBitsPerWord; |
Mathieu Chartier | dcf8d72 | 2012-08-02 14:55:54 -0700 | [diff] [blame] | 152 | DCHECK_LT(word_end * kWordSize, Size()); |
Mathieu Chartier | cc236d7 | 2012-07-20 10:29:05 -0700 | [diff] [blame] | 153 | |
| 154 | // Trim off left_bits of left bits. |
| 155 | size_t edge_word = bitmap_begin_[word_start]; |
| 156 | |
| 157 | // Handle bits on the left first as a special case |
| 158 | size_t left_bits = bit_index_start & (kBitsPerWord - 1); |
| 159 | if (left_bits != 0) { |
| 160 | edge_word &= (1 << (kBitsPerWord - left_bits)) - 1; |
| 161 | } |
| 162 | |
| 163 | // If word_start == word_end then handle this case at the same place we handle the right edge. |
| 164 | if (edge_word != 0 && word_start < word_end) { |
| 165 | uintptr_t ptr_base = IndexToOffset(word_start) + heap_begin_; |
Mathieu Chartier | 357e9be | 2012-08-01 11:00:14 -0700 | [diff] [blame] | 166 | finger_visitor(reinterpret_cast<void*>(ptr_base + word_span)); |
Mathieu Chartier | cc236d7 | 2012-07-20 10:29:05 -0700 | [diff] [blame] | 167 | do { |
| 168 | const size_t shift = CLZ(edge_word); |
| 169 | Object* obj = reinterpret_cast<Object*>(ptr_base + shift * kAlignment); |
| 170 | visitor(obj); |
Mathieu Chartier | dcf8d72 | 2012-08-02 14:55:54 -0700 | [diff] [blame] | 171 | edge_word ^= static_cast<size_t>(kWordHighBitMask) >> shift; |
Mathieu Chartier | cc236d7 | 2012-07-20 10:29:05 -0700 | [diff] [blame] | 172 | } while (edge_word != 0); |
| 173 | } |
| 174 | word_start++; |
| 175 | |
| 176 | for (size_t i = word_start; i < word_end; i++) { |
| 177 | size_t w = bitmap_begin_[i]; |
Mathieu Chartier | b062fdd | 2012-07-03 09:51:48 -0700 | [diff] [blame] | 178 | if (w != 0) { |
Mathieu Chartier | b062fdd | 2012-07-03 09:51:48 -0700 | [diff] [blame] | 179 | uintptr_t ptr_base = IndexToOffset(i) + heap_begin_; |
Mathieu Chartier | 357e9be | 2012-08-01 11:00:14 -0700 | [diff] [blame] | 180 | finger_visitor(reinterpret_cast<void*>(ptr_base + word_span)); |
Mathieu Chartier | b062fdd | 2012-07-03 09:51:48 -0700 | [diff] [blame] | 181 | do { |
Mathieu Chartier | cc236d7 | 2012-07-20 10:29:05 -0700 | [diff] [blame] | 182 | const size_t shift = CLZ(w); |
Mathieu Chartier | b062fdd | 2012-07-03 09:51:48 -0700 | [diff] [blame] | 183 | Object* obj = reinterpret_cast<Object*>(ptr_base + shift * kAlignment); |
| 184 | visitor(obj); |
Mathieu Chartier | dcf8d72 | 2012-08-02 14:55:54 -0700 | [diff] [blame] | 185 | w ^= static_cast<size_t>(kWordHighBitMask) >> shift; |
Mathieu Chartier | b062fdd | 2012-07-03 09:51:48 -0700 | [diff] [blame] | 186 | } while (w != 0); |
| 187 | } |
| 188 | } |
Mathieu Chartier | cc236d7 | 2012-07-20 10:29:05 -0700 | [diff] [blame] | 189 | |
| 190 | // Handle the right edge, and also the left edge if both edges are on the same word. |
| 191 | size_t right_bits = bit_index_end & (kBitsPerWord - 1); |
| 192 | |
| 193 | // If word_start == word_end then we need to use the word which we removed the left bits. |
| 194 | if (word_start <= word_end) { |
| 195 | edge_word = bitmap_begin_[word_end]; |
| 196 | } |
| 197 | |
| 198 | // Bits that we trim off the right. |
Mathieu Chartier | 357e9be | 2012-08-01 11:00:14 -0700 | [diff] [blame] | 199 | edge_word &= ~((static_cast<size_t>(kWordHighBitMask) >> right_bits) - 1); |
Mathieu Chartier | cc236d7 | 2012-07-20 10:29:05 -0700 | [diff] [blame] | 200 | uintptr_t ptr_base = IndexToOffset(word_end) + heap_begin_; |
Mathieu Chartier | 357e9be | 2012-08-01 11:00:14 -0700 | [diff] [blame] | 201 | finger_visitor(reinterpret_cast<void*>(ptr_base + word_span)); |
Mathieu Chartier | cc236d7 | 2012-07-20 10:29:05 -0700 | [diff] [blame] | 202 | while (edge_word != 0) { |
Mathieu Chartier | dcf8d72 | 2012-08-02 14:55:54 -0700 | [diff] [blame] | 203 | const size_t shift = CLZ(edge_word); |
Mathieu Chartier | cc236d7 | 2012-07-20 10:29:05 -0700 | [diff] [blame] | 204 | Object* obj = reinterpret_cast<Object*>(ptr_base + shift * kAlignment); |
| 205 | visitor(obj); |
Mathieu Chartier | dcf8d72 | 2012-08-02 14:55:54 -0700 | [diff] [blame] | 206 | edge_word ^= static_cast<size_t>(kWordHighBitMask) >> shift; |
Mathieu Chartier | cc236d7 | 2012-07-20 10:29:05 -0700 | [diff] [blame] | 207 | } |
Mathieu Chartier | b062fdd | 2012-07-03 09:51:48 -0700 | [diff] [blame] | 208 | } |
| 209 | |
Mathieu Chartier | 357e9be | 2012-08-01 11:00:14 -0700 | [diff] [blame] | 210 | void Walk(Callback* callback, void* arg) |
Ian Rogers | b726dcb | 2012-09-05 08:57:23 -0700 | [diff] [blame] | 211 | SHARED_LOCKS_REQUIRED(Locks::heap_bitmap_lock_); |
Mathieu Chartier | b062fdd | 2012-07-03 09:51:48 -0700 | [diff] [blame] | 212 | |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 213 | void InOrderWalk(Callback* callback, void* arg) |
Ian Rogers | b726dcb | 2012-09-05 08:57:23 -0700 | [diff] [blame] | 214 | SHARED_LOCKS_REQUIRED(Locks::heap_bitmap_lock_) |
| 215 | SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); |
Mathieu Chartier | b062fdd | 2012-07-03 09:51:48 -0700 | [diff] [blame] | 216 | |
Mathieu Chartier | b062fdd | 2012-07-03 09:51:48 -0700 | [diff] [blame] | 217 | static void SweepWalk(const SpaceBitmap& live, |
| 218 | const SpaceBitmap& mark, |
| 219 | uintptr_t base, uintptr_t max, |
| 220 | SweepCallback* thunk, void* arg); |
| 221 | |
Mathieu Chartier | 357e9be | 2012-08-01 11:00:14 -0700 | [diff] [blame] | 222 | void CopyFrom(SpaceBitmap* source_bitmap); |
| 223 | |
Mathieu Chartier | cc236d7 | 2012-07-20 10:29:05 -0700 | [diff] [blame] | 224 | // Starting address of our internal storage. |
| 225 | word* Begin() { |
| 226 | return bitmap_begin_; |
| 227 | } |
| 228 | |
| 229 | // Size of our internal storage |
| 230 | size_t Size() const { |
| 231 | return bitmap_size_; |
| 232 | } |
| 233 | |
| 234 | // Size in bytes of the memory that the bitmaps spans. |
| 235 | size_t HeapSize() const { |
| 236 | return IndexToOffset(Size() / kWordSize); |
| 237 | } |
| 238 | |
Mathieu Chartier | dcf8d72 | 2012-08-02 14:55:54 -0700 | [diff] [blame] | 239 | uintptr_t HeapBegin() const { |
Mathieu Chartier | cc236d7 | 2012-07-20 10:29:05 -0700 | [diff] [blame] | 240 | return heap_begin_; |
| 241 | } |
| 242 | |
Mathieu Chartier | dcf8d72 | 2012-08-02 14:55:54 -0700 | [diff] [blame] | 243 | // The maximum address which the bitmap can span. (HeapBegin() <= object < HeapLimit()). |
| 244 | uintptr_t HeapLimit() const { |
| 245 | return HeapBegin() + static_cast<uintptr_t>(HeapSize()); |
| 246 | } |
| 247 | |
| 248 | // Set the max address which can covered by the bitmap. |
| 249 | void SetHeapLimit(uintptr_t new_end); |
Mathieu Chartier | cc236d7 | 2012-07-20 10:29:05 -0700 | [diff] [blame] | 250 | |
Mathieu Chartier | 357e9be | 2012-08-01 11:00:14 -0700 | [diff] [blame] | 251 | std::string GetName() const; |
| 252 | void SetName(const std::string& name); |
| 253 | |
Mathieu Chartier | 02b6a78 | 2012-10-26 13:51:26 -0700 | [diff] [blame] | 254 | const void* GetObjectWordAddress(const Object* obj) const { |
| 255 | uintptr_t addr = reinterpret_cast<uintptr_t>(obj); |
| 256 | const uintptr_t offset = addr - heap_begin_; |
| 257 | const size_t index = OffsetToIndex(offset); |
| 258 | return &bitmap_begin_[index]; |
| 259 | } |
Mathieu Chartier | b062fdd | 2012-07-03 09:51:48 -0700 | [diff] [blame] | 260 | private: |
| 261 | // TODO: heap_end_ is initialized so that the heap bitmap is empty, this doesn't require the -1, |
| 262 | // however, we document that this is expected on heap_end_ |
| 263 | SpaceBitmap(const std::string& name, MemMap* mem_map, word* bitmap_begin, size_t bitmap_size, const void* heap_begin) |
| 264 | : mem_map_(mem_map), bitmap_begin_(bitmap_begin), bitmap_size_(bitmap_size), |
Mathieu Chartier | 357e9be | 2012-08-01 11:00:14 -0700 | [diff] [blame] | 265 | heap_begin_(reinterpret_cast<uintptr_t>(heap_begin)), |
Mathieu Chartier | b062fdd | 2012-07-03 09:51:48 -0700 | [diff] [blame] | 266 | name_(name) {} |
| 267 | |
Mathieu Chartier | 02b6a78 | 2012-10-26 13:51:26 -0700 | [diff] [blame] | 268 | inline bool Modify(const Object* obj, bool do_set) { |
Mathieu Chartier | b062fdd | 2012-07-03 09:51:48 -0700 | [diff] [blame] | 269 | uintptr_t addr = reinterpret_cast<uintptr_t>(obj); |
| 270 | DCHECK_GE(addr, heap_begin_); |
| 271 | const uintptr_t offset = addr - heap_begin_; |
| 272 | const size_t index = OffsetToIndex(offset); |
| 273 | const word mask = OffsetToMask(offset); |
| 274 | DCHECK_LT(index, bitmap_size_ / kWordSize) << " bitmap_size_ = " << bitmap_size_; |
Mathieu Chartier | 02b6a78 | 2012-10-26 13:51:26 -0700 | [diff] [blame] | 275 | word* address = &bitmap_begin_[index]; |
| 276 | word old_word = *address; |
Mathieu Chartier | b062fdd | 2012-07-03 09:51:48 -0700 | [diff] [blame] | 277 | if (do_set) { |
Mathieu Chartier | 02b6a78 | 2012-10-26 13:51:26 -0700 | [diff] [blame] | 278 | *address = old_word | mask; |
Mathieu Chartier | b062fdd | 2012-07-03 09:51:48 -0700 | [diff] [blame] | 279 | } else { |
Mathieu Chartier | 02b6a78 | 2012-10-26 13:51:26 -0700 | [diff] [blame] | 280 | *address = old_word & ~mask; |
Mathieu Chartier | b062fdd | 2012-07-03 09:51:48 -0700 | [diff] [blame] | 281 | } |
Mathieu Chartier | 02b6a78 | 2012-10-26 13:51:26 -0700 | [diff] [blame] | 282 | return (old_word & mask) != 0; |
Mathieu Chartier | b062fdd | 2012-07-03 09:51:48 -0700 | [diff] [blame] | 283 | } |
| 284 | |
| 285 | // Backing storage for bitmap. |
| 286 | UniquePtr<MemMap> mem_map_; |
| 287 | |
| 288 | // This bitmap itself, word sized for efficiency in scanning. |
| 289 | word* const bitmap_begin_; |
| 290 | |
| 291 | // Size of this bitmap. |
Mathieu Chartier | cc236d7 | 2012-07-20 10:29:05 -0700 | [diff] [blame] | 292 | size_t bitmap_size_; |
Mathieu Chartier | b062fdd | 2012-07-03 09:51:48 -0700 | [diff] [blame] | 293 | |
| 294 | // The base address of the heap, which corresponds to the word containing the first bit in the |
| 295 | // bitmap. |
| 296 | const uintptr_t heap_begin_; |
| 297 | |
Mathieu Chartier | b062fdd | 2012-07-03 09:51:48 -0700 | [diff] [blame] | 298 | // Name of this bitmap. |
| 299 | std::string name_; |
| 300 | }; |
| 301 | |
Mathieu Chartier | e0f0cb3 | 2012-08-28 11:26:00 -0700 | [diff] [blame] | 302 | // Like a bitmap except it keeps track of objects using sets. |
| 303 | class SpaceSetMap { |
| 304 | public: |
| 305 | typedef std::set<const Object*> Objects; |
| 306 | |
| 307 | bool IsEmpty() const { |
| 308 | return contained_.empty(); |
| 309 | } |
| 310 | |
| 311 | inline void Set(const Object* obj) { |
| 312 | contained_.insert(obj); |
| 313 | } |
| 314 | |
| 315 | inline void Clear(const Object* obj) { |
| 316 | Objects::iterator found = contained_.find(obj); |
| 317 | if (found != contained_.end()) { |
| 318 | contained_.erase(found); |
| 319 | } |
| 320 | } |
| 321 | |
| 322 | void Clear() { |
| 323 | contained_.clear(); |
| 324 | } |
| 325 | |
| 326 | inline bool Test(const Object* obj) const { |
| 327 | return contained_.find(obj) != contained_.end(); |
| 328 | } |
| 329 | |
| 330 | std::string GetName() const; |
| 331 | void SetName(const std::string& name); |
| 332 | |
| 333 | void Walk(SpaceBitmap::Callback* callback, void* arg) |
| 334 | SHARED_LOCKS_REQUIRED(GlobalSynchronization::heap_bitmap_lock_); |
| 335 | |
| 336 | void CopyFrom(const SpaceSetMap& space_set); |
| 337 | |
| 338 | template <typename Visitor> |
| 339 | void Visit(const Visitor& visitor) NO_THREAD_SAFETY_ANALYSIS { |
| 340 | for (Objects::iterator it = contained_.begin(); it != contained_.end(); ++it) { |
| 341 | visitor(*it); |
| 342 | } |
| 343 | } |
| 344 | |
| 345 | SpaceSetMap(const std::string& name); |
| 346 | |
| 347 | Objects& GetObjects() { |
| 348 | return contained_; |
| 349 | } |
| 350 | |
| 351 | private: |
| 352 | std::string name_; |
| 353 | Objects contained_; |
| 354 | }; |
| 355 | |
Mathieu Chartier | 357e9be | 2012-08-01 11:00:14 -0700 | [diff] [blame] | 356 | std::ostream& operator << (std::ostream& stream, const SpaceBitmap& bitmap); |
| 357 | |
Mathieu Chartier | b062fdd | 2012-07-03 09:51:48 -0700 | [diff] [blame] | 358 | } // namespace art |
| 359 | |
| 360 | #endif // ART_SRC_SPACE_BITMAP_H_ |