diff options
author | Mathieu Chartier <mathieuc@google.com> | 2013-10-25 10:05:23 -0700 |
---|---|---|
committer | Mathieu Chartier <mathieuc@google.com> | 2013-10-29 12:14:36 -0700 |
commit | ad2541a59c00c2c69e8973088891a2b5257c9780 (patch) | |
tree | 523898cf039c5185352978e71a54fa3a2657a04c /runtime/native | |
parent | 9780099e445884d8bc9444c8c1261b02d80a26c7 (diff) | |
download | android_art-ad2541a59c00c2c69e8973088891a2b5257c9780.tar.gz android_art-ad2541a59c00c2c69e8973088891a2b5257c9780.tar.bz2 android_art-ad2541a59c00c2c69e8973088891a2b5257c9780.zip |
Fix object identity hash.
The object identity hash is now stored in the monitor word after
being computed. Hashes are computed by a pseudo random number
generator.
When we write the image, we eagerly compute object hashes to
prevent pages getting dirtied.
Bug: 8981901
Change-Id: Ic8edacbacb0afc7055fd740a52444929f88ed564
Diffstat (limited to 'runtime/native')
-rw-r--r-- | runtime/native/java_lang_System.cc | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/runtime/native/java_lang_System.cc b/runtime/native/java_lang_System.cc index 6674db2403..ea78e04702 100644 --- a/runtime/native/java_lang_System.cc +++ b/runtime/native/java_lang_System.cc @@ -339,6 +339,9 @@ static void System_arraycopyCharUnchecked(JNIEnv* env, jclass, jobject javaSrc, } static jint System_identityHashCode(JNIEnv* env, jclass, jobject javaObject) { + if (javaObject == nullptr) { + return 0; + } ScopedFastNativeObjectAccess soa(env); mirror::Object* o = soa.Decode<mirror::Object*>(javaObject); return static_cast<jint>(o->IdentityHashCode()); |