diff options
author | 2015-06-16 11:33:24 +0000 | |
---|---|---|
committer | 2015-06-17 09:43:51 +0100 | |
commit | cf93a5cd9c978f59113d42f9f642fab5e2cc8877 (patch) | |
tree | 55162627fcbf2cb7913a735c7ed89e8e4b5e84d7 /compiler/utils/assembler.h | |
parent | db40ea768bd914125c3754dacb9b6f534a2e2399 (diff) |
Revert "Revert "ART: Implement literal pool for arm, fix branch fixup.""
This reverts commit fbeb4aede0ddc5b1e6a5a3a40cc6266fe8518c98.
Adjust block label positions. Bad catch block labels were the
reason for the revert.
Change-Id: Ia6950d639d46b9da6b07f3ade63ab46d03d63310
Diffstat (limited to 'compiler/utils/assembler.h')
-rw-r--r-- | compiler/utils/assembler.h | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/compiler/utils/assembler.h b/compiler/utils/assembler.h index 672e1503be..0381af3956 100644 --- a/compiler/utils/assembler.h +++ b/compiler/utils/assembler.h @@ -199,13 +199,18 @@ class AssemblerBuffer { *reinterpret_cast<T*>(contents_ + position) = value; } - void Move(size_t newposition, size_t oldposition) { - CHECK(HasEnsuredCapacity()); - // Move the contents of the buffer from oldposition to - // newposition by nbytes. - size_t nbytes = Size() - oldposition; - memmove(contents_ + newposition, contents_ + oldposition, nbytes); - cursor_ += newposition - oldposition; + void Resize(size_t new_size) { + if (new_size > Capacity()) { + ExtendCapacity(new_size); + } + cursor_ = contents_ + new_size; + } + + void Move(size_t newposition, size_t oldposition, size_t size) { + // Move a chunk of the buffer from oldposition to newposition. + DCHECK_LE(oldposition + size, Size()); + DCHECK_LE(newposition + size, Size()); + memmove(contents_ + newposition, contents_ + oldposition, size); } // Emit a fixup at the current location. @@ -350,7 +355,7 @@ class AssemblerBuffer { return data + capacity - kMinimumGap; } - void ExtendCapacity(); + void ExtendCapacity(size_t min_capacity = 0u); friend class AssemblerFixup; }; @@ -376,8 +381,8 @@ class Assembler { public: static Assembler* Create(InstructionSet instruction_set); - // Emit slow paths queued during assembly - virtual void EmitSlowPaths() { buffer_.EmitSlowPaths(this); } + // Finalize the code; emit slow paths, fixup branches, add literal pool, etc. + virtual void FinalizeCode() { buffer_.EmitSlowPaths(this); } // Size of generated code virtual size_t CodeSize() const { return buffer_.Size(); } |