Clean up ScopedArenaAllocatorAdapter.

Make the adapter equality-comparable, define aliases for
containers using the adapter and use those aliases.
Fix DebugStackIndirectTopRefImpl assignment.

Change-Id: I689aa8a93d169f63a659dec5040567d7b1343277
diff --git a/compiler/dex/local_value_numbering.h b/compiler/dex/local_value_numbering.h
index 535b613..6d67afb 100644
--- a/compiler/dex/local_value_numbering.h
+++ b/compiler/dex/local_value_numbering.h
@@ -20,6 +20,7 @@
 #include "compiler_internals.h"
 #include "UniquePtr.h"
 #include "utils/scoped_arena_allocator.h"
+#include "utils/scoped_arena_containers.h"
 
 #define NO_VALUE 0xffff
 #define ARRAY_REF 0xfffe
@@ -75,20 +76,16 @@
   };
 
   // Key is s_reg, value is value name.
-  typedef SafeMap<uint16_t, uint16_t, std::less<uint16_t>,
-      ScopedArenaAllocatorAdapter<std::pair<uint16_t, uint16_t> > > SregValueMap;
+  typedef ScopedArenaSafeMap<uint16_t, uint16_t> SregValueMap;
   // Key is concatenation of opcode, operand1, operand2 and modifier, value is value name.
-  typedef SafeMap<uint64_t, uint16_t, std::less<uint64_t>,
-      ScopedArenaAllocatorAdapter<std::pair<uint64_t, uint16_t> > > ValueMap;
+  typedef ScopedArenaSafeMap<uint64_t, uint16_t> ValueMap;
   // Key represents a memory address, value is generation.
-  typedef SafeMap<MemoryVersionKey, uint16_t, MemoryVersionKeyComparator,
-      ScopedArenaAllocatorAdapter<std::pair<MemoryVersionKey, uint16_t> > > MemoryVersionMap;
+  typedef ScopedArenaSafeMap<MemoryVersionKey, uint16_t, MemoryVersionKeyComparator
+      > MemoryVersionMap;
   // Maps field key to field id for resolved fields.
-  typedef SafeMap<FieldReference, uint32_t, FieldReferenceComparator,
-      ScopedArenaAllocatorAdapter<std::pair<FieldReference, uint16_t> > > FieldIndexMap;
+  typedef ScopedArenaSafeMap<FieldReference, uint32_t, FieldReferenceComparator> FieldIndexMap;
   // A set of value names.
-  typedef std::set<uint16_t, std::less<uint16_t>,
-      ScopedArenaAllocatorAdapter<uint16_t> > ValueNameSet;
+  typedef ScopedArenaSet<uint16_t> ValueNameSet;
 
  public:
   static LocalValueNumbering* Create(CompilationUnit* cu) {
diff --git a/compiler/dex/mir_analysis.cc b/compiler/dex/mir_analysis.cc
index 200795e..c3b5a25 100644
--- a/compiler/dex/mir_analysis.cc
+++ b/compiler/dex/mir_analysis.cc
@@ -24,6 +24,7 @@
 #include "dex/quick/dex_file_to_method_inliner_map.h"
 #include "driver/compiler_options.h"
 #include "UniquePtr.h"
+#include "utils/scoped_arena_containers.h"
 
 namespace art {
 
@@ -1205,17 +1206,16 @@
     MethodReferenceComparator devirt_cmp;
   };
 
-  // Map invoke key (see MapEntry) to lowering info index.
-  typedef std::set<MapEntry, MapEntryComparator, ScopedArenaAllocatorAdapter<MapEntry> > InvokeMap;
-
   ScopedArenaAllocator allocator(&cu_->arena_stack);
 
   // All INVOKE instructions take 3 code units and there must also be a RETURN.
   uint32_t max_refs = (current_code_item_->insns_size_in_code_units_ - 1u) / 3u;
 
+  // Map invoke key (see MapEntry) to lowering info index and vice versa.
   // The invoke_map and sequential entries are essentially equivalent to Boost.MultiIndex's
   // multi_index_container with one ordered index and one sequential index.
-  InvokeMap invoke_map(MapEntryComparator(), allocator.Adapter());
+  ScopedArenaSet<MapEntry, MapEntryComparator> invoke_map(MapEntryComparator(),
+                                                          allocator.Adapter());
   const MapEntry** sequential_entries = reinterpret_cast<const MapEntry**>(
       allocator.Alloc(max_refs * sizeof(sequential_entries[0]), kArenaAllocMisc));
 
diff --git a/compiler/dex/mir_optimization.cc b/compiler/dex/mir_optimization.cc
index 413b4e0..8e8a593 100644
--- a/compiler/dex/mir_optimization.cc
+++ b/compiler/dex/mir_optimization.cc
@@ -19,6 +19,7 @@
 #include "dataflow_iterator-inl.h"
 #include "dex/quick/dex_file_method_inliner.h"
 #include "dex/quick/dex_file_to_method_inliner_map.h"
+#include "utils/scoped_arena_containers.h"
 
 namespace art {
 
@@ -964,11 +965,9 @@
       }
     };
 
-    typedef std::set<MapEntry, MapEntryComparator, ScopedArenaAllocatorAdapter<MapEntry> >
-        ClassToIndexMap;
-
     ScopedArenaAllocator allocator(&cu_->arena_stack);
-    ClassToIndexMap class_to_index_map(MapEntryComparator(), allocator.Adapter());
+    ScopedArenaSet<MapEntry, MapEntryComparator> class_to_index_map(MapEntryComparator(),
+                                                                    allocator.Adapter());
 
     // First, find all SGET/SPUTs that may need class initialization checks, record INVOKE_STATICs.
     AllNodesIterator iter(this);