diff options
Diffstat (limited to 'compiler/oat_writer.cc')
| -rw-r--r-- | compiler/oat_writer.cc | 42 | 
1 files changed, 5 insertions, 37 deletions
diff --git a/compiler/oat_writer.cc b/compiler/oat_writer.cc index eff2425bb7..dc66e9c108 100644 --- a/compiler/oat_writer.cc +++ b/compiler/oat_writer.cc @@ -345,36 +345,6 @@ size_t OatWriter::InitOatCodeClassDef(size_t offset,    return offset;  } -static void DCheckCodeAlignment(size_t offset, InstructionSet isa) { -  switch (isa) { -    case kArm: -      // Fall-through. -    case kThumb2: -      DCHECK_ALIGNED(offset, kArmAlignment); -      break; - -    case kArm64: -      DCHECK_ALIGNED(offset, kArm64Alignment); -      break; - -    case kMips: -      DCHECK_ALIGNED(offset, kMipsAlignment); -      break; - -    case kX86_64: -      // Fall-through. -    case kX86: -      DCHECK_ALIGNED(offset, kX86Alignment); -      break; - -    case kNone: -      // Use a DCHECK instead of FATAL so that in the non-debug case the whole switch can -      // be optimized away. -      DCHECK(false); -      break; -  } -} -  size_t OatWriter::InitOatCodeMethod(size_t offset, size_t oat_class_index,                                      size_t __attribute__((unused)) class_def_index,                                      size_t class_def_method_index, @@ -406,7 +376,8 @@ size_t OatWriter::InitOatCodeMethod(size_t offset, size_t oat_class_index,      } else {        CHECK(quick_code != nullptr);        offset = compiled_method->AlignCode(offset); -      DCheckCodeAlignment(offset, compiled_method->GetInstructionSet()); +      DCHECK_ALIGNED_PARAM(offset, +                           GetInstructionSetAlignment(compiled_method->GetInstructionSet()));        uint32_t code_size = quick_code->size() * sizeof(uint8_t);        CHECK_NE(code_size, 0U); @@ -539,11 +510,7 @@ size_t OatWriter::InitOatCodeMethod(size_t offset, size_t oat_class_index,            refs++;          }        } -      InstructionSet trg_isa = compiler_driver_->GetInstructionSet(); -      size_t pointer_size = 4; -      if (trg_isa == kArm64 || trg_isa == kX86_64) { -        pointer_size = 8; -      } +      size_t pointer_size = GetInstructionSetPointerSize(compiler_driver_->GetInstructionSet());        size_t sirt_size = StackIndirectReferenceTable::GetAlignedSirtSizeTarget(pointer_size, refs);        // Get the generic spill masks and base frame size. @@ -857,7 +824,8 @@ size_t OatWriter::WriteCodeMethod(OutputStream* out, const size_t file_offset,          relative_offset += aligned_code_delta;          DCHECK_OFFSET();        } -      DCheckCodeAlignment(relative_offset, compiled_method->GetInstructionSet()); +      DCHECK_ALIGNED_PARAM(relative_offset, +                           GetInstructionSetAlignment(compiled_method->GetInstructionSet()));        uint32_t code_size = quick_code->size() * sizeof(uint8_t);        CHECK_NE(code_size, 0U);  |