修订版 | 0de562cd943004840b450deb71c5892a50da13d0 (tree) |
---|---|
时间 | 2013-12-17 02:07:32 |
作者 | llin4 <ling.lin@inte...> |
Commiter | Chih-Wei Huang |
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>
@@ -32,6 +32,9 @@ LOCAL_CFLAGS += -DARCH_VARIANT=\"$(dvm_arch_variant)\" | ||
32 | 32 | # Optional features. These may impact the size or performance of the VM. |
33 | 33 | # |
34 | 34 | |
35 | +# Houdini support | |
36 | +LOCAL_CFLAGS += -DMTERP_NO_UNALIGN_64 | |
37 | + | |
35 | 38 | # Make a debugging version when building the simulator (if not told |
36 | 39 | # otherwise) and when explicitly asked. |
37 | 40 | dvm_make_debug_vm := false |
@@ -1218,7 +1218,12 @@ void dvmThreadInterrupt(Thread* thread) | ||
1218 | 1218 | #ifndef WITH_COPYING_GC |
1219 | 1219 | u4 dvmIdentityHashCode(Object *obj) |
1220 | 1220 | { |
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); | |
1222 | 1227 | } |
1223 | 1228 | #else |
1224 | 1229 | /* |
@@ -274,6 +274,10 @@ struct ArrayObject : Object { | ||
274 | 274 | /* number of elements; immutable after init */ |
275 | 275 | u4 length; |
276 | 276 | |
277 | +#ifdef MTERP_NO_UNALIGN_64 | |
278 | + u4 dummy; /* padding to get 'contents' at offset 16 */ | |
279 | +#endif | |
280 | + | |
277 | 281 | /* |
278 | 282 | * Array contents; actual size is (length * sizeof(type)). This is |
279 | 283 | * declared as u8 so that the compiler inserts any necessary padding |