From ad2541a59c00c2c69e8973088891a2b5257c9780 Mon Sep 17 00:00:00 2001 From: Mathieu Chartier Date: Fri, 25 Oct 2013 10:05:23 -0700 Subject: 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 --- runtime/native/java_lang_System.cc | 3 +++ 1 file changed, 3 insertions(+) (limited to 'runtime/native/java_lang_System.cc') 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(javaObject); return static_cast(o->IdentityHashCode()); -- cgit v1.2.3-59-g8ed1b