Delay emitting CFI PC adjustments until after Thumb2/Mips fixup.
On Mips also take into account out-of-order CFI data emitted
from EmitBranches().
Change-Id: I03b0b0b4c2b1ea31a02699ef5fa1c55aa42c23c3
diff --git a/compiler/dwarf/debug_frame_opcode_writer.h b/compiler/dwarf/debug_frame_opcode_writer.h
index 60241f7..5a99641 100644
--- a/compiler/dwarf/debug_frame_opcode_writer.h
+++ b/compiler/dwarf/debug_frame_opcode_writer.h
@@ -282,7 +282,12 @@
bool IsEnabled() const { return enabled_; }
- void SetEnabled(bool value) { enabled_ = value; }
+ void SetEnabled(bool value) {
+ enabled_ = value;
+ if (enabled_ && opcodes_.capacity() == 0u) {
+ opcodes_.reserve(kDefaultCapacity);
+ }
+ }
int GetCurrentPC() const { return current_pc_; }
@@ -292,24 +297,24 @@
using Writer<Vector>::data;
- DebugFrameOpCodeWriter(bool enabled = true,
- const typename Vector::allocator_type& alloc =
- typename Vector::allocator_type())
+ explicit DebugFrameOpCodeWriter(bool enabled = true,
+ const typename Vector::allocator_type& alloc =
+ typename Vector::allocator_type())
: Writer<Vector>(&opcodes_),
- enabled_(enabled),
+ enabled_(false),
opcodes_(alloc),
current_cfa_offset_(0),
current_pc_(0),
uses_dwarf3_features_(false) {
- if (enabled) {
- // Best guess based on couple of observed outputs.
- opcodes_.reserve(16);
- }
+ SetEnabled(enabled);
}
virtual ~DebugFrameOpCodeWriter() { }
protected:
+ // Best guess based on couple of observed outputs.
+ static constexpr size_t kDefaultCapacity = 32u;
+
int FactorDataOffset(int offset) const {
DCHECK_EQ(offset % kDataAlignmentFactor, 0);
return offset / kDataAlignmentFactor;