* Merged with default branch at rev 16f3633aaa5a.
[cacao.git] / src / native / vm / gnu / java_lang_VMSystem.c
index 6e3debeaa87937f2f460326464b7ad200bc68b74..2200d444940f375c909dde8cb31c9f31f57a7211 100644 (file)
 
 #include "vm/types.h"
 
+#include "mm/gc-common.h"
+
 #include "native/jni.h"
+#include "native/llni.h"
 #include "native/native.h"
 
 #include "native/include/java_lang_Object.h"
@@ -86,7 +89,19 @@ JNIEXPORT void JNICALL Java_java_lang_VMSystem_arraycopy(JNIEnv *env, jclass cla
  */
 JNIEXPORT s4 JNICALL Java_java_lang_VMSystem_identityHashCode(JNIEnv *env, jclass clazz, java_lang_Object *o)
 {
-       return (s4) ((ptrint) o);
+       s4 hashcode;
+
+       LLNI_CRITICAL_START;
+
+#if defined(ENABLE_GC_CACAO)
+       hashcode = heap_get_hashcode(LLNI_UNWRAP((java_handle_t *) o));
+#else
+       hashcode = (s4) ((ptrint) o);
+#endif
+
+       LLNI_CRITICAL_END;
+
+       return hashcode;
 }