Merge "[optimizing compiler] Add REM_FLOAT and REM_DOUBLE"
diff --git a/compiler/dex/mir_optimization.cc b/compiler/dex/mir_optimization.cc
index 55f2abc..fd4c3d7 100644
--- a/compiler/dex/mir_optimization.cc
+++ b/compiler/dex/mir_optimization.cc
@@ -526,6 +526,9 @@
                 default: LOG(ERROR) << "Unexpected opcode: " << opcode;
               }
               mir->dalvikInsn.opcode = static_cast<Instruction::Code>(kMirOpNop);
+              // Clear use count of temp VR.
+              use_counts_[mir->ssa_rep->defs[0]] = 0;
+              raw_use_counts_[mir->ssa_rep->defs[0]] = 0;
               // Copy the SSA information that is relevant.
               mir_next->ssa_rep->num_uses = mir->ssa_rep->num_uses;
               mir_next->ssa_rep->uses = mir->ssa_rep->uses;
@@ -795,10 +798,6 @@
       break;
     }
     walker = prev;
-
-    if (walker->visited) {
-      break;
-    }
   }
   return false;
 }
diff --git a/compiler/image_writer.cc b/compiler/image_writer.cc
index a45c2d1..eb1b5db 100644
--- a/compiler/image_writer.cc
+++ b/compiler/image_writer.cc
@@ -548,6 +548,7 @@
   }
   // Create character array, copy characters and point the strings there.
   mirror::CharArray* array = mirror::CharArray::Alloc(self, num_chars);
+  string_data_array_ = array;
   uint16_t* array_data = array->GetData();
   size_t pos = 0u;
   prev_s = nullptr;
@@ -1234,4 +1235,13 @@
   return lockword_ & ~kBinMask;
 }
 
+void ImageWriter::FreeStringDataArray() {
+  if (string_data_array_ != nullptr) {
+    gc::space::LargeObjectSpace* los = Runtime::Current()->GetHeap()->GetLargeObjectsSpace();
+    if (los != nullptr) {
+      los->Free(Thread::Current(), reinterpret_cast<mirror::Object*>(string_data_array_));
+    }
+  }
+}
+
 }  // namespace art
diff --git a/compiler/image_writer.h b/compiler/image_writer.h
index 8c84b68..4418879 100644
--- a/compiler/image_writer.h
+++ b/compiler/image_writer.h
@@ -18,6 +18,7 @@
 #define ART_COMPILER_IMAGE_WRITER_H_
 
 #include <stdint.h>
+#include <valgrind.h>
 
 #include <cstddef>
 #include <memory>
@@ -56,7 +57,15 @@
     CHECK_NE(image_begin, 0U);
   }
 
-  ~ImageWriter() {}
+  ~ImageWriter() {
+    // For interned strings a large array is allocated to hold all the character data and avoid
+    // overhead. However, no GC is run anymore at this point. As the array is likely large, it
+    // will be allocated in the large object space, where valgrind can track every single
+    // allocation. Not explicitly freeing that array will be recognized as a leak.
+    if (RUNNING_ON_VALGRIND != 0) {
+      FreeStringDataArray();
+    }
+  }
 
   bool PrepareImageAddressSpace();
 
@@ -254,6 +263,9 @@
   // Calculate the sum total of the bin slot sizes in [0, up_to). Defaults to all bins.
   size_t GetBinSizeSum(Bin up_to = kBinSize) const;
 
+  // Release the string_data_array_.
+  void FreeStringDataArray();
+
   const CompilerDriver& compiler_driver_;
 
   // Beginning target image address for the output image.
@@ -306,6 +318,8 @@
   size_t bin_slot_sizes_[kBinSize];  // Number of bytes in a bin
   size_t bin_slot_count_[kBinSize];  // Number of objects in a bin
 
+  void* string_data_array_;  // The backing for the interned strings.
+
   friend class FixupVisitor;
   friend class FixupClassVisitor;
   DISALLOW_COPY_AND_ASSIGN(ImageWriter);
diff --git a/dex2oat/Android.mk b/dex2oat/Android.mk
index cf30667..3f15964 100644
--- a/dex2oat/Android.mk
+++ b/dex2oat/Android.mk
@@ -24,22 +24,30 @@
 # TODO: Remove this when the framework (installd) supports pushing the
 # right instruction-set parameter for the primary architecture.
 ifneq ($(filter ro.zygote=zygote64,$(PRODUCT_DEFAULT_PROPERTY_OVERRIDES)),)
