summaryrefslogtreecommitdiffstats
path: root/runtime
diff options
context:
space:
mode:
authorAndreas Gampe <agampe@google.com>2015-07-09 11:30:14 -0700
committerAndreas Gampe <agampe@google.com>2015-07-09 15:18:13 -0700
commit25e1af5b4e1ce7e03a188ca1d0197a9f5b6acaf8 (patch)
tree9e1c4605e49d0e9ee7243696d7a8a98e5897c336 /runtime
parentc08e0c73bb397bc535c299dc0b9062f9ee2d86a0 (diff)
downloadart-25e1af5b4e1ce7e03a188ca1d0197a9f5b6acaf8.zip
art-25e1af5b4e1ce7e03a188ca1d0197a9f5b6acaf8.tar.gz
art-25e1af5b4e1ce7e03a188ca1d0197a9f5b6acaf8.tar.bz2
ART: Change merges with Undefined to Undefined
The result of a merge with an Undefined type should be Undefined. Conflicts are allowed to be copied around, but Undefined registers should not be touched at all, except to be written into. Add a success test case (the register isn't used) and a fail test case (the register is tried to be copied). Bug: 22331663 Bug: 22371999 (cherry picked from commit 97a1ff353f254b6e46c7501fe3f0e3254c2517b4) Change-Id: I9697ce31c1d2ab5aee0433dcf1253bcca79c2983
Diffstat (limited to 'runtime')
-rw-r--r--runtime/verifier/reg_type.cc10
1 files changed, 9 insertions, 1 deletions
diff --git a/runtime/verifier/reg_type.cc b/runtime/verifier/reg_type.cc
index c8aa4fd..1435607 100644
--- a/runtime/verifier/reg_type.cc
+++ b/runtime/verifier/reg_type.cc
@@ -585,7 +585,15 @@ const RegType& RegType::Merge(const RegType& incoming_type, RegTypeCache* reg_ty
DCHECK(!Equals(incoming_type)); // Trivial equality handled by caller
// Perform pointer equality tests for conflict to avoid virtual method dispatch.
const ConflictType& conflict = reg_types->Conflict();
- if (this == &conflict) {
+ if (IsUndefined() || incoming_type.IsUndefined()) {
+ // There is a difference between undefined and conflict. Conflicts may be copied around, but
+ // not used. Undefined registers must not be copied. So any merge with undefined should return
+ // undefined.
+ if (IsUndefined()) {
+ return *this;
+ }
+ return incoming_type;
+ } else if (this == &conflict) {
DCHECK(IsConflict());
return *this; // Conflict MERGE * => Conflict
} else if (&incoming_type == &conflict) {