Merge "Clear the right data pointer."
diff --git a/compiler/optimizing/intrinsics_arm_vixl.cc b/compiler/optimizing/intrinsics_arm_vixl.cc
index e4bef34..110430f 100644
--- a/compiler/optimizing/intrinsics_arm_vixl.cc
+++ b/compiler/optimizing/intrinsics_arm_vixl.cc
@@ -1281,20 +1281,20 @@
     // For compressed strings we need to clear 0x7 from temp1, for uncompressed we need to clear
     // 0xf. We also need to prepare the character extraction mask `uncompressed ? 0xffffu : 0xffu`.
     // The compression flag is now in the highest bit of temp3, so let's play some tricks.
-    __ orr(temp3, temp3, 0xffu << 23);                  // uncompressed ? 0xff800000u : 0x7ff80000u
-    __ bic(temp1, temp1, Operand(temp3, vixl32::LSR, 31 - 3));  // &= ~(uncompressed ? 0xfu : 0x7u)
+    __ Orr(temp3, temp3, 0xffu << 23);                  // uncompressed ? 0xff800000u : 0x7ff80000u
+    __ Bic(temp1, temp1, Operand(temp3, vixl32::LSR, 31 - 3));  // &= ~(uncompressed ? 0xfu : 0x7u)
     __ Asr(temp3, temp3, 7u);                           // uncompressed ? 0xffff0000u : 0xff0000u.
     __ Lsr(temp2, temp2, temp1);                        // Extract second character.
     __ Lsr(temp3, temp3, 16u);                          // uncompressed ? 0xffffu : 0xffu
     __ Lsr(out, temp_reg, temp1);                       // Extract first character.
-    __ and_(temp2, temp2, temp3);
-    __ and_(out, out, temp3);
+    __ And(temp2, temp2, temp3);
+    __ And(out, out, temp3);
   } else {
-    __ bic(temp1, temp1, 0xf);
+    __ Bic(temp1, temp1, 0xf);
     __ Lsr(temp2, temp2, temp1);
     __ Lsr(out, temp_reg, temp1);
-    __ movt(temp2, 0);
-    __ movt(out, 0);
+    __ Movt(temp2, 0);
+    __ Movt(out, 0);
   }
 
   __ Sub(out, out, temp2);
@@ -1313,10 +1313,10 @@
     // need to treat as unsigned. Start by freeing the bit with an ADD and continue
     // further down by a LSRS+SBC which will flip the meaning of the flag but allow
     // `subs temp0, #2; bhi different_compression_loop` to serve as the loop condition.
-    __ add(temp0, temp0, temp0);              // Unlike LSL, this ADD is always 16-bit.
+    __ Add(temp0, temp0, temp0);              // Unlike LSL, this ADD is always 16-bit.
     // `temp1` will hold the compressed data pointer, `temp2` the uncompressed data pointer.
-    __ mov(temp1, str);
-    __ mov(temp2, arg);
+    __ Mov(temp1, str);
+    __ Mov(temp2, arg);
     __ Lsrs(temp3, temp3, 1u);                // Continue the move of the compression flag.
     {
       AssemblerAccurateScope aas(assembler->GetVIXLAssembler(),
@@ -1326,11 +1326,11 @@
       __ mov(cs, temp1, arg);                 // Preserves flags.
       __ mov(cs, temp2, str);                 // Preserves flags.
     }
-    __ sbc(temp0, temp0, 0);                  // Complete the move of the compression flag.
+    __ Sbc(temp0, temp0, 0);                  // Complete the move of the compression flag.
 
     // Adjust temp1 and temp2 from string pointers to data pointers.
-    __ add(temp1, temp1, value_offset);
-    __ add(temp2, temp2, value_offset);
+    __ Add(temp1, temp1, value_offset);
+    __ Add(temp2, temp2, value_offset);
 
     vixl32::Label different_compression_loop;
     vixl32::Label different_compression_diff;
@@ -1340,7 +1340,7 @@
     __ Bind(&different_compression_loop);
     __ Ldrb(temp_reg, MemOperand(temp1, c_char_size, PostIndex));
     __ Ldrh(temp3, MemOperand(temp2, char_size, PostIndex));
-    __ cmp(temp_reg, temp3);
+    __ Cmp(temp_reg, temp3);
     __ B(ne, &different_compression_diff);
     __ Subs(temp0, temp0, 2);
     __ B(hi, &different_compression_loop);
diff --git a/test/626-const-class-linking/expected.txt b/test/626-const-class-linking/expected.txt
index e83aa78..1243226 100644
--- a/test/626-const-class-linking/expected.txt
+++ b/test/626-const-class-linking/expected.txt
@@ -33,7 +33,6 @@
   throwables: 0
   class_weaks: 4 (2 unique)
 testRacyLoader2 done
-MisbehavingLoader loading Helper2 instead of Test
 java.lang.NoClassDefFoundError: Initiating class loader of type MisbehavingLoader returned class Helper2 instead of Test.
 testMisbehavingLoader done
 first: Helper1 class loader: RacyMisbehavingLoader
diff --git a/test/626-const-class-linking/src/Main.java b/test/626-const-class-linking/src/Main.java
index 44ea1c1..05a6bac 100644
--- a/test/626-const-class-linking/src/Main.java
+++ b/test/626-const-class-linking/src/Main.java
@@ -49,6 +49,7 @@
         }
         Runtime.getRuntime().gc();
         WeakReference<Class<?>> weak_test2 = wrapHelperGet(helper);