-  dex2oat_arch := 64
+  dex2oat_target_arch := 64
 else
-  dex2oat_arch := 32
+  dex2oat_target_arch := 32
+endif
+
+# We need to explcitly give the arch, as giving 'both' will make the
+# build-art-executable rule compile dex2oat for 64bits.
+ifeq ($(HOST_PREFER_32_BIT),true)
+  dex2oat_host_arch := 32
+else
+  dex2oat_host_arch := both
 endif
 
 ifeq ($(ART_BUILD_TARGET_NDEBUG),true)
-  $(eval $(call build-art-executable,dex2oat,$(DEX2OAT_SRC_FILES),libcutils libart-compiler,art/compiler,target,ndebug,$(dex2oat_arch)))
+  $(eval $(call build-art-executable,dex2oat,$(DEX2OAT_SRC_FILES),libcutils libart-compiler,art/compiler,target,ndebug,$(dex2oat_target_arch)))
 endif
 ifeq ($(ART_BUILD_TARGET_DEBUG),true)
-  $(eval $(call build-art-executable,dex2oat,$(DEX2OAT_SRC_FILES),libcutils libartd-compiler,art/compiler,target,debug,$(dex2oat_arch)))
+  $(eval $(call build-art-executable,dex2oat,$(DEX2OAT_SRC_FILES),libcutils libartd-compiler,art/compiler,target,debug,$(dex2oat_target_arch)))
 endif
 
 # We always build dex2oat and dependencies, even if the host build is otherwise disabled, since they are used to cross compile for the target.
 ifeq ($(ART_BUILD_HOST_NDEBUG),true)
-  $(eval $(call build-art-executable,dex2oat,$(DEX2OAT_SRC_FILES),libart-compiler libziparchive-host,art/compiler,host,ndebug,both))
+  $(eval $(call build-art-executable,dex2oat,$(DEX2OAT_SRC_FILES),libart-compiler libziparchive-host,art/compiler,host,ndebug,$(dex2oat_host_arch)))
 endif
 ifeq ($(ART_BUILD_HOST_DEBUG),true)
-  $(eval $(call build-art-executable,dex2oat,$(DEX2OAT_SRC_FILES),libartd-compiler libziparchive-host,art/compiler,host,debug,both))
+  $(eval $(call build-art-executable,dex2oat,$(DEX2OAT_SRC_FILES),libartd-compiler libziparchive-host,art/compiler,host,debug,$(dex2oat_host_arch)))
 endif
diff --git a/runtime/arch/arm/portable_entrypoints_arm.S b/runtime/arch/arm/portable_entrypoints_arm.S
index 89ac1f7..f59b514 100644
--- a/runtime/arch/arm/portable_entrypoints_arm.S
+++ b/runtime/arch/arm/portable_entrypoints_arm.S
@@ -28,7 +28,6 @@
      */
 ENTRY art_portable_invoke_stub
     push   {r0, r4, r5, r9, r11, lr}       @ spill regs
-    .save  {r0, r4, r5, r9, r11, lr}
     .cfi_adjust_cfa_offset 24
     .cfi_rel_offset r0, 0
     .cfi_rel_offset r4, 4
@@ -38,7 +37,6 @@
     .cfi_rel_offset lr, 20
     mov    r11, sp                         @ save the stack pointer
     .cfi_def_cfa_register r11
-    @.movsp r11
     mov    r9, r3                          @ move managed thread pointer into r9
     mov    r4, #SUSPEND_CHECK_INTERVAL     @ reset r4 to suspend check interval
     add    r5, r2, #16                     @ create space for method pointer in frame
