Use resolve-startup-const-strings=true for run tests

Get extra test coverage for the feature.

Fixed DCHECK in image writer since there may be more preresolved
strings than the NumStrings.

Added no-inline to test 137 to fix inlining that started happening
causing a failure.

Test: test/run-test --always-clean --dex2oat-jobs 4 --host --prebuild --compact-dex-level fast --jit --no-relocate --runtime-option -Xcheck:jni --64 968-default-partial-compile-gen
Test: test-art-host
Bug: 123377072
Bug: 124377920

Change-Id: Ic9034a1e2a55a0bb1e5776b9073e37955009948c
diff --git a/dex2oat/linker/image_writer.cc b/dex2oat/linker/image_writer.cc
index 15ced72..2fdae30 100644
--- a/dex2oat/linker/image_writer.cc
+++ b/dex2oat/linker/image_writer.cc
@@ -471,7 +471,9 @@
           size_t string_info_collected = 0;
 
           ObjPtr<mirror::DexCache> dex_cache = object->AsDexCache();
-          DCHECK_LE(visitor.GetDexCacheStringRefCount(), dex_cache->NumStrings());
+          // Both of the dex cache string arrays are visited, so add up the total in the check.
+          DCHECK_LE(visitor.GetDexCacheStringRefCount(),
+                    dex_cache->NumPreResolvedStrings() + dex_cache->NumStrings());
 
           for (uint32_t index = 0; index < dex_cache->NumStrings(); ++index) {
             // GetResolvedString() can't be used here due to the circular
diff --git a/test/137-cfi/cfi.cc b/test/137-cfi/cfi.cc
index 0cb220e..4d886f5 100644
--- a/test/137-cfi/cfi.cc
+++ b/test/137-cfi/cfi.cc
@@ -149,7 +149,7 @@
   std::vector<std::string> seq = {
       "Java_Main_unwindInProcess",       // This function.
       "java.util.Arrays.binarySearch0",  // Framework method.
-      "Base.runTest",                    // Method in other dex file.
+      "Base.$noinline$runTest",          // Method in other dex file.
       "Main.main"                        // The Java entry method.
   };
 
@@ -239,7 +239,7 @@
     std::vector<std::string> seq = {
         "Java_Main_sigstop",                // The stop function in the other process.
         "java.util.Arrays.binarySearch0",   // Framework method.
-        "Base.runTest",                     // Method in other dex file.
+        "Base.$noinline$runTest",           // Method in other dex file.
         "Main.main"                         // The Java entry method.
     };
 
diff --git a/test/137-cfi/src-multidex/Base.java b/test/137-cfi/src-multidex/Base.java
index 986a3c2..6b9282c 100644
--- a/test/137-cfi/src-multidex/Base.java
+++ b/test/137-cfi/src-multidex/Base.java
@@ -15,7 +15,7 @@
  */
 
 public abstract class Base {
-  public void runTest() throws Exception {
+  public void $noinline$runTest() throws Exception {
     // Conditionally throw exception to prevent the compiler from inlining the code.
     if (!this.getClass().getName().equals("Main")) {
       throw new Exception("Who is calling?");
diff --git a/test/137-cfi/src/Main.java b/test/137-cfi/src/Main.java
index 5b32d8e..ed5f332 100644
--- a/test/137-cfi/src/Main.java
+++ b/test/137-cfi/src/Main.java
@@ -46,7 +46,7 @@
       }
 
       // Call test() via base class to test unwinding through multidex.
-      new Main().runTest();
+      new Main().$noinline$runTest();
   }
 
   public void test() {
diff --git a/test/etc/run-test-jar b/test/etc/run-test-jar
index 7ed1236..0fe148f 100755
--- a/test/etc/run-test-jar
+++ b/test/etc/run-test-jar
@@ -825,7 +825,7 @@
   mkdir_locations="${mkdir_locations} ${DEX_LOCATION}/oat/$ISA"
   if [ "$APP_IMAGE" = "y" ]; then
     # Pick a base that will force the app image to get relocated.
-    app_image="--base=0x4000 --app-image-file=$DEX_LOCATION/oat/$ISA/$TEST_NAME.art"
+    app_image="--base=0x4000 --app-image-file=$DEX_LOCATION/oat/$ISA/$TEST_NAME.art --resolve-startup-const-strings=true"
   fi
 
   dex2oat_binary=${DEX2OAT_DEBUG_BINARY}