Android-x86
Fork
Donation

  • R/O
  • HTTP
  • SSH
  • HTTPS

dalvik: Commit

dalvik


Commit MetaInfo

Revision0de562cd943004840b450deb71c5892a50da13d0 (tree)
Time2013-12-17 02:07:32
Authorllin4 <ling.lin@inte...>
CommiterChih-Wei Huang

Log Message

dalvik: return positive hash code in Dalvik with Houdini

BZ: 29547

port from OTC https://otc-android.intel.com/gerrit/#/c/13089/

Make x86 version of Dalvik to always return positive hash code
when Houdini is enabled in the platform, to match
the ARM app's assumption on its native platform.
MiTalk fails without this fix.

Change-Id: I417c39cd7a40871078f0597c3beffefcfec49189
Orig-Change-Id: I4ce3436b2d4eb90abdffcdeb0b8a0e7ea96a94db
Signed-off-by: llin4 <ling.lin@intel.com>
Signed-off-by: Qiming Shi <qiming.shi@intel.com>

Change Summary

Incremental Difference

--- a/vm/Dvm.mk
+++ b/vm/Dvm.mk
@@ -32,6 +32,9 @@ LOCAL_CFLAGS += -DARCH_VARIANT=\"$(dvm_arch_variant)\"
3232 # Optional features. These may impact the size or performance of the VM.
3333 #
3434
35+# Houdini support
36+LOCAL_CFLAGS += -DMTERP_NO_UNALIGN_64
37+
3538 # Make a debugging version when building the simulator (if not told
3639 # otherwise) and when explicitly asked.
3740 dvm_make_debug_vm := false
--- a/vm/Sync.cpp
+++ b/vm/Sync.cpp
@@ -1218,7 +1218,12 @@ void dvmThreadInterrupt(Thread* thread)
12181218 #ifndef WITH_COPYING_GC
12191219 u4 dvmIdentityHashCode(Object *obj)
12201220 {
1221- return (u4)obj;
1221+ /*
1222+ * The following assumes that objects are allocated at even boundaries, so
1223+ * the shift preserves uniqueness of hashCode() while guaranteeing a
1224+ * non-negative result (for the convenience of some applications,like MiTalk).
1225+ */
1226+ return (u4)(((u4)obj)>>1);
12221227 }
12231228 #else
12241229 /*
--- a/vm/oo/Object.h
+++ b/vm/oo/Object.h
@@ -274,6 +274,10 @@ struct ArrayObject : Object {
274274 /* number of elements; immutable after init */
275275 u4 length;
276276
277+#ifdef MTERP_NO_UNALIGN_64
278+ u4 dummy; /* padding to get 'contents' at offset 16 */
279+#endif
280+
277281 /*
278282 * Array contents; actual size is (length * sizeof(type)). This is
279283 * declared as u8 so that the compiler inserts any necessary padding
Show on old repository browser