Reland^3 "Don't use AOT code for native methods for java debuggable runtime"

This reverts commit fb1b08cbb9c6ac149d75de16c14fdaa8b68baaa4.

Reason for revert: Reland after a fix. We had to update untagging in jni_dlsym_lookup_stub as well.

Change-Id: Id936e9e60f9e87e96f1a9a79cd2118631ad1616b
diff --git a/compiler/utils/jni_macro_assembler.h b/compiler/utils/jni_macro_assembler.h
index 7022e3d..c8c713a 100644
--- a/compiler/utils/jni_macro_assembler.h
+++ b/compiler/utils/jni_macro_assembler.h
@@ -126,7 +126,11 @@
   virtual void StoreStackOffsetToThread(ThreadOffset<kPointerSize> thr_offs,
                                         FrameOffset fr_offs) = 0;
 
-  virtual void StoreStackPointerToThread(ThreadOffset<kPointerSize> thr_offs) = 0;
+  // Stores stack pointer by tagging it if required so we can walk the stack. In debuggable runtimes
+  // we use tag to tell if we are using JITed code or AOT code. In non-debuggable runtimes we never
+  // use JITed code when AOT code is present. So checking for AOT code is sufficient to detect which
+  // code is being executed. We avoid tagging in non-debuggable runtimes to reduce instructions.
+  virtual void StoreStackPointerToThread(ThreadOffset<kPointerSize> thr_offs, bool tag_sp) = 0;
 
   virtual void StoreSpanning(FrameOffset dest,
                              ManagedRegister src,