Merge "ART: Add a test checking TLS offsets and entrypoints"
diff --git a/oatdump/oatdump.cc b/oatdump/oatdump.cc
index 7c76b3c..183f667 100644
--- a/oatdump/oatdump.cc
+++ b/oatdump/oatdump.cc
@@ -364,44 +364,40 @@
                        class_method_index, PrettyMethod(dex_method_idx, dex_file, true).c_str(),
                        dex_method_idx);
     Indenter indent1_filter(os.rdbuf(), kIndentChar, kIndentBy1Count);
-    std::ostream indent1_os(&indent1_filter);
+    std::unique_ptr<std::ostream> indent1_os(new std::ostream(&indent1_filter));
+    Indenter indent2_filter(indent1_os->rdbuf(), kIndentChar, kIndentBy1Count);
+    std::unique_ptr<std::ostream> indent2_os(new std::ostream(&indent2_filter));
     {
-      indent1_os << "DEX CODE:\n";
-      Indenter indent2_filter(indent1_os.rdbuf(), kIndentChar, kIndentBy1Count);
-      std::ostream indent2_os(&indent2_filter);
-      DumpDexCode(indent2_os, dex_file, code_item);
+      *indent1_os << "DEX CODE:\n";
+      DumpDexCode(*indent2_os, dex_file, code_item);
     }
     if (Runtime::Current() != NULL) {
-      indent1_os << "VERIFIER TYPE ANALYSIS:\n";
-      Indenter indent2_filter(indent1_os.rdbuf(), kIndentChar, kIndentBy1Count);
-      std::ostream indent2_os(&indent2_filter);
-      DumpVerifier(indent2_os, dex_method_idx, &dex_file, class_def, code_item,
+      *indent1_os << "VERIFIER TYPE ANALYSIS:\n";
+      DumpVerifier(*indent2_os, dex_method_idx, &dex_file, class_def, code_item,
                    method_access_flags);
     }
     {
-      indent1_os << "OAT DATA:\n";
-      Indenter indent2_filter(indent1_os.rdbuf(), kIndentChar, kIndentBy1Count);
-      std::ostream indent2_os(&indent2_filter);
+      *indent1_os << "OAT DATA:\n";
 
-      indent2_os << StringPrintf("frame_size_in_bytes: %zd\n", oat_method.GetFrameSizeInBytes());
-      indent2_os << StringPrintf("core_spill_mask: 0x%08x ", oat_method.GetCoreSpillMask());
-      DumpSpillMask(indent2_os, oat_method.GetCoreSpillMask(), false);
-      indent2_os << StringPrintf("\nfp_spill_mask: 0x%08x ", oat_method.GetFpSpillMask());
-      DumpSpillMask(indent2_os, oat_method.GetFpSpillMask(), true);
-      indent2_os << StringPrintf("\nvmap_table: %p (offset=0x%08x)\n",
-                                 oat_method.GetVmapTable(), oat_method.GetVmapTableOffset());
-      DumpVmap(indent2_os, oat_method);
-      indent2_os << StringPrintf("mapping_table: %p (offset=0x%08x)\n",
-                                 oat_method.GetMappingTable(), oat_method.GetMappingTableOffset());
+      *indent2_os << StringPrintf("frame_size_in_bytes: %zd\n", oat_method.GetFrameSizeInBytes());
+      *indent2_os << StringPrintf("core_spill_mask: 0x%08x ", oat_method.GetCoreSpillMask());
+      DumpSpillMask(*indent2_os, oat_method.GetCoreSpillMask(), false);
+      *indent2_os << StringPrintf("\nfp_spill_mask: 0x%08x ", oat_method.GetFpSpillMask());
+      DumpSpillMask(*indent2_os, oat_method.GetFpSpillMask(), true);
+      *indent2_os << StringPrintf("\nvmap_table: %p (offset=0x%08x)\n",
+                                  oat_method.GetVmapTable(), oat_method.GetVmapTableOffset());
+      DumpVmap(*indent2_os, oat_method);
+      *indent2_os << StringPrintf("mapping_table: %p (offset=0x%08x)\n",
+                                  oat_method.GetMappingTable(), oat_method.GetMappingTableOffset());
       if (dump_raw_mapping_table_) {
-        Indenter indent3_filter(indent2_os.rdbuf(), kIndentChar, kIndentBy1Count);
+        Indenter indent3_filter(indent2_os->rdbuf(), kIndentChar, kIndentBy1Count);
         std::ostream indent3_os(&indent3_filter);
         DumpMappingTable(indent3_os, oat_method);
       }
-      indent2_os << StringPrintf("gc_map: %p (offset=0x%08x)\n",
-                                 oat_method.GetNativeGcMap(), oat_method.GetNativeGcMapOffset());
+      *indent2_os << StringPrintf("gc_map: %p (offset=0x%08x)\n",
+                                  oat_method.GetNativeGcMap(), oat_method.GetNativeGcMapOffset());
       if (dump_raw_gc_map_) {
-        Indenter indent3_filter(indent2_os.rdbuf(), kIndentChar, kIndentBy1Count);
+        Indenter indent3_filter(indent2_os->rdbuf(), kIndentChar, kIndentBy1Count);
         std::ostream indent3_os(&indent3_filter);
         DumpGcMap(indent3_os, oat_method, code_item);
       }
@@ -413,13 +409,11 @@
         code = oat_method.GetPortableCode();
         code_size = oat_method.GetPortableCodeSize();
       }
-      indent1_os << StringPrintf("CODE: %p (offset=0x%08x size=%d)%s\n",
+      *indent1_os << StringPrintf("CODE: %p (offset=0x%08x size=%d)%s\n",
                                  code,
                                  oat_method.GetCodeOffset(),
                                  code_size,
                                  code != nullptr ? "..." : "");
-      Indenter indent2_filter(indent1_os.rdbuf(), kIndentChar, kIndentBy1Count);
-      std::ostream indent2_os(&indent2_filter);
 
       Runtime* runtime = Runtime::Current();
       if (runtime != nullptr) {
@@ -432,9 +426,9 @@
                                           code_item, dex_method_idx, nullptr, method_access_flags,
                                           true, true, true);
         verifier.Verify();
-        DumpCode(indent2_os, &verifier, oat_method, code_item);
+        DumpCode(*indent2_os, &verifier, oat_method, code_item);
       } else {
-        DumpCode(indent2_os, nullptr, oat_method, code_item);
+        DumpCode(*indent2_os, nullptr, oat_method, code_item);
       }
     }
   }
