summaryrefslogtreecommitdiff
path: root/compiler/dex/quick/codegen_util.cc
diff options
context:
space:
mode:
author Andreas Gampe <agampe@google.com> 2014-09-03 00:31:30 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2014-09-03 00:31:30 +0000
commit579123b22546d36ed47e896a567a7ca6b5470d1a (patch)
tree8e96f55cd4fe4da50d4902ae5da8293fb8be2c4a /compiler/dex/quick/codegen_util.cc
parentfa6fe2dfb401e30890f1feb48b664eb19636b8d4 (diff)
parentde0b996661351450fa4d918706c5322e001c29c9 (diff)
Merge "ART: Fix read-out-of-bounds in the compiler"
Diffstat (limited to 'compiler/dex/quick/codegen_util.cc')
-rw-r--r--compiler/dex/quick/codegen_util.cc15
1 files changed, 11 insertions, 4 deletions
diff --git a/compiler/dex/quick/codegen_util.cc b/compiler/dex/quick/codegen_util.cc
index 08e1c1aa5a..6d8f28849e 100644
--- a/compiler/dex/quick/codegen_util.cc
+++ b/compiler/dex/quick/codegen_util.cc
@@ -57,16 +57,23 @@ bool Mir2Lir::IsInexpensiveConstant(RegLocation rl_src) {
bool res = false;
if (rl_src.is_const) {
if (rl_src.wide) {
+ // For wide registers, check whether we're the high partner. In that case we need to switch
+ // to the lower one for the correct value.
+ if (rl_src.high_word) {
+ rl_src.high_word = false;
+ rl_src.s_reg_low--;
+ rl_src.orig_sreg--;
+ }
if (rl_src.fp) {
- res = InexpensiveConstantDouble(mir_graph_->ConstantValueWide(rl_src));
+ res = InexpensiveConstantDouble(mir_graph_->ConstantValueWide(rl_src));
} else {
- res = InexpensiveConstantLong(mir_graph_->ConstantValueWide(rl_src));
+ res = InexpensiveConstantLong(mir_graph_->ConstantValueWide(rl_src));
}
} else {
if (rl_src.fp) {
- res = InexpensiveConstantFloat(mir_graph_->ConstantValue(rl_src));
+ res = InexpensiveConstantFloat(mir_graph_->ConstantValue(rl_src));
} else {
- res = InexpensiveConstantInt(mir_graph_->ConstantValue(rl_src));
+ res = InexpensiveConstantInt(mir_graph_->ConstantValue(rl_src));
}
}
}