Nicolas Geoffray | 0e33643 | 2014-02-26 18:24:38 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2013 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_COMPILER_UTILS_ARENA_BIT_VECTOR_H_ |
| 18 | #define ART_COMPILER_UTILS_ARENA_BIT_VECTOR_H_ |
| 19 | |
Ian Rogers | 6a3c1fc | 2014-10-31 00:33:20 -0700 | [diff] [blame] | 20 | #include "arena_object.h" |
Nicolas Geoffray | 0e33643 | 2014-02-26 18:24:38 +0000 | [diff] [blame] | 21 | #include "base/bit_vector.h" |
Nicolas Geoffray | 0e33643 | 2014-02-26 18:24:38 +0000 | [diff] [blame] | 22 | |
| 23 | namespace art { |
| 24 | |
Ian Rogers | 6a3c1fc | 2014-10-31 00:33:20 -0700 | [diff] [blame] | 25 | class ArenaAllocator; |
| 26 | class ScopedArenaAllocator; |
| 27 | |
Nicolas Geoffray | 0e33643 | 2014-02-26 18:24:38 +0000 | [diff] [blame] | 28 | // Type of growable bitmap for memory tuning. |
| 29 | enum OatBitMapKind { |
| 30 | kBitMapMisc = 0, |
| 31 | kBitMapUse, |
| 32 | kBitMapDef, |
| 33 | kBitMapLiveIn, |
| 34 | kBitMapBMatrix, |
| 35 | kBitMapDominators, |
| 36 | kBitMapIDominated, |
| 37 | kBitMapDomFrontier, |
| 38 | kBitMapPhi, |
| 39 | kBitMapTmpBlocks, |
| 40 | kBitMapInputBlocks, |
| 41 | kBitMapRegisterV, |
| 42 | kBitMapTempSSARegisterV, |
| 43 | kBitMapNullCheck, |
Vladimir Marko | bfea9c2 | 2014-01-17 17:49:33 +0000 | [diff] [blame] | 44 | kBitMapClInitCheck, |
Nicolas Geoffray | 0e33643 | 2014-02-26 18:24:38 +0000 | [diff] [blame] | 45 | kBitMapTmpBlockV, |
| 46 | kBitMapPredecessors, |
| 47 | kNumBitMapKinds |
| 48 | }; |
| 49 | |
| 50 | std::ostream& operator<<(std::ostream& os, const OatBitMapKind& kind); |
| 51 | |
| 52 | /* |
| 53 | * A BitVector implementation that uses Arena allocation. |
| 54 | */ |
Ian Rogers | 6a3c1fc | 2014-10-31 00:33:20 -0700 | [diff] [blame] | 55 | class ArenaBitVector : public BitVector, public ArenaObject<kArenaAllocGrowableBitMap> { |
Ian Rogers | e77493c | 2014-08-20 15:08:45 -0700 | [diff] [blame] | 56 | public: |
| 57 | ArenaBitVector(ArenaAllocator* arena, uint32_t start_bits, bool expandable, |
| 58 | OatBitMapKind kind = kBitMapMisc); |
| 59 | ArenaBitVector(ScopedArenaAllocator* arena, uint32_t start_bits, bool expandable, |
| 60 | OatBitMapKind kind = kBitMapMisc); |
| 61 | ~ArenaBitVector() {} |
Nicolas Geoffray | 0e33643 | 2014-02-26 18:24:38 +0000 | [diff] [blame] | 62 | |
Ian Rogers | e77493c | 2014-08-20 15:08:45 -0700 | [diff] [blame] | 63 | private: |
| 64 | const OatBitMapKind kind_; // for memory use tuning. TODO: currently unused. |
Ian Rogers | 6a3c1fc | 2014-10-31 00:33:20 -0700 | [diff] [blame] | 65 | |
| 66 | DISALLOW_COPY_AND_ASSIGN(ArenaBitVector); |
Nicolas Geoffray | 0e33643 | 2014-02-26 18:24:38 +0000 | [diff] [blame] | 67 | }; |
| 68 | |
| 69 | |
| 70 | } // namespace art |
| 71 | |
| 72 | #endif // ART_COMPILER_UTILS_ARENA_BIT_VECTOR_H_ |