@@ -56,11 +54,10 @@
     ldr    ip, [r0, #MIRROR_ART_METHOD_PORTABLE_CODE_OFFSET_32]  @ get pointer to the code
     blx    ip                              @ call the method
     mov    sp, r11                         @ restore the stack pointer
+    .cfi_def_cfa_register sp
     ldr    ip, [sp, #24]                   @ load the result pointer
     strd   r0, [ip]                        @ store r0/r1 into result pointer
-    pop    {r0, r4, r5, r9, r11, lr}       @ restore spill regs
-    .cfi_adjust_cfa_offset -24
-    bx     lr
+    pop    {r0, r4, r5, r9, r11, pc}       @ restore spill regs
 END art_portable_invoke_stub
 
     .extern artPortableProxyInvokeHandler
@@ -68,7 +65,6 @@
     @ Fake callee save ref and args frame set up, note portable doesn't use callee save frames.
     @ TODO: just save the registers that are needed in artPortableProxyInvokeHandler.
     push {r1-r3, r5-r8, r10-r11, lr}  @ 10 words of callee saves
-    .save {r1-r3, r5-r8, r10-r11, lr}
     .cfi_adjust_cfa_offset 40
     .cfi_rel_offset r1, 0
     .cfi_rel_offset r2, 4
@@ -81,7 +77,6 @@
     .cfi_rel_offset r11, 32
     .cfi_rel_offset lr, 36
     sub sp, #8                        @ 2 words of space, bottom word will hold Method*
-    .pad #8
     .cfi_adjust_cfa_offset 8
     @ Begin argument set up.
     str     r0, [sp, #0]           @ place proxy method at bottom of frame
@@ -100,7 +95,6 @@
     @ Fake callee save ref and args frame set up, note portable doesn't use callee save frames.
     @ TODO: just save the registers that are needed in artPortableResolutionTrampoline.
     push {r1-r3, r5-r8, r10-r11, lr}  @ 10 words of callee saves
-    .save {r1-r3, r5-r8, r10-r11, lr}
     .cfi_adjust_cfa_offset 40
     .cfi_rel_offset r1, 0
     .cfi_rel_offset r2, 4
@@ -113,7 +107,6 @@
     .cfi_rel_offset r11, 32
     .cfi_rel_offset lr, 36
     sub sp, #8                     @ 2 words of space, bottom word will hold Method*
-    .pad #8
     .cfi_adjust_cfa_offset 8
     mov     r2, r9                 @ pass Thread::Current
     mov     r3, sp                 @ pass SP
@@ -128,6 +121,8 @@
     add  sp, #48                   @ rewind sp
     .cfi_adjust_cfa_offset -48
     bx      r12                    @ tail-call into actual code
+    .cfi_adjust_cfa_offset 48      @ Reset unwind info so following code unwinds.
+
 1:
     ldr  r1, [sp, #8]          @ restore non-callee save r1
     ldrd r2, [sp, #12]         @ restore non-callee saves r2-r3
@@ -142,7 +137,6 @@
     @ Fake callee save ref and args frame set up, note portable doesn't use callee save frames.
     @ TODO: just save the registers that are needed in artPortableToInterpreterBridge.
     push {r1-r3, r5-r8, r10-r11, lr}  @ 10 words of callee saves
-    .save {r1-r3, r5-r8, r10-r11, lr}
     .cfi_adjust_cfa_offset 40
     .cfi_rel_offset r1, 0
     .cfi_rel_offset r2, 4
@@ -155,7 +149,6 @@
     .cfi_rel_offset r11, 32
     .cfi_rel_offset lr, 36
     sub sp, #8                     @ 2 words of space, bottom word will hold Method*
-    .pad #8
     .cfi_adjust_cfa_offset 8
     mov     r1, r9                 @ pass Thread::Current
     mov     r2, sp                 @ pass SP
diff --git a/runtime/arch/arm/quick_entrypoints_arm.S b/runtime/arch/arm/quick_entrypoints_arm.S
index 1782db5..0ae54dc 100644
--- a/runtime/arch/arm/quick_entrypoints_arm.S
+++ b/runtime/arch/arm/quick_entrypoints_arm.S
@@ -29,7 +29,6 @@
      */
 .macro SETUP_SAVE_ALL_CALLEE_SAVE_FRAME rTemp1, rTemp2
     push {r4-r11, lr}                             @ 9 words (36 bytes) of callee saves.
-    .save {r4-r11, lr}
     .cfi_adjust_cfa_offset 36
     .cfi_rel_offset r4, 0
     .cfi_rel_offset r5, 4
@@ -41,10 +40,8 @@
     .cfi_rel_offset r11, 28
     .cfi_rel_offset lr, 32
     vpush {s16-s31}                               @ 16 words (64 bytes) of floats.
-    .pad #64
     .cfi_adjust_cfa_offset 64
     sub sp, #12                                   @ 3 words of space, bottom word will hold Method*
-    .pad #12
     .cfi_adjust_cfa_offset 12
     RUNTIME_CURRENT1 \rTemp1, \rTemp2             @ Load Runtime::Current into rTemp1.
     THIS_LOAD_REQUIRES_READ_BARRIER
@@ -64,7 +61,6 @@
      */
 .macro SETUP_REFS_ONLY_CALLEE_SAVE_FRAME rTemp1, rTemp2
     push {r5-r8, r10-r11, lr}                     @ 7 words of callee saves
-    .save {r5-r8, r10-r11, lr}
     .cfi_adjust_cfa_offset 28
     .cfi_rel_offset r5, 0
     .cfi_rel_offset r6, 4
@@ -74,7 +70,6 @@
     .cfi_rel_offset r11, 20
     .cfi_rel_offset lr, 24
     sub sp, #4                                    @ bottom word will hold Method*
-    .pad #4
     .cfi_adjust_cfa_offset 4
     RUNTIME_CURRENT2 \rTemp1, \rTemp2             @ Load Runtime::Current into rTemp1.
     THIS_LOAD_REQUIRES_READ_BARRIER
@@ -90,6 +85,7 @@
 
 .macro RESTORE_REFS_ONLY_CALLEE_SAVE_FRAME
     add sp, #4               @ bottom word holds Method*
+    .cfi_adjust_cfa_offset -4
     pop {r5-r8, r10-r11, lr} @ 7 words of callee saves
     .cfi_restore r5
     .cfi_restore r6
@@ -97,7 +93,8 @@
     .cfi_restore r8
     .cfi_restore r10
     .cfi_restore r11
-    .cfi_adjust_cfa_offset -FRAME_SIZE_REFS_ONLY_CALLEE_SAVE
+    .cfi_restore lr
+    .cfi_adjust_cfa_offset -28
 .endm
 
 .macro RESTORE_REFS_ONLY_CALLEE_SAVE_FRAME_AND_RETURN
@@ -111,7 +108,6 @@
      */
 .macro SETUP_REFS_AND_ARGS_CALLEE_SAVE_FRAME_REGISTERS_ONLY
     push {r1-r3, r5-r8, r10-r11, lr}   @ 10 words of callee saves and args.
-    .save {r1-r3, r5-r8, r10-r11, lr}
     .cfi_adjust_cfa_offset 40
     .cfi_rel_offset r1, 0
     .cfi_rel_offset r2, 4
@@ -124,10 +120,8 @@
     .cfi_rel_offset r11, 32
     .cfi_rel_offset lr, 36
     vpush {s0-s15}                     @ 16 words of float args.
-    .pad #64
     .cfi_adjust_cfa_offset 64
     sub sp, #8                         @ 2 words of space, bottom word will hold Method*
-    .pad #8
     .cfi_adjust_cfa_offset 8
     // Ugly compile-time check, but we only have the preprocessor.
 #if (FRAME_SIZE_REFS_AND_ARGS_CALLEE_SAVE != 40 + 64 + 8)
@@ -166,6 +160,7 @@
     .cfi_restore r8
     .cfi_restore r10
     .cfi_restore r11
+    .cfi_restore lr
     .cfi_adjust_cfa_offset -40
 .endm
 
@@ -269,7 +264,6 @@
     SETUP_REFS_ONLY_CALLEE_SAVE_FRAME r3, r12  @ save callee saves in case of GC
     ldr    r3, [sp, #FRAME_SIZE_REFS_ONLY_CALLEE_SAVE]  @ pass referrer
     str    r9, [sp, #-16]!               @ expand the frame and pass Thread::Current
-    .pad #16
     .cfi_adjust_cfa_offset 16
     bl     \entrypoint                   @ (field_idx, Object*, new_val, referrer, Thread*)
     add    sp, #16                       @ release out args
@@ -335,7 +329,6 @@
     mov    r3, r9                         @ pass Thread::Current
     mov    r12, sp
     str    r12, [sp, #-16]!               @ expand the frame and pass SP
-    .pad #16
     .cfi_adjust_cfa_offset 16
     bl     \cxx_name                      @ (method_idx, this, caller, Thread*, SP)
     add    sp, #16                        @ strip the extra frame
@@ -387,8 +380,6 @@
      */
 ENTRY art_quick_invoke_stub_internal
     push   {r4, r9, r11, lr}               @ spill regs
-    .save  {r4, r9, r11, lr}
-    .pad #16
     .cfi_adjust_cfa_offset 16
     .cfi_rel_offset r4, 0
     .cfi_rel_offset r9, 4
@@ -435,13 +426,7 @@
     strdeq r0, [r9]                        @ store r0/r1 into result pointer
     vstrne d0, [r9]                        @ store s0-s1/d0 into result pointer
 
-    pop    {r4, r9, r11, lr}               @ restore spill regs
-    .cfi_restore r4
-    .cfi_restore r9
-    .cfi_restore r11
-    .cfi_restore lr
-    .cfi_adjust_cfa_offset -16
-    bx     lr
+    pop    {r4, r9, r11, pc}               @ restore spill regs
 END art_quick_invoke_stub_internal
 
     /*
@@ -544,25 +529,26 @@
     .extern artThrowClassCastException
 ENTRY art_quick_check_cast
     push {r0-r1, lr}                    @ save arguments, link register and pad
-    .save {r0-r1, lr}
     .cfi_adjust_cfa_offset 12
     .cfi_rel_offset r0, 0
     .cfi_rel_offset r1, 4
     .cfi_rel_offset lr, 8
     sub sp, #4
-    .pad #4
     .cfi_adjust_cfa_offset 4
     bl artIsAssignableFromCode
     cbz    r0, .Lthrow_class_cast_exception
     add sp, #4
     .cfi_adjust_cfa_offset -4
     pop {r0-r1, pc}
+    .cfi_adjust_cfa_offset 4        @ Reset unwind info so following code unwinds.
 .Lthrow_class_cast_exception:
     add sp, #4
     .cfi_adjust_cfa_offset -4
     pop {r0-r1, lr}
+    .cfi_adjust_cfa_offset -12
     .cfi_restore r0
     .cfi_restore r1
+    .cfi_restore lr
     SETUP_SAVE_ALL_CALLEE_SAVE_FRAME r2, r3  // save all registers as basis for long jump context
     mov r2, r9                      @ pass Thread::Current
     b   artThrowClassCastException  @ (Class*, Class*, Thread*)
@@ -611,7 +597,6 @@
     blx lr
 .Lcheck_assignability:
     push {r0-r2, lr}             @ save arguments
-    .save {r0-r2, lr}
     .cfi_adjust_cfa_offset 16
     .cfi_rel_offset r0, 0
     .cfi_rel_offset r1, 4
@@ -635,11 +620,7 @@
     blx lr
 .Lthrow_array_store_exception:
     pop {r0-r2, lr}
-    .cfi_restore r0
-    .cfi_restore r1
-    .cfi_restore r2
-    .cfi_restore lr
-    .cfi_adjust_cfa_offset -16
+    /* No need to repeat restore cfi directives, the ones above apply here. */
     SETUP_SAVE_ALL_CALLEE_SAVE_FRAME r3, ip
     mov r1, r2
     mov r2, r9                     @ pass Thread::Current
@@ -762,7 +743,6 @@
     mov    r2, r1                        @ pass other half of wide argument
     ldr    r1, [sp, #FRAME_SIZE_REFS_ONLY_CALLEE_SAVE]  @ pass referrer
     str    r9, [sp, #-16]!               @ expand the frame and pass Thread::Current
-    .pad #16
     .cfi_adjust_cfa_offset 16
     bl     artSet64StaticFromCode        @ (field_idx, referrer, new_val, Thread*)
     add    sp, #16                       @ release out args
@@ -787,10 +767,8 @@
     SETUP_REFS_ONLY_CALLEE_SAVE_FRAME r12, lr  @ save callee saves in case of GC
     ldr    r12, [sp, #FRAME_SIZE_REFS_ONLY_CALLEE_SAVE]  @ pass referrer
     str    r9, [sp, #-12]!               @ expand the frame and pass Thread::Current
-    .pad #12
     .cfi_adjust_cfa_offset 12
     str    r12, [sp, #-4]!               @ expand the frame and pass the referrer
-    .pad #4
     .cfi_adjust_cfa_offset 4
     bl     artSet64InstanceFromCode      @ (field_idx, Object*, new_val, Method* referrer, Thread*)
     add    sp, #16                       @ release out args
@@ -1002,6 +980,9 @@
     // store into fpr, for when it's a fpr return...
     vmov d0, r0, r1
     bx lr      // ret
+    // Undo the unwinding information from above since it doesn't apply below.
+    .cfi_def_cfa_register r10
+    .cfi_adjust_cfa_offset FRAME_SIZE_REFS_AND_ARGS_CALLEE_SAVE-FRAME_SIZE_REFS_ONLY_CALLEE_SAVE
 
 .Lentry_error:
     mov sp, r10
@@ -1056,12 +1037,10 @@
     SETUP_REFS_ONLY_CALLEE_SAVE_FRAME r2, r3  @ set up frame knowing r2 and r3 must be dead on exit
     mov   r12, sp        @ remember bottom of caller's frame
     push  {r0-r1}        @ save return value
-    .save {r0-r1}
     .cfi_adjust_cfa_offset 8
     .cfi_rel_offset r0, 0
     .cfi_rel_offset r1, 4
     sub   sp, #8         @ space for return value argument
-    .pad #8
     .cfi_adjust_cfa_offset 8
     strd r0, [sp]        @ r0/r1 -> [sp] for fpr_res
     mov   r2, r0         @ pass return value as gpr_res
@@ -1075,6 +1054,7 @@
     mov   r2, r0         @ link register saved by instrumentation
     mov   lr, r1         @ r1 is holding link register if we're to bounce to deoptimize
     pop   {r0, r1}       @ restore return value
+    .cfi_adjust_cfa_offset -8
     .cfi_restore r0
     .cfi_restore r1
     add sp, #32          @ remove callee save frame
@@ -1114,7 +1094,6 @@
     /* mul-long vAA, vBB, vCC */
 ENTRY art_quick_mul_long
     push    {r9 - r10}
-    .save {r9 - r10}
     .cfi_adjust_cfa_offset 8
     .cfi_rel_offset r9, 0
     .cfi_rel_offset r10, 4
@@ -1207,7 +1186,6 @@
      */
 ENTRY art_quick_indexof
     push {r4, r10-r11, lr} @ 4 words of callee saves
-    .save {r4, r10-r11, lr}
     .cfi_adjust_cfa_offset 16
     .cfi_rel_offset r4, 0
     .cfi_rel_offset r10, 4
@@ -1324,7 +1302,6 @@
 1:                        @ Same strings, return.
 
     push {r4, r7-r12, lr} @ 8 words - keep alignment
-    .save {r4, r7-r12, lr}
     .cfi_adjust_cfa_offset 32
     .cfi_rel_offset r4, 0
     .cfi_rel_offset r7, 4
@@ -1465,7 +1442,6 @@
     add   sp, #4
     .cfi_adjust_cfa_offset -4
     pop   {pc}
-    .cfi_adjust_cfa_offset -4
 END art_quick_fmod
 
     /* float fmodf(float a, float b) */
@@ -1482,7 +1458,6 @@
     add   sp, #4
     .cfi_adjust_cfa_offset -4
     pop   {pc}
-    .cfi_adjust_cfa_offset -4
 END art_quick_fmod
 
     /* int64_t art_d2l(double d) */
diff --git a/runtime/base/allocator.h b/runtime/base/allocator.h
index 5a09c96..8720f0e 100644
--- a/runtime/base/allocator.h
+++ b/runtime/base/allocator.h
@@ -62,7 +62,7 @@
   kAllocatorTagRememberedSet,
   kAllocatorTagModUnionCardSet,
   kAllocatorTagModUnionReferenceArray,
-  kAllocatorTagJNILibrarires,
+  kAllocatorTagJNILibraries,
   kAllocatorTagCompileTimeClassPath,
   kAllocatorTagOatFile,
   kAllocatorTagDexFileVerifier,
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index ee13e03..1f4cf8f 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -1601,20 +1601,21 @@
                        error_msg);
 }
 
-static void InitFromImageInterpretOnlyCallback(mirror::Object* obj, void* arg)
-    SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
+void ClassLinker::InitFromImageInterpretOnlyCallback(mirror::Object* obj, void* arg) {
   ClassLinker* class_linker = reinterpret_cast<ClassLinker*>(arg);
-
   DCHECK(obj != nullptr);
   DCHECK(class_linker != nullptr);
+  size_t pointer_size = class_linker->image_pointer_size_;
 
   if (obj->IsArtMethod()) {
     mirror::ArtMethod* method = obj->AsArtMethod();
     if (!method->IsNative()) {
-      method->SetEntryPointFromInterpreter(artInterpreterToInterpreterBridge);
+      method->SetEntryPointFromInterpreterPtrSize(artInterpreterToInterpreterBridge, pointer_size);
       if (method != Runtime::Current()->GetResolutionMethod()) {
-        method->SetEntryPointFromQuickCompiledCode(GetQuickToInterpreterBridge());
-        method->SetEntryPointFromPortableCompiledCode(GetPortableToInterpreterBridge());
+        method->SetEntryPointFromQuickCompiledCodePtrSize(GetQuickToInterpreterBridge(),
+                                                          pointer_size);
+        method->SetEntryPointFromPortableCompiledCodePtrSize(GetPortableToInterpreterBridge(),
+                                                             pointer_size);
       }
     }
   }
@@ -1697,7 +1698,8 @@
   }
 
   // Set entry point to interpreter if in InterpretOnly mode.
-  if (Runtime::Current()->GetInstrumentation()->InterpretOnly()) {
+  Runtime* runtime = Runtime::Current();
+  if (!runtime->IsCompiler() && runtime->GetInstrumentation()->InterpretOnly()) {
     ReaderMutexLock mu(self, *Locks::heap_bitmap_lock_);
     heap->VisitObjects(InitFromImageInterpretOnlyCallback, this);
   }
diff --git a/runtime/class_linker.h b/runtime/class_linker.h
index 55332f8..132da67 100644
--- a/runtime/class_linker.h
+++ b/runtime/class_linker.h
@@ -476,6 +476,9 @@
       SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
 
  private:
+  static void InitFromImageInterpretOnlyCallback(mirror::Object* obj, void* arg)
+      SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
+
   const OatFile::OatMethod FindOatMethodFor(mirror::ArtMethod* method, bool* found)
       SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
 
diff --git a/runtime/java_vm_ext.cc b/runtime/java_vm_ext.cc
index 5d04fac..dcdbe9d 100644
--- a/runtime/java_vm_ext.cc
+++ b/runtime/java_vm_ext.cc
@@ -247,7 +247,7 @@
   }
 
  private:
-  AllocationTrackingSafeMap<std::string, SharedLibrary*, kAllocatorTagJNILibrarires> libraries_;
+  AllocationTrackingSafeMap<std::string, SharedLibrary*, kAllocatorTagJNILibraries> libraries_;
 };
 
 
diff --git a/runtime/utils.cc b/runtime/utils.cc
index d9782f3..1211547 100644
--- a/runtime/utils.cc
+++ b/runtime/utils.cc
@@ -1125,6 +1125,14 @@
     return;
   }
 
+#if !defined(HAVE_ANDROID_OS)
+  if (GetTid() != tid) {
+    // TODO: dumping of other threads is disabled to avoid crashes during stress testing.
+    //       b/15446488.
+    return;
+  }
+#endif
+
   std::unique_ptr<Backtrace> backtrace(Backtrace::Create(BACKTRACE_CURRENT_PROCESS, tid));
   if (!backtrace->Unwind(0)) {
     os << prefix << "(backtrace::Unwind failed for thread " << tid << ")\n";
diff --git a/tools/libcore_failures.txt b/tools/libcore_failures.txt
index febc48c..3dc5e71 100644
--- a/tools/libcore_failures.txt
+++ b/tools/libcore_failures.txt
@@ -15,11 +15,6 @@
   name: "libcore.java.math.RunCSVTests#test_csv"
 },
 {
-  description: "Test is currently being updated.",
-  result: EXEC_FAILED,
-  name: "libcore.java.util.OldTimeZoneTest#test_getDisplayNameZILjava_util_Locale"
-},
-{
   description: "Differences between vogar and cts in user directory",
   result: EXEC_FAILED,
   modes: [device],