Use mmapped boot image intern table for PIC app HLoadString.

Implement new HLoadString load kind for boot image strings
referenced by PIC-compiled apps (i.e. prebuilts) that uses
PC-relative load from a boot image InternTable mmapped into
the apps .bss. This reduces the size of the PIC prebuilts
that reference boot image strings compared to the kBssEntry
as we can completely avoid the slow path and stack map.

We separate the InternedStrings and ClassTable sections of
the boot image (.art) file from the rest, aligning the
start of the InternedStrings section to a page boundary.
This may actually increase the size of the boot image file
by a page but it also allows mprotecting() these tables as
read-only. The ClassTable section is included in
anticipation of a similar load kind for HLoadClass.

Prebuilt services.odex for aosp_angler-userdebug (arm64):
  - before: 20862776
  - after: 20308512 (-541KiB)
Note that 92KiB savings could have been achieved by simply
avoiding the read barrier, similar to the HLoadClass flag
IsInBootImage(). Such flag is now unnecessary.

Test: m test-art-host-gtest
Test: testrunner.py --host
Test: testrunner.py --host --pictest
Test: testrunner.py --target on Nexus 6P.
Test: testrunner.py --target --pictest on Nexus 6P.
Test: Nexus 6P boots.
Bug: 31951624
Change-Id: I5f2bf1fc0bb36a8483244317cfdfa69e192ef6c5
diff --git a/runtime/image.h b/runtime/image.h
index 42abffc..2b24087 100644
--- a/runtime/image.h
+++ b/runtime/image.h
@@ -19,6 +19,7 @@
 
 #include <string.h>
 
+#include "base/bit_utils.h"
 #include "base/enums.h"
 #include "globals.h"
 #include "mirror/object.h"
@@ -311,6 +312,22 @@
     return boot_image_size_ != 0u;
   }
 
+  uint32_t GetBootImageConstantTablesOffset() const {
+    // Interned strings table and class table for boot image are mmapped read only.
+    DCHECK(!IsAppImage());
+    const ImageSection& interned_strings = GetInternedStringsSection();
+    DCHECK_ALIGNED(interned_strings.Offset(), kPageSize);
+    return interned_strings.Offset();
+  }
+
+  uint32_t GetBootImageConstantTablesSize() const {
+    uint32_t start_offset = GetBootImageConstantTablesOffset();
+    const ImageSection& class_table = GetClassTableSection();
+    DCHECK_LE(start_offset, class_table.Offset());
+    size_t tables_size = class_table.Offset() + class_table.Size() - start_offset;
+    return RoundUp(tables_size, kPageSize);
+  }
+
   // Visit ArtMethods in the section starting at base. Includes runtime methods.
   // TODO: Delete base parameter if it is always equal to GetImageBegin.
   void VisitPackedArtMethods(ArtMethodVisitor* visitor,