String Compression (interpreter only) bug fix
String with length 0 considered to be compressible,
so the length should be -2147483648 or -(1 << 31).
Change-Id: Ie71f17a0e66efe9a65a8a76d4cee776db636550f
diff --git a/runtime/mirror/string-inl.h b/runtime/mirror/string-inl.h
index 86e5139..aea6ff1 100644
--- a/runtime/mirror/string-inl.h
+++ b/runtime/mirror/string-inl.h
@@ -245,8 +245,9 @@
template <bool kIsInstrumented>
inline String* String::AllocEmptyString(Thread* self, gc::AllocatorType allocator_type) {
- SetStringCountVisitor visitor(0);
- return Alloc<kIsInstrumented>(self, 0, allocator_type, visitor);
+ const int32_t length_with_flag = String::GetFlaggedCount(0);
+ SetStringCountVisitor visitor(length_with_flag);
+ return Alloc<kIsInstrumented>(self, length_with_flag, allocator_type, visitor);
}
template <bool kIsInstrumented>