blob: f2a74527da2f3831860dbdf04a7001b74723a0c6 [file] [log] [blame]
Nicolas Geoffray0e336432014-02-26 18:24:38 +00001/*
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
Mathieu Chartierb666f482015-02-18 14:33:14 -080020#include "base/arena_object.h"
Nicolas Geoffray0e336432014-02-26 18:24:38 +000021#include "base/bit_vector.h"
Nicolas Geoffray0e336432014-02-26 18:24:38 +000022
23namespace art {
24
Ian Rogers6a3c1fc2014-10-31 00:33:20 -070025class ArenaAllocator;
26class ScopedArenaAllocator;
27
Nicolas Geoffray0e336432014-02-26 18:24:38 +000028// Type of growable bitmap for memory tuning.
29enum OatBitMapKind {
30 kBitMapMisc = 0,
31 kBitMapUse,
32 kBitMapDef,
33 kBitMapLiveIn,
34 kBitMapBMatrix,
35 kBitMapDominators,
36 kBitMapIDominated,
37 kBitMapDomFrontier,
Nicolas Geoffray0e336432014-02-26 18:24:38 +000038 kBitMapRegisterV,
39 kBitMapTempSSARegisterV,
40 kBitMapNullCheck,
Vladimir Markobfea9c22014-01-17 17:49:33 +000041 kBitMapClInitCheck,
Nicolas Geoffray0e336432014-02-26 18:24:38 +000042 kBitMapPredecessors,
43 kNumBitMapKinds
44};
45
46std::ostream& operator<<(std::ostream& os, const OatBitMapKind& kind);
47
48/*
49 * A BitVector implementation that uses Arena allocation.
50 */
Ian Rogers6a3c1fc2014-10-31 00:33:20 -070051class ArenaBitVector : public BitVector, public ArenaObject<kArenaAllocGrowableBitMap> {
Ian Rogerse77493c2014-08-20 15:08:45 -070052 public:
53 ArenaBitVector(ArenaAllocator* arena, uint32_t start_bits, bool expandable,
54 OatBitMapKind kind = kBitMapMisc);
55 ArenaBitVector(ScopedArenaAllocator* arena, uint32_t start_bits, bool expandable,
56 OatBitMapKind kind = kBitMapMisc);
57 ~ArenaBitVector() {}
Nicolas Geoffray0e336432014-02-26 18:24:38 +000058
Ian Rogerse77493c2014-08-20 15:08:45 -070059 private:
60 const OatBitMapKind kind_; // for memory use tuning. TODO: currently unused.
Ian Rogers6a3c1fc2014-10-31 00:33:20 -070061
62 DISALLOW_COPY_AND_ASSIGN(ArenaBitVector);
Nicolas Geoffray0e336432014-02-26 18:24:38 +000063};
64
65
66} // namespace art
67
68#endif // ART_COMPILER_UTILS_ARENA_BIT_VECTOR_H_