diff options
Diffstat (limited to 'compiler/dex')
| -rw-r--r-- | compiler/dex/quick/arm/assemble_arm.cc | 6 | ||||
| -rw-r--r-- | compiler/dex/quick/codegen_util.cc | 7 | ||||
| -rw-r--r-- | compiler/dex/quick/mips/assemble_mips.cc | 2 | ||||
| -rw-r--r-- | compiler/dex/quick/x86/assemble_x86.cc | 2 |
4 files changed, 8 insertions, 9 deletions
diff --git a/compiler/dex/quick/arm/assemble_arm.cc b/compiler/dex/quick/arm/assemble_arm.cc index cac766d587..a895e6ec34 100644 --- a/compiler/dex/quick/arm/assemble_arm.cc +++ b/compiler/dex/quick/arm/assemble_arm.cc @@ -1213,7 +1213,7 @@ void ArmMir2Lir::AssembleLIR() { cu_->NewTimingSplit("Assemble"); int assembler_retries = 0; CodeOffset starting_offset = LinkFixupInsns(first_lir_insn_, last_lir_insn_, 0); - data_offset_ = (starting_offset + 0x3) & ~0x3; + data_offset_ = RoundUp(starting_offset, 4); int32_t offset_adjustment; AssignDataOffsets(); @@ -1596,7 +1596,7 @@ void ArmMir2Lir::AssembleLIR() { LOG(FATAL) << "Assembler error - too many retries"; } starting_offset += offset_adjustment; - data_offset_ = (starting_offset + 0x3) & ~0x3; + data_offset_ = RoundUp(starting_offset, 4); AssignDataOffsets(); } } @@ -1609,7 +1609,7 @@ void ArmMir2Lir::AssembleLIR() { write_pos = EncodeLIRs(write_pos, first_lir_insn_); DCHECK_EQ(static_cast<CodeOffset>(write_pos - &code_buffer_[0]), starting_offset); - DCHECK_EQ(data_offset_, (code_buffer_.size() + 0x3) & ~0x3); + DCHECK_EQ(data_offset_, RoundUp(code_buffer_.size(), 4)); // Install literals InstallLiteralPools(); diff --git a/compiler/dex/quick/codegen_util.cc b/compiler/dex/quick/codegen_util.cc index 9f84e098d9..de13a2ee69 100644 --- a/compiler/dex/quick/codegen_util.cc +++ b/compiler/dex/quick/codegen_util.cc @@ -558,7 +558,7 @@ static int AssignLiteralOffsetCommon(LIR* lir, CodeOffset offset) { static int AssignLiteralPointerOffsetCommon(LIR* lir, CodeOffset offset, unsigned int element_size) { // Align to natural pointer size. - offset = (offset + (element_size - 1)) & ~(element_size - 1); + offset = RoundUp(offset, element_size); for (; lir != NULL; lir = lir->next) { lir->offset = offset; offset += element_size; @@ -758,7 +758,7 @@ int Mir2Lir::AssignFillArrayDataOffset(CodeOffset offset) { tab_rec->offset = offset; offset += tab_rec->size; // word align - offset = (offset + 3) & ~3; + offset = RoundUp(offset, 4); } return offset; } @@ -1049,14 +1049,13 @@ size_t Mir2Lir::GetNumBytesForCompilerTempSpillRegion() { int Mir2Lir::ComputeFrameSize() { /* Figure out the frame size */ - static const uint32_t kAlignMask = kStackAlignment - 1; uint32_t size = num_core_spills_ * GetBytesPerGprSpillLocation(cu_->instruction_set) + num_fp_spills_ * GetBytesPerFprSpillLocation(cu_->instruction_set) + sizeof(uint32_t) // Filler. + (cu_->num_regs + cu_->num_outs) * sizeof(uint32_t) + GetNumBytesForCompilerTempSpillRegion(); /* Align and set */ - return (size + kAlignMask) & ~(kAlignMask); + return RoundUp(size, kStackAlignment); } /* diff --git a/compiler/dex/quick/mips/assemble_mips.cc b/compiler/dex/quick/mips/assemble_mips.cc index baae31915e..b26ab579c3 100644 --- a/compiler/dex/quick/mips/assemble_mips.cc +++ b/compiler/dex/quick/mips/assemble_mips.cc @@ -748,7 +748,7 @@ void MipsMir2Lir::AssignOffsets() { int offset = AssignInsnOffsets(); /* Const values have to be word aligned */ - offset = (offset + 3) & ~3; + offset = RoundUp(offset, 4); /* Set up offsets for literals */ data_offset_ = offset; diff --git a/compiler/dex/quick/x86/assemble_x86.cc b/compiler/dex/quick/x86/assemble_x86.cc index 0fc5c6e943..7436e3960a 100644 --- a/compiler/dex/quick/x86/assemble_x86.cc +++ b/compiler/dex/quick/x86/assemble_x86.cc @@ -1483,7 +1483,7 @@ void X86Mir2Lir::AssignOffsets() { int offset = AssignInsnOffsets(); /* Const values have to be word aligned */ - offset = (offset + 3) & ~3; + offset = RoundUp(offset, 4); /* Set up offsets for literals */ data_offset_ = offset; |