From 3aaa37bba53d6df0265793de48b4b0b57327e57a Mon Sep 17 00:00:00 2001 From: jessicahandojo Date: Fri, 29 Jul 2016 14:46:37 -0700 Subject: 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 --- runtime/interpreter/interpreter_switch_impl.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'runtime/interpreter/interpreter_switch_impl.cc') diff --git a/runtime/interpreter/interpreter_switch_impl.cc b/runtime/interpreter/interpreter_switch_impl.cc index a6349fcf88..582fc9b438 100644 --- a/runtime/interpreter/interpreter_switch_impl.cc +++ b/runtime/interpreter/interpreter_switch_impl.cc @@ -477,8 +477,7 @@ JValue ExecuteSwitchImpl(Thread* self, const DexFile::CodeItem* code_item, if (LIKELY(c != nullptr)) { if (UNLIKELY(c->IsStringClass())) { gc::AllocatorType allocator_type = Runtime::Current()->GetHeap()->GetCurrentAllocator(); - mirror::SetStringCountVisitor visitor(0); - obj = String::Alloc(self, 0, allocator_type, visitor); + obj = mirror::String::AllocEmptyString(self, allocator_type); } else { obj = AllocObjectFromCode( inst->VRegB_21c(), shadow_frame.GetMethod(), self, -- cgit v1.2.3-59-g8ed1b