OSDN Git Service

ARM64: Update code after the VIXL 1.6 release.
authorAlexandre Rames <alexandre.rames@arm.com>
Wed, 8 Oct 2014 17:41:21 +0000 (18:41 +0100)
committerIan Rogers <irogers@google.com>
Thu, 9 Oct 2014 16:21:33 +0000 (09:21 -0700)
We now leave the assembler buffer management to VIXL.

Change-Id: Ieefe83cf5cf5e1ab8c924b0e7dc03af6a55053ae

compiler/jni/quick/jni_compiler.cc
compiler/utils/arm64/assembler_arm64.cc
compiler/utils/arm64/assembler_arm64.h
compiler/utils/arm64/constants_arm64.h

index 78a228b..f6795ea 100644 (file)
@@ -428,10 +428,6 @@ CompiledMethod* ArtJniCompileMethodInternal(CompilerDriver* driver,
   // 17. Finalize code generation
   __ EmitSlowPaths();
   size_t cs = __ CodeSize();
-  if (instruction_set == kArm64) {
-    // Test that we do not exceed the buffer size.
-    CHECK(cs < arm64::kBufferSizeArm64);
-  }
   std::vector<uint8_t> managed_code(cs);
   MemoryRegion code(&managed_code[0], managed_code.size());
   __ FinalizeInstructions(code);
index c82b4f0..25e02c3 100644 (file)
@@ -42,12 +42,12 @@ void Arm64Assembler::EmitSlowPaths() {
 }
 
 size_t Arm64Assembler::CodeSize() const {
-  return ___ SizeOfCodeGenerated();
+  return vixl_masm_->BufferCapacity() - vixl_masm_->RemainingBufferSpace();
 }
 
 void Arm64Assembler::FinalizeInstructions(const MemoryRegion& region) {
   // Copy the instructions from the buffer.
-  MemoryRegion from(reinterpret_cast<void*>(vixl_buf_), CodeSize());
+  MemoryRegion from(vixl_masm_->GetStartAddress<void*>(), CodeSize());
   region.CopyFrom(0, from);
 }
 
index bf89d24..373fd34 100644 (file)
@@ -59,12 +59,12 @@ class Arm64Exception;
 
 class Arm64Assembler FINAL : public Assembler {
  public:
-  Arm64Assembler() : vixl_buf_(new byte[kBufferSizeArm64]),
-  vixl_masm_(new vixl::MacroAssembler(vixl_buf_, kBufferSizeArm64)) {}
+  // We indicate the size of the initial code generation buffer to the VIXL
+  // assembler. From there we it will automatically manage the buffer.
+  Arm64Assembler() : vixl_masm_(new vixl::MacroAssembler(kArm64BaseBufferSize)) {}
 
   virtual ~Arm64Assembler() {
     delete vixl_masm_;
-    delete[] vixl_buf_;
   }
 
   // Emit slow paths queued during assembly.
@@ -213,9 +213,6 @@ class Arm64Assembler FINAL : public Assembler {
   void AddConstant(Register rd, int32_t value, vixl::Condition cond = vixl::al);
   void AddConstant(Register rd, Register rn, int32_t value, vixl::Condition cond = vixl::al);
 
-  // Vixl buffer.
-  byte* vixl_buf_;
-
   // Vixl assembler.
   vixl::MacroAssembler* vixl_masm_;
 
index 0cbbb1e..ffb54d3 100644 (file)
@@ -31,8 +31,7 @@ namespace arm64 {
 
 constexpr unsigned int kJniRefSpillRegsSize = 11;
 
-// Vixl buffer size.
-constexpr size_t kBufferSizeArm64 = 4096*2;
+constexpr size_t kArm64BaseBufferSize = 4096;
 
 }  // namespace arm64
 }  // namespace art