diff options
-rw-r--r-- | libart/src/main/java/java/lang/Object.java | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/libart/src/main/java/java/lang/Object.java b/libart/src/main/java/java/lang/Object.java index 20fdbf9..5b820e3 100644 --- a/libart/src/main/java/java/lang/Object.java +++ b/libart/src/main/java/java/lang/Object.java @@ -274,10 +274,11 @@ public class Object { */ public int hashCode() { int lockWord = shadow$_monitor_; - final int lockWordMask = 0xC0000000; // Top 2 bits. + final int lockWordStateMask = 0xC0000000; // Top 2 bits. final int lockWordStateHash = 0x80000000; // Top 2 bits are value 2 (kStateHash). - if ((lockWord & lockWordMask) == lockWordStateHash) { - return lockWord & ~lockWordMask; + final int lockWordHashMask = 0x0FFFFFFF; // Low 28 bits. + if ((lockWord & lockWordStateMask) == lockWordStateHash) { + return lockWord & lockWordHashMask; } return System.identityHashCode(this); } |