Always produce PIC code for AOT compilation.

Change sharpening to use PIC load kinds for AOT compilation
and add "Jit" to the direct addressing load kind names. Use
PIC code also for the Integer.valueOf() intrinsic codegen.
Remove all support for non-PIC linker patches.

The dex2oat --compile-pic option is retained for now but
ignored by the compiler.

Test: m test-art-host-gtest
Test: testrunner.py --host --optimizing
Test: Pixel 2 XL boots.
Test: testrunner.py --target --optimizing
Bug: 77856493
Change-Id: I54d666f6522f160a1b6ece4045a15d19363acbb6
diff --git a/compiler/optimizing/sharpening.cc b/compiler/optimizing/sharpening.cc
index 27482ac..5c2f57e 100644
--- a/compiler/optimizing/sharpening.cc
+++ b/compiler/optimizing/sharpening.cc
@@ -63,10 +63,6 @@
   return false;
 }
 
-static bool AOTCanEmbedMethod(ArtMethod* method, const CompilerOptions& options) {
-  return IsInBootImage(method) && !options.GetCompilePic();
-}
-
 static bool BootImageAOTCanEmbedMethod(ArtMethod* method, const CompilerOptions& compiler_options) {
   DCHECK(compiler_options.IsBootImage());
   ScopedObjectAccess soa(Thread::Current());
@@ -120,11 +116,10 @@
       method_load_kind = HInvokeStaticOrDirect::MethodLoadKind::kBssEntry;
     }
     code_ptr_location = HInvokeStaticOrDirect::CodePtrLocation::kCallArtMethod;
-  } else if (Runtime::Current()->UseJitCompilation() ||
-             AOTCanEmbedMethod(callee, compiler_options)) {
+  } else if (Runtime::Current()->UseJitCompilation()) {
     // JIT or on-device AOT compilation referencing a boot image method.
     // Use the method address directly.
-    method_load_kind = HInvokeStaticOrDirect::MethodLoadKind::kDirectAddress;
+    method_load_kind = HInvokeStaticOrDirect::MethodLoadKind::kJitDirectAddress;
     method_load_data = reinterpret_cast<uintptr_t>(callee);
     code_ptr_location = HInvokeStaticOrDirect::CodePtrLocation::kCallArtMethod;
   } else if (IsInBootImage(callee)) {
@@ -199,8 +194,7 @@
       if (runtime->UseJitCompilation()) {
         DCHECK(!compiler_options.GetCompilePic());
         if (is_in_boot_image) {
-          // TODO: Use direct pointers for all non-moving spaces, not just boot image. Bug: 29530787
-          desired_load_kind = HLoadClass::LoadKind::kBootImageAddress;
+          desired_load_kind = HLoadClass::LoadKind::kJitBootImageAddress;
         } else if (klass != nullptr) {
           desired_load_kind = HLoadClass::LoadKind::kJitTableAddress;
         } else {
@@ -212,11 +206,7 @@
         }
       } else if (is_in_boot_image) {
         // AOT app compilation, boot image class.
-        if (codegen->GetCompilerOptions().GetCompilePic()) {
-          desired_load_kind = HLoadClass::LoadKind::kBootImageRelRo;
-        } else {
-          desired_load_kind = HLoadClass::LoadKind::kBootImageAddress;
-        }
+        desired_load_kind = HLoadClass::LoadKind::kBootImageRelRo;
       } else {
         // Not JIT and the klass is not in boot image.
         desired_load_kind = HLoadClass::LoadKind::kBssEntry;
@@ -348,7 +338,7 @@
       string = class_linker->LookupString(string_index, dex_cache.Get());
       if (string != nullptr) {
         if (runtime->GetHeap()->ObjectIsInBootImageSpace(string)) {
-          desired_load_kind = HLoadString::LoadKind::kBootImageAddress;
+          desired_load_kind = HLoadString::LoadKind::kJitBootImageAddress;
         } else {
           desired_load_kind = HLoadString::LoadKind::kJitTableAddress;
         }
@@ -359,11 +349,7 @@
       // AOT app compilation. Try to lookup the string without allocating if not found.
       string = class_linker->LookupString(string_index, dex_cache.Get());
       if (string != nullptr && runtime->GetHeap()->ObjectIsInBootImageSpace(string)) {
-        if (codegen->GetCompilerOptions().GetCompilePic()) {
-          desired_load_kind = HLoadString::LoadKind::kBootImageRelRo;
-        } else {
-          desired_load_kind = HLoadString::LoadKind::kBootImageAddress;
-        }
+        desired_load_kind = HLoadString::LoadKind::kBootImageRelRo;
       } else {
         desired_load_kind = HLoadString::LoadKind::kBssEntry;
       }