OSDN Git Service

Revert "Revert "Re-enable boot image string sharpening.""
authorVladimir Marko <vmarko@google.com>
Fri, 9 Sep 2016 09:16:31 +0000 (09:16 +0000)
committerVladimir Marko <vmarko@google.com>
Fri, 9 Sep 2016 09:16:31 +0000 (09:16 +0000)
The reason for the revert was a transaction bug fixed by
    https://android-review.googlesource.com/271008

Bug: 20323084
Bug: 31239436

This reverts commit f508c565b13585a766719b87a00e3c2a4200abe0.

Change-Id: I2f5995b55ccbf58b888db3f0ab64d6186e400a92

compiler/optimizing/sharpening.cc

index 6effc30..40fff8a 100644 (file)
@@ -295,7 +295,15 @@ void HSharpening::ProcessLoadString(HLoadString* load_string) {
       DCHECK(!runtime->UseJitCompilation());
       mirror::String* string = class_linker->ResolveString(dex_file, string_index, dex_cache);
       CHECK(string != nullptr);
-      // TODO: In follow up CL, add PcRelative and Address back in.
+      if (compiler_driver_->GetSupportBootImageFixup()) {
+        DCHECK(ContainsElement(compiler_driver_->GetDexFilesForOatFile(), &dex_file));
+        desired_load_kind = codegen_->GetCompilerOptions().GetCompilePic()
+            ? HLoadString::LoadKind::kBootImageLinkTimePcRelative
+            : HLoadString::LoadKind::kBootImageLinkTimeAddress;
+      } else {
+        // MIPS64 or compiler_driver_test. Do not sharpen.
+        DCHECK_EQ(desired_load_kind, HLoadString::LoadKind::kDexCacheViaMethod);
+      }
     } else if (runtime->UseJitCompilation()) {
       // TODO: Make sure we don't set the "compile PIC" flag for JIT as that's bogus.
       // DCHECK(!codegen_->GetCompilerOptions().GetCompilePic());