ART: Minor refactoring of JNI stub compilation.

Introduce JniCompiledMethod to avoid JNI compiler dependency
on CompiledMethod. This is done in preparation for compiling
JNI stubs in JIT as the CompiledMethod class should be used
exclusively for AOT compilation.

Test: m test-art-host-gtest
Bug: 65574695
Change-Id: I1d047d4aebc55057efb7ed3d39ea65600f5fb6ab
diff --git a/compiler/optimizing/optimizing_compiler.cc b/compiler/optimizing/optimizing_compiler.cc
index 095ca63..5a9e2c5 100644
--- a/compiler/optimizing/optimizing_compiler.cc
+++ b/compiler/optimizing/optimizing_compiler.cc
@@ -1133,12 +1133,20 @@
     }
   }
 
-  CompiledMethod* compiled_method = ArtQuickJniCompileMethod(GetCompilerDriver(),
-                                                             access_flags,
-                                                             method_idx,
-                                                             dex_file);
+  JniCompiledMethod jni_compiled_method = ArtQuickJniCompileMethod(
+      GetCompilerDriver(), access_flags, method_idx, dex_file);
   MaybeRecordStat(compilation_stats_.get(), MethodCompilationStat::kCompiledNativeStub);
-  return compiled_method;
+  return CompiledMethod::SwapAllocCompiledMethod(
+      GetCompilerDriver(),
+      jni_compiled_method.GetInstructionSet(),
+      jni_compiled_method.GetCode(),
+      jni_compiled_method.GetFrameSize(),
+      jni_compiled_method.GetCoreSpillMask(),
+      jni_compiled_method.GetFpSpillMask(),
+      /* method_info */ ArrayRef<const uint8_t>(),
+      /* vmap_table */ ArrayRef<const uint8_t>(),
+      jni_compiled_method.GetCfi(),
+      /* patches */ ArrayRef<const linker::LinkerPatch>());
 }
 
 Compiler* CreateOptimizingCompiler(CompilerDriver* driver) {