diff options
| author | 2016-06-27 10:03:29 +0100 | |
|---|---|---|
| committer | 2016-06-27 13:21:03 -0700 | |
| commit | c2f1735e04537c94a8505aa2badd31281087ab51 (patch) | |
| tree | 2684fc5420cf39c5e62e4bb738469520bd32a173 /compiler/optimizing | |
| parent | f7a0543d88a03bcdaa845e41486b8df84171101b (diff) | |
Do not remove loads/store with unresolved accesses.
Due to AOT and compiling classes that are not ready yet
(eg missing a super class), we need to be conservative when
accessing fields and can end up in a situation where the same
field can be resolved and unresolved within the same method
(because of inlining). Therefore, disable removing loads and
stores in a method when there are unresolved accesses.
bug:29433999
(cherry picked from commit b93a16517dce12b83e9d5d3b599446e25fcc157a)
Change-Id: I8fcfb52c584222474a8220eb16c6581350b702e0
Diffstat (limited to 'compiler/optimizing')
| -rw-r--r-- | compiler/optimizing/load_store_elimination.cc | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/compiler/optimizing/load_store_elimination.cc b/compiler/optimizing/load_store_elimination.cc index b4d93add9c..874f3be9b8 100644 --- a/compiler/optimizing/load_store_elimination.cc +++ b/compiler/optimizing/load_store_elimination.cc @@ -65,6 +65,16 @@ class ReferenceInfo : public ArenaObject<kArenaAllocMisc> { is_singleton_and_not_returned_ = false; return; } + if ((user->IsUnresolvedInstanceFieldGet() && (reference_ == user->InputAt(0))) || + (user->IsUnresolvedInstanceFieldSet() && (reference_ == user->InputAt(0)))) { + // The field is accessed in an unresolved way. We mark the object as a singleton to + // disable load/store optimizations on it. + // Note that we could optimize this case and still perform some optimizations until + // we hit the unresolved access, but disabling is the simplest. + is_singleton_ = false; + is_singleton_and_not_returned_ = false; + return; + } if (user->IsReturn()) { is_singleton_and_not_returned_ = false; } |