OSDN Git Service

Call ProcessStrings() in ImageWriter, fix prefix check.
authorVladimir Marko <vmarko@google.com>
Wed, 3 Dec 2014 14:35:54 +0000 (14:35 +0000)
committerVladimir Marko <vmarko@google.com>
Wed, 3 Dec 2014 17:31:20 +0000 (17:31 +0000)
ProcessStrings was missing due to bad conflict resolution
in cherry-pick
    https://android-review.googlesource.com/114971

The prefix check was broken by the "cherry-pick"
    https://android-review.googlesource.com/115445
where in addition to a simple cherry-pick, an additional
comment was addressed and an error slipped in.

Change-Id: I130d1d1a2995fd4a4c27c918c2a0dc38724ce68f

compiler/image_writer.cc

index 3b1d914..ab5c6c7 100644 (file)
@@ -77,6 +77,7 @@ bool ImageWriter::PrepareImageAddressSpace() {
     Thread::Current()->TransitionFromSuspendedToRunnable();
     PruneNonImageClasses();  // Remove junk
     ComputeLazyFieldsForImageClasses();  // Add useful information
+    ProcessStrings();
     Thread::Current()->TransitionFromRunnableToSuspended(kNative);
   }
   gc::Heap* heap = Runtime::Current()->GetHeap();
@@ -561,9 +562,9 @@ void ImageWriter::ProcessStrings() {
     bool is_prefix = false;
     if (it != existing_strings.end()) {
       CHECK_LE(length, it->second);
-      is_prefix = std::equal(combined_chars.begin() + it->first,
-                             combined_chars.begin() + it->first + it->second,
-                             combined_chars.begin() + new_string.first);
+      is_prefix = std::equal(combined_chars.begin() + new_string.first,
+                             combined_chars.begin() + new_string.first + new_string.second,
+                             combined_chars.begin() + it->first);
     }
     if (is_prefix) {
       // Shares a prefix, set the offset to where the new offset will be.