Revert^4 "Allow deoptimization when returning from a runtime method."

This reverts commit 07c7028e518b98d3267a77dfe0d149db1adbe858.

Need some special treatment of string init's shorty.

Test: run-test/gtest on both host and target
Test: 597-deopt-busy-loop, 597-deopt-invoke-stub
Bug: 33616143
Change-Id: Id4c64910acfdd088835b6db6fc503e6ade0218e7
diff --git a/runtime/entrypoints/quick/quick_deoptimization_entrypoints.cc b/runtime/entrypoints/quick/quick_deoptimization_entrypoints.cc
index 53f0727..5f40711 100644
--- a/runtime/entrypoints/quick/quick_deoptimization_entrypoints.cc
+++ b/runtime/entrypoints/quick/quick_deoptimization_entrypoints.cc
@@ -73,7 +73,11 @@
   // Before deoptimizing to interpreter, we must push the deoptimization context.
   JValue return_value;
   return_value.SetJ(0);  // we never deoptimize from compiled code with an invoke result.
-  self->PushDeoptimizationContext(return_value, false, /* from_code */ true, self->GetException());
+  self->PushDeoptimizationContext(return_value,
+                                  false /* is_reference */,
+                                  self->GetException(),
+                                  true /* from_code */,
+                                  DeoptimizationMethodType::kDefault);
   artDeoptimizeImpl(self, kind, true);
 }
 
diff --git a/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc b/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc
index c6abd28..7b83f20 100644
--- a/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc
+++ b/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc
@@ -744,7 +744,11 @@
 
     ObjPtr<mirror::Throwable> pending_exception;
     bool from_code = false;
-    self->PopDeoptimizationContext(&result, &pending_exception, /* out */ &from_code);
+    DeoptimizationMethodType method_type;
+    self->PopDeoptimizationContext(/* out */ &result,
+                                   /* out */ &pending_exception,
+                                   /* out */ &from_code,
+                                   /* out */ &method_type);
 
     // Push a transition back into managed code onto the linked list in thread.
     self->PushManagedStackFragment(&fragment);
@@ -771,7 +775,11 @@
     if (pending_exception != nullptr) {
       self->SetException(pending_exception);
     }
-    interpreter::EnterInterpreterFromDeoptimize(self, deopt_frame, from_code, &result);
+    interpreter::EnterInterpreterFromDeoptimize(self,
+                                                deopt_frame,
+                                                &result,
+                                                from_code,
+                                                DeoptimizationMethodType::kDefault);
   } else {
     const char* old_cause = self->StartAssertNoThreadSuspension(
         "Building interpreter shadow frame");
@@ -823,7 +831,11 @@
       // Push the context of the deoptimization stack so we can restore the return value and the
       // exception before executing the deoptimized frames.
       self->PushDeoptimizationContext(
-          result, shorty[0] == 'L', /* from_code */ false, self->GetException());
+          result,
+          shorty[0] == 'L' || shorty[0] == '[',  /* class or array */
+          self->GetException(),
+          false /* from_code */,
+          DeoptimizationMethodType::kDefault);
 
       // Set special exception to cause deoptimization.
       self->SetException(Thread::GetDeoptimizationException());
@@ -1041,7 +1053,8 @@
   CHECK(!self->IsExceptionPending()) << "Enter instrumentation exit stub with pending exception "
                                      << self->GetException()->Dump();
   // Compute address of return PC and sanity check that it currently holds 0.
-  size_t return_pc_offset = GetCalleeSaveReturnPcOffset(kRuntimeISA, CalleeSaveType::kSaveRefsOnly);
+  size_t return_pc_offset = GetCalleeSaveReturnPcOffset(kRuntimeISA,
+                                                        CalleeSaveType::kSaveEverything);
   uintptr_t* return_pc = reinterpret_cast<uintptr_t*>(reinterpret_cast<uint8_t*>(sp) +
                                                       return_pc_offset);
   CHECK_EQ(*return_pc, 0U);