+        Runtime.getRuntime().gc();
 
         Class<?> test1 = weak_test1.get();
         if (test1 == null) {
@@ -62,20 +63,6 @@
             System.out.println("test1 != test2");
         }
 
-        test1 = null;
-        test2 = null;
-        if (!usingRI) {
-            clearResolvedTypes(helper);
-        }
-        helper = null;
-        delegating_loader = null;
-        Runtime.getRuntime().gc();
-        if (weak_test1.get() != null) {
-            System.out.println("weak_test1 still not null");
-        }
-        if (weak_test2.get() != null) {
-            System.out.println("weak_test2 still not null");
-        }
         System.out.println("testClearDexCache done");
     }
 
@@ -90,6 +77,8 @@
         Class<?> helper2 = delegating_loader.loadClass("Helper2");
         WeakReference<Class<?>> weak_test2 = wrapHelperGet(helper2);
 
+        Runtime.getRuntime().gc();
+
         Class<?> test1 = weak_test1.get();
         if (test1 == null) {
             System.out.println("test1 disappeared");
@@ -102,18 +91,6 @@
             System.out.println("test1 != test2");
         }
 
-        test1 = null;
-        test2 = null;
-        delegating_loader = null;
-        helper1 = null;
-        helper2 = null;
-        Runtime.getRuntime().gc();
-        if (weak_test1.get() != null) {
-            System.out.println("weak_test1 still not null");
-        }
-        if (weak_test2.get() != null) {
-            System.out.println("weak_test2 still not null");
-        }
         System.out.println("testMultiDex done");
     }
 
@@ -271,38 +248,38 @@
     }
 
     private static void testRacyMisbehavingLoader2() throws Exception {
-      final ClassLoader system_loader = ClassLoader.getSystemClassLoader();
+        final ClassLoader system_loader = ClassLoader.getSystemClassLoader();
 
-      final Thread[] threads = new Thread[4];
-      final Object[] results = new Object[threads.length];
+        final Thread[] threads = new Thread[4];
+        final Object[] results = new Object[threads.length];
 
-      final RacyMisbehavingLoader racy_loader =
-          new RacyMisbehavingLoader(system_loader, threads.length, true);
-      final Class<?> helper1 = racy_loader.loadClass("RacyMisbehavingHelper");
+        final RacyMisbehavingLoader racy_loader =
+            new RacyMisbehavingLoader(system_loader, threads.length, true);
+        final Class<?> helper1 = racy_loader.loadClass("RacyMisbehavingHelper");
 
-      for (int i = 0; i != threads.length; ++i) {
-          final int my_index = i;
-          Thread t = new Thread() {
-              public void run() {
-                  try {
-                      Method get = helper1.getDeclaredMethod("get");
-                      results[my_index] = get.invoke(null);
-                  } catch (InvocationTargetException ite) {
-                      results[my_index] = ite.getCause();
-                  } catch (Throwable t) {
-                      results[my_index] = t;
-                  }
-              }
-          };
-          t.start();
-          threads[i] = t;
-      }
-      for (Thread t : threads) {
-          t.join();
-      }
-      dumpResultStats(results);
-      System.out.println("testRacyMisbehavingLoader2 done");
-  }
+        for (int i = 0; i != threads.length; ++i) {
+            final int my_index = i;
+            Thread t = new Thread() {
+                public void run() {
+                    try {
+                        Method get = helper1.getDeclaredMethod("get");
+                        results[my_index] = get.invoke(null);
+                    } catch (InvocationTargetException ite) {
+                        results[my_index] = ite.getCause();
+                    } catch (Throwable t) {
+                        results[my_index] = t;
+                    }
+                }
+            };
+            t.start();
+            threads[i] = t;
+        }
+        for (Thread t : threads) {
+            t.join();
+        }
+        dumpResultStats(results);
+        System.out.println("testRacyMisbehavingLoader2 done");
+    }
 
     private static DelegatingLoader createDelegatingLoader() {
         ClassLoader system_loader = ClassLoader.getSystemClassLoader();
diff --git a/test/626-const-class-linking/src/MisbehavingLoader.java b/test/626-const-class-linking/src/MisbehavingLoader.java
index 61639ba..ca9783e 100644
--- a/test/626-const-class-linking/src/MisbehavingLoader.java
+++ b/test/626-const-class-linking/src/MisbehavingLoader.java
@@ -40,7 +40,6 @@
             return super.loadClass(name, resolve);
         } else if (name.equals("Test")) {
             // Ask for a different class.
-            System.out.println("MisbehavingLoader loading Helper2 instead of Test");
             return defining_loader.loadClass("Helper2", resolve);
         }
         return super.loadClass(name, resolve);