blob: 4b2193a3f1c2ab72ba7cb4d84f127ce8f6fa8d4c [file] [log] [blame]
buzbee862a7602013-04-05 10:58:54 -07001/*
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
Brian Carlstromfc0e3212013-07-17 14:40:12 -070017#ifndef ART_COMPILER_DEX_ARENA_BIT_VECTOR_H_
18#define ART_COMPILER_DEX_ARENA_BIT_VECTOR_H_
buzbee862a7602013-04-05 10:58:54 -070019
buzbee862a7602013-04-05 10:58:54 -070020#include "arena_allocator.h"
Brian Carlstromba150c32013-08-27 17:31:03 -070021#include "base/bit_vector.h"
Brian Carlstrom413e89f2013-10-21 23:53:49 -070022#include "compiler_enums.h"
buzbee862a7602013-04-05 10:58:54 -070023
24namespace art {
25
buzbee862a7602013-04-05 10:58:54 -070026/*
Brian Carlstrom413e89f2013-10-21 23:53:49 -070027 * A BitVector implementation that uses Arena allocation.
buzbee862a7602013-04-05 10:58:54 -070028 */
Brian Carlstrom413e89f2013-10-21 23:53:49 -070029class ArenaBitVector : public BitVector {
buzbee862a7602013-04-05 10:58:54 -070030 public:
buzbee0d829482013-10-11 15:24:55 -070031 ArenaBitVector(ArenaAllocator* arena, uint32_t start_bits, bool expandable,
buzbee862a7602013-04-05 10:58:54 -070032 OatBitMapKind kind = kBitMapMisc);
Brian Carlstrom9b7085a2013-07-18 15:15:21 -070033 ~ArenaBitVector() {}
buzbee862a7602013-04-05 10:58:54 -070034
Brian Carlstrom413e89f2013-10-21 23:53:49 -070035 static void* operator new(size_t size, ArenaAllocator* arena) {
36 return arena->Alloc(sizeof(ArenaBitVector), ArenaAllocator::kAllocGrowableBitMap);
37 }
38 static void operator delete(void* p) {} // Nop.
buzbee862a7602013-04-05 10:58:54 -070039
40 private:
Brian Carlstrom413e89f2013-10-21 23:53:49 -070041 const OatBitMapKind kind_; // for memory use tuning. TODO: currently unused.
buzbee862a7602013-04-05 10:58:54 -070042};
43
44
45} // namespace art
46
Brian Carlstromfc0e3212013-07-17 14:40:12 -070047#endif // ART_COMPILER_DEX_ARENA_BIT_VECTOR_H_