diff options
| author | 2016-03-17 19:19:15 -0700 | |
|---|---|---|
| committer | 2016-03-21 11:25:23 -0700 | |
| commit | 9894fc8079a5c6eb72e04099bdbd3239b75cf491 (patch) | |
| tree | e844552eb54f71bc320efe5ddee1d0aaeb277c5d | |
| parent | 7c06aef061fa176331b77a88c1ff2c6ae401a5f0 (diff) | |
Disable LZ4HC compressed images
Seem to get randomly compressed incorrectly on volantis. Added
verifiation in the image writer.
Using LZ4HC now silently uses LZ4. This is still safe since both use
the same decompression code.
Bug: 27560444
Change-Id: I652eee7498dc84994993be3a5b0447ec5b246304
| -rw-r--r-- | compiler/image_writer.cc | 15 | ||||
| -rw-r--r-- | runtime/class_linker.cc | 3 |
2 files changed, 16 insertions, 2 deletions
diff --git a/compiler/image_writer.cc b/compiler/image_writer.cc index 0b6981016d..07bd0e35db 100644 --- a/compiler/image_writer.cc +++ b/compiler/image_writer.cc @@ -229,6 +229,7 @@ bool ImageWriter::Write(int image_fd, CHECK_EQ(image_header->storage_mode_, image_storage_mode_); switch (image_storage_mode_) { + case ImageHeader::kStorageModeLZ4HC: // Fall-through. case ImageHeader::kStorageModeLZ4: { const size_t compressed_max_size = LZ4_compressBound(image_data_size); compressed_data.reset(new char[compressed_max_size]); @@ -239,6 +240,8 @@ bool ImageWriter::Write(int image_fd, break; } + /* + * Disabled due to image_test64 flakyness. Both use same decompression. b/27560444 case ImageHeader::kStorageModeLZ4HC: { // Bound is same as non HC. const size_t compressed_max_size = LZ4_compressBound(image_data_size); @@ -249,6 +252,7 @@ bool ImageWriter::Write(int image_fd, image_data_size); break; } + */ case ImageHeader::kStorageModeUncompressed: { data_size = image_data_size; image_data_to_write = image_data; @@ -264,6 +268,16 @@ bool ImageWriter::Write(int image_fd, image_data_to_write = &compressed_data[0]; VLOG(compiler) << "Compressed from " << image_data_size << " to " << data_size << " in " << PrettyDuration(NanoTime() - compress_start_time); + if (kIsDebugBuild) { + std::unique_ptr<uint8_t[]> temp(new uint8_t[image_data_size]); + const size_t decompressed_size = LZ4_decompress_safe( + reinterpret_cast<char*>(&compressed_data[0]), + reinterpret_cast<char*>(&temp[0]), + data_size, + image_data_size); + CHECK_EQ(decompressed_size, image_data_size); + CHECK_EQ(memcmp(image_data, &temp[0], image_data_size), 0) << image_storage_mode_; + } } // Write out the image + fields + methods. @@ -2024,7 +2038,6 @@ void ImageWriter::CopyAndFixupMethod(ArtMethod* orig, memcpy(copy, orig, ArtMethod::Size(target_ptr_size_)); copy->SetDeclaringClass(GetImageAddress(orig->GetDeclaringClassUnchecked())); - ArtMethod** orig_resolved_methods = orig->GetDexCacheResolvedMethods(target_ptr_size_); copy->SetDexCacheResolvedMethods(NativeLocationInImage(orig_resolved_methods), target_ptr_size_); GcRoot<mirror::Class>* orig_resolved_types = orig->GetDexCacheResolvedTypes(target_ptr_size_); diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc index d8e309d57e..271b7c97b3 100644 --- a/runtime/class_linker.cc +++ b/runtime/class_linker.cc @@ -760,7 +760,8 @@ static void SanityCheckArtMethod(ArtMethod* m, const std::vector<gc::space::ImageSpace*>& spaces) SHARED_REQUIRES(Locks::mutator_lock_) { if (m->IsRuntimeMethod()) { - CHECK(m->GetDeclaringClass() == nullptr) << PrettyMethod(m); + mirror::Class* declaring_class = m->GetDeclaringClassUnchecked(); + CHECK(declaring_class == nullptr) << declaring_class << " " << PrettyMethod(m); } else if (m->IsCopied()) { CHECK(m->GetDeclaringClass() != nullptr) << PrettyMethod(m); } else if (expected_class != nullptr) { |