Merge "Disable virtual call sharpening." into dalvik-dev
diff --git a/src/compiler.cc b/src/compiler.cc
index 2ba89d4..332ea25 100644
--- a/src/compiler.cc
+++ b/src/compiler.cc
@@ -597,7 +597,9 @@
           referrer_class->CanAccessMember(methods_class,
                                           resolved_method->GetAccessFlags())) {
         vtable_idx = resolved_method->GetMethodIndex();
-        if (type == kVirtual && (resolved_method->IsFinal() || methods_class->IsFinal())) {
+        const bool kEnableSharpening = false;
+        if (kEnableSharpening && type == kVirtual &&
+            (resolved_method->IsFinal() || methods_class->IsFinal())) {
           stats_->ResolvedMethod(kVirtual);
           // Sharpen a virtual call into a direct call. The method_idx is into referrer's
           // dex cache, check that this resolved method is where we expect it.
diff --git a/src/thread.cc b/src/thread.cc
index 2f3ce6a..48b8645 100644
--- a/src/thread.cc
+++ b/src/thread.cc
@@ -1174,7 +1174,8 @@
 // TODO: remove this.
 uintptr_t DemanglePc(uintptr_t pc) {
   // Revert mangling for the case where we need the PC to return to the upcall
-  return pc + 2;
+  if (pc > 0) { pc +=  2; }
+  return pc;
 }
 
 void Thread::PushSirt(StackIndirectReferenceTable* sirt) {
@@ -1532,9 +1533,11 @@
     }
   }
   SetException(exception);
+  CHECK_NE(catch_native_pc, 0u);
   long_jump_context->SetSP(reinterpret_cast<uintptr_t>(catch_finder.handler_frame_.GetSP()));
-  long_jump_context->SetPC(catch_finder.handler_pc_);
+  long_jump_context->SetPC(catch_native_pc);
   long_jump_context->DoLongJump();
+  LOG(FATAL) << "UNREACHABLE";
 }
 
 Context* Thread::GetLongJumpContext() {