Revert^2 "Add CodeInfo to JNI methods."

It has no stack maps. We only store the frame info there.

As a consequence of having CodeInfo, the JNI methods are
now classified as IsOptimized().

This does not have any real effect on .oat file size.

This reverts commit 564fa8a1f3e3c39793c9b146ed5f21650617dc3f.

Test: test-art-host-gtest
Test: test-art-target-gtest-jni_compiler_test32
Change-Id: Ic7a1949027d89ba97cfedfc8ea453f041193b6a7
diff --git a/runtime/jit/jit_code_cache.cc b/runtime/jit/jit_code_cache.cc
index 3d7fe89..fe154a9 100644
--- a/runtime/jit/jit_code_cache.cc
+++ b/runtime/jit/jit_code_cache.cc
@@ -734,7 +734,6 @@
                                           bool has_should_deoptimize_flag,
                                           const ArenaSet<ArtMethod*>&
                                               cha_single_implementation_list) {
-  DCHECK_NE(stack_map != nullptr, method->IsNative());
   DCHECK(!method->IsNative() || !osr);
   size_t alignment = GetInstructionSetAlignment(kRuntimeISA);
   // Ensure the header ends up at expected instruction alignment.
@@ -816,8 +815,6 @@
     // but below we still make the compiled code valid for the method.
     MutexLock mu(self, lock_);
     if (UNLIKELY(method->IsNative())) {
-      DCHECK(stack_map == nullptr);
-      DCHECK(roots_data == nullptr);
       auto it = jni_stubs_map_.find(JniStubKey(method));
       DCHECK(it != jni_stubs_map_.end())
           << "Entry inserted in NotifyCompilationOf() should be alive.";
diff --git a/runtime/oat.h b/runtime/oat.h
index 6c3cc20..01ef424 100644
--- a/runtime/oat.h
+++ b/runtime/oat.h
@@ -32,8 +32,8 @@
 class PACKED(4) OatHeader {
  public:
   static constexpr uint8_t kOatMagic[] = { 'o', 'a', 't', '\n' };
-  // Last oat version changed reason: Remove explicit size from CodeInfo.
-  static constexpr uint8_t kOatVersion[] = { '1', '5', '1', '\0' };
+  // Last oat version changed reason: Add CodeInfo for JNI methods.
+  static constexpr uint8_t kOatVersion[] = { '1', '5', '2', '\0' };
 
   static constexpr const char* kImageLocationKey = "image-location";
   static constexpr const char* kDex2OatCmdLineKey = "dex2oat-cmdline";
diff --git a/runtime/oat_quick_method_header.cc b/runtime/oat_quick_method_header.cc
index 52714f9..0b239c1 100644
--- a/runtime/oat_quick_method_header.cc
+++ b/runtime/oat_quick_method_header.cc
@@ -40,15 +40,15 @@
                                        bool abort_on_failure) const {
   const void* entry_point = GetEntryPoint();
   uint32_t sought_offset = pc - reinterpret_cast<uintptr_t>(entry_point);
-  if (IsOptimized()) {
+  if (method->IsNative()) {
+    return dex::kDexNoIndex;
+  } else {
+    DCHECK(IsOptimized());
     CodeInfo code_info(this);
     StackMap stack_map = code_info.GetStackMapForNativePcOffset(sought_offset);
     if (stack_map.IsValid()) {
       return stack_map.GetDexPc();
     }
-  } else {
-    DCHECK(method->IsNative());
-    return dex::kDexNoIndex;
   }
   if (abort_on_failure) {
     ScopedObjectAccess soa(Thread::Current());
diff --git a/runtime/stack.cc b/runtime/stack.cc
index 2fb8c41..e99cb1b 100644
--- a/runtime/stack.cc
+++ b/runtime/stack.cc
@@ -814,7 +814,10 @@
 
         if ((walk_kind_ == StackWalkKind::kIncludeInlinedFrames)
             && (cur_oat_quick_method_header_ != nullptr)
-            && cur_oat_quick_method_header_->IsOptimized()) {
+            && cur_oat_quick_method_header_->IsOptimized()
+            // JNI methods cannot have any inlined frames.
+            && !method->IsNative()) {
+          DCHECK_NE(cur_quick_frame_pc_, 0u);
           CodeInfo code_info(cur_oat_quick_method_header_);
           uint32_t native_pc_offset =
               cur_oat_quick_method_header_->NativeQuickPcOffset(cur_quick_frame_pc_);