summaryrefslogtreecommitdiff
path: root/compiler/optimizing/builder.cc
diff options
context:
space:
mode:
author Mingyao Yang <mingyao@google.com> 2015-08-24 11:21:42 -0700
committer Mingyao Yang <mingyao@google.com> 2015-10-15 01:36:34 -0700
commit589dac7f0ce078d19aad7e35bb0195c47ddf01d2 (patch)
tree5c77fb845997b21ce1aa97b1fa176c64a76e14f1 /compiler/optimizing/builder.cc
parentd2e0dd179fd2e8c6c820194e187fc5e9164154ff (diff)
load store elimination.
This adds a pass to eliminate some unnecessary heap loads/stores. It first collects heap locations and then tracks values stored to those heap locations. Alias analysis is done based on offset, type, singleton, pre-existence, etc. Change-Id: I11a9d8ef20d1b2f245607eb25118e9aff9be472a
Diffstat (limited to 'compiler/optimizing/builder.cc')
-rw-r--r--compiler/optimizing/builder.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/compiler/optimizing/builder.cc b/compiler/optimizing/builder.cc
index 21540e8ed7..044c4cef11 100644
--- a/compiler/optimizing/builder.cc
+++ b/compiler/optimizing/builder.cc
@@ -1232,12 +1232,14 @@ bool HGraphBuilder::BuildInstanceFieldAccess(const Instruction& instruction,
field_index,
dex_pc);
} else {
+ uint16_t class_def_index = resolved_field->GetDeclaringClass()->GetDexClassDefIndex();
field_set = new (arena_) HInstanceFieldSet(null_check,
value,
field_type,
resolved_field->GetOffset(),
resolved_field->IsVolatile(),
field_index,
+ class_def_index,
*dex_file_,
dex_compilation_unit_->GetDexCache(),
dex_pc);
@@ -1252,11 +1254,13 @@ bool HGraphBuilder::BuildInstanceFieldAccess(const Instruction& instruction,
field_index,
dex_pc);
} else {
+ uint16_t class_def_index = resolved_field->GetDeclaringClass()->GetDexClassDefIndex();
field_get = new (arena_) HInstanceFieldGet(null_check,
field_type,
resolved_field->GetOffset(),
resolved_field->IsVolatile(),
field_index,
+ class_def_index,
*dex_file_,
dex_compilation_unit_->GetDexCache(),
dex_pc);
@@ -1398,6 +1402,8 @@ bool HGraphBuilder::BuildStaticFieldAccess(const Instruction& instruction,
cls = new (arena_) HClinitCheck(constant, dex_pc);
current_block_->AddInstruction(cls);
}
+
+ uint16_t class_def_index = resolved_field->GetDeclaringClass()->GetDexClassDefIndex();
if (is_put) {
// We need to keep the class alive before loading the value.
Temporaries temps(graph_);
@@ -1410,6 +1416,7 @@ bool HGraphBuilder::BuildStaticFieldAccess(const Instruction& instruction,
resolved_field->GetOffset(),
resolved_field->IsVolatile(),
field_index,
+ class_def_index,
*dex_file_,
dex_cache_,
dex_pc));
@@ -1419,6 +1426,7 @@ bool HGraphBuilder::BuildStaticFieldAccess(const Instruction& instruction,
resolved_field->GetOffset(),
resolved_field->IsVolatile(),
field_index,
+ class_def_index,
*dex_file_,
dex_cache_,
dex_pc));