Assorted fixes for running frameworks apps
- Adding Heap::target_utililization_
- Convert ClassNotFoundError to ClassNotFoundException in Class.forName
- Finish String::GetHashCode
- Changed Runtime.gc to unimplemented
- Disable preload simulation in oat_process
- Empty native placeholder for org.apache.harmony.dalvik.ddmc.DdmServer
- Bonus: Fix problem with reflective invocation of constructors and private methods
Change-Id: If11b273e2f82e8e0fa7161a756098514e1156a19
diff --git a/src/object.cc b/src/object.cc
index e37b683..8bdc295 100644
--- a/src/object.cc
+++ b/src/object.cc
@@ -1273,11 +1273,14 @@
return Runtime::Current()->GetInternTable()->InternWeak(this);
}
-int32_t String::GetHashCode() const {
- int32_t result = GetField32(
- OFFSET_OF_OBJECT_MEMBER(String, hash_code_), false);
- DCHECK(result != 0 ||
- ComputeUtf16Hash(GetCharArray(), GetOffset(), GetLength()) == 0);
+int32_t String::GetHashCode() {
+ int32_t result = GetField32(OFFSET_OF_OBJECT_MEMBER(String, hash_code_), false);
+ if (result == 0) {
+ ComputeHashCode();
+ }
+ result = GetField32(OFFSET_OF_OBJECT_MEMBER(String, hash_code_), false);
+ DCHECK(result != 0 || ComputeUtf16Hash(GetCharArray(), GetOffset(), GetLength()) == 0)
+ << ToModifiedUtf8() << " " << result;
return result;
}