summaryrefslogtreecommitdiffstats
path: root/compiler/dex/quick/mips/call_mips.cc
diff options
context:
space:
mode:
authorMathieu Chartier <mathieuc@google.com>2013-08-24 16:11:37 -0700
committerMathieu Chartier <mathieuc@google.com>2013-08-26 16:23:51 -0700
commitf6c4b3ba3825de1dbb3e747a68b809c6cc8eb4db (patch)
treec9dc76dfbd6067ae4de6650be9eb948535c77bb5 /compiler/dex/quick/mips/call_mips.cc
parentfb2451b516f8411756fe7b6f91b5534cf3ce8682 (diff)
downloadandroid_art-f6c4b3ba3825de1dbb3e747a68b809c6cc8eb4db.tar.gz
android_art-f6c4b3ba3825de1dbb3e747a68b809c6cc8eb4db.tar.bz2
android_art-f6c4b3ba3825de1dbb3e747a68b809c6cc8eb4db.zip
New arena memory allocator.
Before we were creating arenas for each method. The issue with doing this is that we needed to memset each memory allocation. This can be improved if you start out with arenas that contain all zeroed memory and recycle them for each method. When you give memory back to the arena pool you do a single memset to zero out all of the memory that you used. Always inlined the fast path of the allocation code. Removed the "zero" parameter since the new arena allocator always returns zeroed memory. Host dex2oat time on target oat apks (2 samples each). Before: real 1m11.958s user 4m34.020s sys 1m28.570s After: real 1m9.690s user 4m17.670s sys 1m23.960s Target device dex2oat samples (Mako, Thinkfree.apk): Without new arena allocator: 0m26.47s real 0m54.60s user 0m25.85s system 0m25.91s real 0m54.39s user 0m26.69s system 0m26.61s real 0m53.77s user 0m27.35s system 0m26.33s real 0m54.90s user 0m25.30s system 0m26.34s real 0m53.94s user 0m27.23s system With new arena allocator: 0m25.02s real 0m54.46s user 0m19.94s system 0m25.17s real 0m55.06s user 0m20.72s system 0m24.85s real 0m55.14s user 0m19.30s system 0m24.59s real 0m54.02s user 0m20.07s system 0m25.06s real 0m55.00s user 0m20.42s system Correctness of Thinkfree.apk.oat verified by diffing both of the oat files. Change-Id: I5ff7b85ffe86c57d3434294ca7a621a695bf57a9
Diffstat (limited to 'compiler/dex/quick/mips/call_mips.cc')
-rw-r--r--compiler/dex/quick/mips/call_mips.cc14
1 files changed, 6 insertions, 8 deletions
diff --git a/compiler/dex/quick/mips/call_mips.cc b/compiler/dex/quick/mips/call_mips.cc
index eaae0e1964..d53c012466 100644
--- a/compiler/dex/quick/mips/call_mips.cc
+++ b/compiler/dex/quick/mips/call_mips.cc
@@ -67,13 +67,12 @@ void MipsMir2Lir::GenSparseSwitch(MIR* mir, uint32_t table_offset,
}
// Add the table to the list - we'll process it later
SwitchTable *tab_rec =
- static_cast<SwitchTable*>(arena_->NewMem(sizeof(SwitchTable), true,
- ArenaAllocator::kAllocData));
+ static_cast<SwitchTable*>(arena_->Alloc(sizeof(SwitchTable), ArenaAllocator::kAllocData));
tab_rec->table = table;
tab_rec->vaddr = current_dalvik_offset_;
int elements = table[1];
tab_rec->targets =
- static_cast<LIR**>(arena_->NewMem(elements * sizeof(LIR*), true, ArenaAllocator::kAllocLIR));
+ static_cast<LIR**>(arena_->Alloc(elements * sizeof(LIR*), ArenaAllocator::kAllocLIR));
switch_tables_.Insert(tab_rec);
// The table is composed of 8-byte key/disp pairs
@@ -147,12 +146,11 @@ void MipsMir2Lir::GenPackedSwitch(MIR* mir, uint32_t table_offset,
}
// Add the table to the list - we'll process it later
SwitchTable *tab_rec =
- static_cast<SwitchTable*>(arena_->NewMem(sizeof(SwitchTable), true,
- ArenaAllocator::kAllocData));
+ static_cast<SwitchTable*>(arena_->Alloc(sizeof(SwitchTable), ArenaAllocator::kAllocData));
tab_rec->table = table;
tab_rec->vaddr = current_dalvik_offset_;
int size = table[1];
- tab_rec->targets = static_cast<LIR**>(arena_->NewMem(size * sizeof(LIR*), true,
+ tab_rec->targets = static_cast<LIR**>(arena_->Alloc(size * sizeof(LIR*),
ArenaAllocator::kAllocLIR));
switch_tables_.Insert(tab_rec);
@@ -228,8 +226,8 @@ void MipsMir2Lir::GenFillArrayData(uint32_t table_offset, RegLocation rl_src) {
const uint16_t* table = cu_->insns + current_dalvik_offset_ + table_offset;
// Add the table to the list - we'll process it later
FillArrayData *tab_rec =
- reinterpret_cast<FillArrayData*>(arena_->NewMem(sizeof(FillArrayData), true,
- ArenaAllocator::kAllocData));
+ reinterpret_cast<FillArrayData*>(arena_->Alloc(sizeof(FillArrayData),
+ ArenaAllocator::kAllocData));
tab_rec->table = table;
tab_rec->vaddr = current_dalvik_offset_;
uint16_t width = tab_rec->table[1];