diff options
author | 2023-06-16 12:18:27 +0100 | |
---|---|---|
committer | 2023-06-21 07:59:13 +0000 | |
commit | 70bba9c9f5fbba03c62a4542411e1d938375f14e (patch) | |
tree | 0b4ef702e671db908321639d39912636603166bc /compiler/utils/assembler.h | |
parent | 5bf0f68407d3467a3fbfa9ab9ae0c8fabead615b (diff) |
Remove CodeAllocator and the extra copy of generated code.
The code used to copy the final generated code twice: from assembler to
CodeAllocator, and then to CodeAllocator to SwapAllocator/JitMemory.
The assemblers never depended on the exact location of the generated
code, so just drop that feature.
Test: test.py
Change-Id: I8dc82e4926097092b9aac336a5a5d40f79dc62ca
Diffstat (limited to 'compiler/utils/assembler.h')
-rw-r--r-- | compiler/utils/assembler.h | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/compiler/utils/assembler.h b/compiler/utils/assembler.h index 63747bee58..f3fa711dbb 100644 --- a/compiler/utils/assembler.h +++ b/compiler/utils/assembler.h @@ -163,9 +163,8 @@ class AssemblerBuffer { uint8_t* contents() const { return contents_; } - // Copy the assembled instructions into the specified memory block - // and apply all fixups. - void FinalizeInstructions(const MemoryRegion& region); + // Copy the assembled instructions into the specified memory block. + void CopyInstructions(const MemoryRegion& region); // To emit an instruction to the assembler buffer, the EnsureCapacity helper // must be used to guarantee that the underlying data area is big enough to @@ -246,6 +245,8 @@ class AssemblerBuffer { // The provided `min_capacity` must be higher than current `Capacity()`. void ExtendCapacity(size_t min_capacity); + void ProcessFixups(); + private: // The limit is set to kMinimumGap bytes before the end of the data area. // This leaves enough space for the longest possible instruction and allows @@ -357,7 +358,10 @@ class DebugFrameOpCodeWriterForAssembler final class Assembler : public DeletableArenaObject<kArenaAllocAssembler> { public: // Finalize the code; emit slow paths, fixup branches, add literal pool, etc. - virtual void FinalizeCode() { buffer_.EmitSlowPaths(this); } + virtual void FinalizeCode() { + buffer_.EmitSlowPaths(this); + buffer_.ProcessFixups(); + } // Size of generated code virtual size_t CodeSize() const { return buffer_.Size(); } @@ -375,8 +379,8 @@ class Assembler : public DeletableArenaObject<kArenaAllocAssembler> { virtual size_t CodePosition() { return CodeSize(); } // Copy instructions out of assembly buffer into the given region of memory - virtual void FinalizeInstructions(const MemoryRegion& region) { - buffer_.FinalizeInstructions(region); + virtual void CopyInstructions(const MemoryRegion& region) { + buffer_.CopyInstructions(region); } // TODO: Implement with disassembler. |