creating workflow for mirror::String compression
All-ASCII String characters are stored in 8-bit blocks
instead of 16-bit. The compression has not taken place, but all
workflow are in the code already (changing kUseStringCompression in
string.h file to TRUE will enable the feature)
Notes: Feature works on interpreter only without optimizing
Test art: m ART_TEST_INTERPRETER=true ART_TEST_OPTIMIZING=false
test-art-host
Also tested with String tests from libcore/:
1. libcore.java.lang.StringTest
2. libcore.java.lang.StringBufferTest
3. libcore.java.lang.StringBuilderTest
4. libcore.java.lang.OldStringTest
5. libcore.java.lang.OldStringBufferTest
Memory improvement is 33% (from 6.03% to 4.03%, total String memory
from all apps per total memory of all apps) measured on Angler
with Hprof tools
Bug: 31040547
Change-Id: I9cc92c265ebf1305fc06b5fc33efd83797660cce
diff --git a/compiler/image_test.cc b/compiler/image_test.cc
index 91579e9..e1ee0d2 100644
--- a/compiler/image_test.cc
+++ b/compiler/image_test.cc
@@ -188,6 +188,7 @@
}
uint64_t image_file_size;
+ size_t image_size;
{
std::unique_ptr<File> file(OS::OpenFileForReading(image_file.GetFilename().c_str()));
ASSERT_TRUE(file.get() != nullptr);
@@ -206,6 +207,7 @@
ASSERT_TRUE(space->IsMallocSpace());
image_file_size = file->GetLength();
+ image_size = image_header.GetImageSize();
}
ASSERT_TRUE(compiler_driver_->GetImageClasses() != nullptr);
@@ -255,10 +257,10 @@
ASSERT_TRUE(image_space != nullptr);
if (storage_mode == ImageHeader::kStorageModeUncompressed) {
// Uncompressed, image should be smaller than file.
- ASSERT_LE(image_space->Size(), image_file_size);
+ ASSERT_LE(image_size, image_file_size);
} else {
// Compressed, file should be smaller than image.
- ASSERT_LE(image_file_size, image_space->Size());
+ ASSERT_LE(image_file_size, image_size);
}
image_space->VerifyImageAllocations();