summaryrefslogtreecommitdiff
path: root/compiler/optimizing/stack_map_stream.h
diff options
context:
space:
mode:
authorVladimir Marko <vmarko@google.com>2015-09-28 12:17:40 +0100
committerVladimir Marko <vmarko@google.com>2015-09-29 10:49:35 +0100
commit225b6464a58ebe11c156144653f11a1c6607f4eb (patch)
tree3f1c6067c3841c892edaa1a60a61af9c559cb4e4 /compiler/optimizing/stack_map_stream.h
parent6a9984e62c08bcd78c8e49dd40b1f0f9d53513b7 (diff)
Optimizing: Tag arena allocations in code generators.
And completely remove the deprecated GrowableArray. Replace GrowableArray with ArenaVector in code generators and related classes and tag arena allocations. Label arrays use direct allocations from ArenaAllocator because Label is non-copyable and non-movable and as such cannot be really held in a container. The GrowableArray never actually constructed them, instead relying on the zero-initialized storage from the arena allocator to be correct. We now actually construct the labels. Also avoid StackMapStream::ComputeDexRegisterMapSize() being passed null references, even though unused. Change-Id: I26a46fdd406b23a3969300a67739d55528df8bf4
Diffstat (limited to 'compiler/optimizing/stack_map_stream.h')
-rw-r--r--compiler/optimizing/stack_map_stream.h41
1 files changed, 23 insertions, 18 deletions
diff --git a/compiler/optimizing/stack_map_stream.h b/compiler/optimizing/stack_map_stream.h
index 703b6f7e13..4783e283b3 100644
--- a/compiler/optimizing/stack_map_stream.h
+++ b/compiler/optimizing/stack_map_stream.h
@@ -24,7 +24,6 @@
#include "memory_region.h"
#include "nodes.h"
#include "stack_map.h"
-#include "utils/growable_array.h"
namespace art {
@@ -62,15 +61,16 @@ class StackMapStream : public ValueObject {
public:
explicit StackMapStream(ArenaAllocator* allocator)
: allocator_(allocator),
- stack_maps_(allocator, 10),
- location_catalog_entries_(allocator, 4),
- dex_register_locations_(allocator, 10 * 4),
- inline_infos_(allocator, 2),
+ stack_maps_(allocator->Adapter(kArenaAllocStackMapStream)),
+ location_catalog_entries_(allocator->Adapter(kArenaAllocStackMapStream)),
+ dex_register_locations_(allocator->Adapter(kArenaAllocStackMapStream)),
+ inline_infos_(allocator->Adapter(kArenaAllocStackMapStream)),
stack_mask_max_(-1),
dex_pc_max_(0),
register_mask_max_(0),
number_of_stack_maps_with_inline_info_(0),
- dex_map_hash_to_stack_map_indices_(std::less<uint32_t>(), allocator->Adapter()),
+ dex_map_hash_to_stack_map_indices_(std::less<uint32_t>(),
+ allocator->Adapter(kArenaAllocStackMapStream)),
current_entry_(),
current_inline_info_(),
stack_mask_size_(0),
@@ -84,7 +84,12 @@ class StackMapStream : public ValueObject {
inline_infos_start_(0),
needed_size_(0),
current_dex_register_(0),
- in_inline_frame_(false) {}
+ in_inline_frame_(false) {
+ stack_maps_.reserve(10);
+ location_catalog_entries_.reserve(4);
+ dex_register_locations_.reserve(10 * 4);
+ inline_infos_.reserve(2);
+ }
// See runtime/stack_map.h to know what these fields contain.
struct StackMapEntry {
@@ -127,17 +132,17 @@ class StackMapStream : public ValueObject {
void EndInlineInfoEntry();
size_t GetNumberOfStackMaps() const {
- return stack_maps_.Size();
+ return stack_maps_.size();
}
const StackMapEntry& GetStackMap(size_t i) const {
- DCHECK_LT(i, stack_maps_.Size());
- return stack_maps_.GetRawStorage()[i];
+ DCHECK_LT(i, stack_maps_.size());
+ return stack_maps_[i];
}
void SetStackMapNativePcOffset(size_t i, uint32_t native_pc_offset) {
- DCHECK_LT(i, stack_maps_.Size());
- stack_maps_.GetRawStorage()[i].native_pc_offset = native_pc_offset;
+ DCHECK_LT(i, stack_maps_.size());
+ stack_maps_[i].native_pc_offset = native_pc_offset;
}
uint32_t ComputeMaxNativePcOffset() const;
@@ -150,7 +155,7 @@ class StackMapStream : public ValueObject {
private:
size_t ComputeDexRegisterLocationCatalogSize() const;
size_t ComputeDexRegisterMapSize(uint32_t num_dex_registers,
- const BitVector& live_dex_registers_mask) const;
+ const BitVector* live_dex_registers_mask) const;
size_t ComputeDexRegisterMapsSize() const;
size_t ComputeInlineInfoSize() const;
@@ -164,10 +169,10 @@ class StackMapStream : public ValueObject {
uint32_t start_index_in_dex_register_locations) const;
ArenaAllocator* allocator_;
- GrowableArray<StackMapEntry> stack_maps_;
+ ArenaVector<StackMapEntry> stack_maps_;
// A catalog of unique [location_kind, register_value] pairs (per method).
- GrowableArray<DexRegisterLocation> location_catalog_entries_;
+ ArenaVector<DexRegisterLocation> location_catalog_entries_;
// Map from Dex register location catalog entries to their indices in the
// location catalog.
typedef HashMap<DexRegisterLocation, size_t, LocationCatalogEntriesIndicesEmptyFn,
@@ -175,14 +180,14 @@ class StackMapStream : public ValueObject {
LocationCatalogEntriesIndices location_catalog_entries_indices_;
// A set of concatenated maps of Dex register locations indices to `location_catalog_entries_`.
- GrowableArray<size_t> dex_register_locations_;
- GrowableArray<InlineInfoEntry> inline_infos_;
+ ArenaVector<size_t> dex_register_locations_;
+ ArenaVector<InlineInfoEntry> inline_infos_;
int stack_mask_max_;
uint32_t dex_pc_max_;
uint32_t register_mask_max_;
size_t number_of_stack_maps_with_inline_info_;
- ArenaSafeMap<uint32_t, GrowableArray<uint32_t>> dex_map_hash_to_stack_map_indices_;
+ ArenaSafeMap<uint32_t, ArenaVector<uint32_t>> dex_map_hash_to_stack_map_indices_;
StackMapEntry current_entry_;
InlineInfoEntry current_inline_info_;