summaryrefslogtreecommitdiff
path: root/compiler/optimizing/block_builder.cc
diff options
context:
space:
mode:
author Mathieu Chartier <mathieuc@google.com> 2017-07-10 14:13:41 -0700
committer Mathieu Chartier <mathieuc@google.com> 2017-07-12 17:54:49 -0700
commitde4b08ff24c330d5b36b5c4dc8664ed4848eeca6 (patch)
tree79835478b8b631bbf006b5e023704f3cf53bda7c /compiler/optimizing/block_builder.cc
parentc9267c48979698a9217760c914aba13ea20b5990 (diff)
Reduce quicken info size
Move the quicken info from using a map of <dex pc, index> to an array of indices. Removed leb encoding since it is harmful for 16 bit indices. The map is indexed by the dequickenable instruction index from the start of the code item. Numbers for a certain large app compiled with quicken filter: dex2oat native alloc: 85345936B -> 81527072B oat file size: 9068968B -> 8659368B vdex file size: 90479120B -> 86321184B Bug: 63467744 Bug: 36457259 Test: test-art-host (cherry picked from commit 959f348acabc48efbb18c547dad6300c0f610c1c) Change-Id: I85546d8cd409cbf96140cbdddabd7e228797b9e3
Diffstat (limited to 'compiler/optimizing/block_builder.cc')
-rw-r--r--compiler/optimizing/block_builder.cc14
1 files changed, 14 insertions, 0 deletions
diff --git a/compiler/optimizing/block_builder.cc b/compiler/optimizing/block_builder.cc
index 1e75f10ebe..fe7ecd1ae1 100644
--- a/compiler/optimizing/block_builder.cc
+++ b/compiler/optimizing/block_builder.cc
@@ -17,6 +17,7 @@
#include "block_builder.h"
#include "bytecode_utils.h"
+#include "quicken_info.h"
namespace art {
@@ -121,13 +122,18 @@ void HBasicBlockBuilder::ConnectBasicBlocks() {
HBasicBlock* block = graph_->GetEntryBlock();
graph_->AddBlock(block);
+ size_t quicken_index = 0;
bool is_throwing_block = false;
+ // Calculate the qucikening index here instead of CreateBranchTargets since it's easier to
+ // calculate in dex_pc order.
for (CodeItemIterator it(code_item_); !it.Done(); it.Advance()) {
uint32_t dex_pc = it.CurrentDexPc();
// Check if this dex_pc address starts a new basic block.
HBasicBlock* next_block = GetBlockAt(dex_pc);
if (next_block != nullptr) {
+ // We only need quicken index entries for basic block boundaries.
+ quicken_index_for_dex_pc_.Put(dex_pc, quicken_index);
if (block != nullptr) {
// Last instruction did not end its basic block but a new one starts here.
// It must have been a block falling through into the next one.
@@ -137,6 +143,10 @@ void HBasicBlockBuilder::ConnectBasicBlocks() {
is_throwing_block = false;
graph_->AddBlock(block);
}
+ // Make sure to increment this before the continues.
+ if (QuickenInfoTable::NeedsIndexForInstruction(&it.CurrentInstruction())) {
+ ++quicken_index;
+ }
if (block == nullptr) {
// Ignore dead code.
@@ -371,4 +381,8 @@ bool HBasicBlockBuilder::Build() {
return true;
}
+size_t HBasicBlockBuilder::GetQuickenIndex(uint32_t dex_pc) const {
+ return quicken_index_for_dex_pc_.Get(dex_pc);
+}
+
} // namespace art