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
diff --git a/compiler/optimizing/parallel_move_resolver.h b/compiler/optimizing/parallel_move_resolver.h
index 9ede910..4278861 100644
--- a/compiler/optimizing/parallel_move_resolver.h
+++ b/compiler/optimizing/parallel_move_resolver.h
@@ -17,8 +17,8 @@
#ifndef ART_COMPILER_OPTIMIZING_PARALLEL_MOVE_RESOLVER_H_
#define ART_COMPILER_OPTIMIZING_PARALLEL_MOVE_RESOLVER_H_
+#include "base/arena_containers.h"
#include "base/value_object.h"
-#include "utils/growable_array.h"
#include "locations.h"
#include "primitive.h"
@@ -31,7 +31,10 @@
// have their own subclass that implements corresponding virtual functions.
class ParallelMoveResolver : public ValueObject {
public:
- explicit ParallelMoveResolver(ArenaAllocator* allocator) : moves_(allocator, 32) {}
+ explicit ParallelMoveResolver(ArenaAllocator* allocator)
+ : moves_(allocator->Adapter(kArenaAllocParallelMoveResolver)) {
+ moves_.reserve(32);
+ }
virtual ~ParallelMoveResolver() {}
// Resolve a set of parallel moves, emitting assembler instructions.
@@ -41,7 +44,7 @@
// Build the initial list of moves.
void BuildInitialMoveList(HParallelMove* parallel_move);
- GrowableArray<MoveOperands*> moves_;
+ ArenaVector<MoveOperands*> moves_;
private:
DISALLOW_COPY_AND_ASSIGN(ParallelMoveResolver);
@@ -120,8 +123,13 @@
class ParallelMoveResolverNoSwap : public ParallelMoveResolver {
public:
explicit ParallelMoveResolverNoSwap(ArenaAllocator* allocator)
- : ParallelMoveResolver(allocator), scratches_(allocator, 32),
- pending_moves_(allocator, 8), allocator_(allocator) {}
+ : ParallelMoveResolver(allocator),
+ scratches_(allocator->Adapter(kArenaAllocParallelMoveResolver)),
+ pending_moves_(allocator->Adapter(kArenaAllocParallelMoveResolver)),
+ allocator_(allocator) {
+ scratches_.reserve(32);
+ pending_moves_.reserve(8);
+ }
virtual ~ParallelMoveResolverNoSwap() {}
// Resolve a set of parallel moves, emitting assembler instructions.
@@ -160,7 +168,7 @@
void RemoveScratchLocation(Location loc);
// List of scratch locations.
- GrowableArray<Location> scratches_;
+ ArenaVector<Location> scratches_;
private:
// Perform the move at the given index in `moves_` (possibly requiring other moves to satisfy
@@ -183,7 +191,7 @@
size_t GetNumberOfPendingMoves();
// Additional pending moves which might be added to resolve dependency cycle.
- GrowableArray<MoveOperands*> pending_moves_;
+ ArenaVector<MoveOperands*> pending_moves_;
// Used to allocate pending MoveOperands.
ArenaAllocator* const allocator_;