Add DCHECKs to ArenaVector and ScopedArenaVector.
Implement dchecked_vector<> template that DCHECK()s element
access and insert()/emplace()/erase() positions. Change the
ArenaVector<> and ScopedArenaVector<> aliases to use the new
template instead of std::vector<>. Remove DCHECK()s that
have now become unnecessary from the Optimizing compiler.
Change-Id: Ib8506bd30d223f68f52bd4476c76d9991acacadc
diff --git a/compiler/dex/quick/codegen_util.cc b/compiler/dex/quick/codegen_util.cc
index d5ac341..bd55fa6 100644
--- a/compiler/dex/quick/codegen_util.cc
+++ b/compiler/dex/quick/codegen_util.cc
@@ -16,6 +16,8 @@
#include "mir_to_lir-inl.h"
+#include <endian.h>
+
#include "base/bit_vector-inl.h"
#include "dex/mir_graph.h"
#include "driver/compiler_driver.h"
@@ -841,7 +843,7 @@
references_buffer[i] = static_cast<uint8_t>(
raw_storage[i / sizeof(raw_storage[0])] >> (8u * (i % sizeof(raw_storage[0]))));
}
- native_gc_map_builder.AddEntry(native_offset, &references_buffer[0]);
+ native_gc_map_builder.AddEntry(native_offset, references_buffer.data());
prev_mir = mir;
}
}
diff --git a/compiler/dex/quick/lazy_debug_frame_opcode_writer.h b/compiler/dex/quick/lazy_debug_frame_opcode_writer.h
index 3e9fb96..c425fc8 100644
--- a/compiler/dex/quick/lazy_debug_frame_opcode_writer.h
+++ b/compiler/dex/quick/lazy_debug_frame_opcode_writer.h
@@ -28,8 +28,8 @@
// When we are generating the CFI code, we do not know the instuction offsets,
// this class stores the LIR references and patches the instruction stream later.
class LazyDebugFrameOpCodeWriter FINAL
- : public DebugFrameOpCodeWriter<ArenaAllocatorAdapter<uint8_t>> {
- typedef DebugFrameOpCodeWriter<ArenaAllocatorAdapter<uint8_t>> Base;
+ : public DebugFrameOpCodeWriter<ArenaVector<uint8_t>> {
+ typedef DebugFrameOpCodeWriter<ArenaVector<uint8_t>> Base;
public:
// This method is implicitely called the by opcode writers.
virtual void ImplicitlyAdvancePC() OVERRIDE {