diff --git a/runtime/arch/arm/asm_support_arm.S b/runtime/arch/arm/asm_support_arm.S
index 594252a..c4f68af 100644
--- a/runtime/arch/arm/asm_support_arm.S
+++ b/runtime/arch/arm/asm_support_arm.S
@@ -26,7 +26,6 @@
 // Register holding Thread::Current().
 #define rSELF r9
 
-.cfi_sections   .debug_frame
 .syntax unified
 .arch armv7-a
 .thumb
diff --git a/runtime/arch/arm64/asm_support_arm64.S b/runtime/arch/arm64/asm_support_arm64.S
index b94375e..55de1ec 100644
--- a/runtime/arch/arm64/asm_support_arm64.S
+++ b/runtime/arch/arm64/asm_support_arm64.S
@@ -35,8 +35,6 @@
 #define xIP1 x17
 
 
-.cfi_sections   .debug_frame
-
 .macro ENTRY name
     .type \name, #function
     .global \name
diff --git a/runtime/arch/mips/quick_entrypoints_mips.S b/runtime/arch/mips/quick_entrypoints_mips.S
index 96e0afd..ada1523 100644
--- a/runtime/arch/mips/quick_entrypoints_mips.S
+++ b/runtime/arch/mips/quick_entrypoints_mips.S
@@ -496,8 +496,8 @@
     move  $s1, $a3              # move managed thread pointer into s1
     addiu $s0, $zero, SUSPEND_CHECK_INTERVAL  # reset s0 to suspend check interval
     addiu $t0, $a2, 16          # create space for method pointer in frame
-    srl   $t0, $t0, 3           # shift the frame size right 3
-    sll   $t0, $t0, 3           # shift the frame size left 3 to align to 16 bytes
+    srl   $t0, $t0, 4           # shift the frame size right 4
+    sll   $t0, $t0, 4           # shift the frame size left 4 to align to 16 bytes
     subu  $sp, $sp, $t0         # reserve stack space for argument array
     addiu $a0, $sp, 4           # pass stack pointer + method ptr as dest for memcpy
     jal   memcpy                # (dest, src, bytes)
@@ -987,9 +987,9 @@
     lw      $t0, THREAD_EXCEPTION_OFFSET(rSELF) # load Thread::Current()->exception_
     RESTORE_REF_ONLY_CALLEE_SAVE_FRAME
     bnez    $t0, 1f
-    nop
+    mtc1    $v0, $f0               # place return value to FP return value
     jr      $ra
-    nop
+    mtc1    $v1, $f1               # place return value to FP return value
 1:
     DELIVER_PENDING_EXCEPTION
 END art_quick_proxy_invoke_handler
@@ -1039,9 +1039,9 @@
     lw      $t0, THREAD_EXCEPTION_OFFSET(rSELF) # load Thread::Current()->exception_
     RESTORE_REF_ONLY_CALLEE_SAVE_FRAME
     bnez    $t0, 1f
-    nop
+    mtc1    $v0, $f0               # place return value to FP return value
     jr      $ra
-    nop
+    mtc1    $v1, $f1               # place return value to FP return value
 1:
     DELIVER_PENDING_EXCEPTION
 END art_quick_to_interpreter_bridge