On monitor-exit, we must unlock all the registers which purport to
be locked at the current lock depth. These are lock aliases.
Bug:
20102779
Bug:
21169615
Bug:
21988678
Bug:
23300986
Change-Id: I6604871fc778d8f0ca9a99f6aad16a99ab62c599
} else {
reg_to_lock_depths_.erase(it);
}
+ // Need to unlock every register at the same lock depth. These are aliased locks.
+ uint32_t mask = 1 << depth;
+ for (auto& pair : reg_to_lock_depths_) {
+ if ((pair.second & mask) != 0) {
+ VLOG(verifier) << "Also unlocking " << pair.first;
+ pair.second ^= mask;
+ }
+ }
}
void ClearAllRegToLockDepths(size_t reg) {
b/20843113
b/23201502 (float)
b/23201502 (double)
+b/23300986
Done!
--- /dev/null
+.class public LB23300986;
+
+.super Ljava/lang/Object;
+
+.method public static runAliasAfterEnter(Ljava/lang/Object;)V
+ .registers 3
+ monitor-enter v2 # Lock on parameter
+ move-object v1, v2 # Copy parameter into v1, establishing an alias.
+ monitor-exit v1 # Unlock on alias
+ monitor-enter v2 # Do it again.
+ monitor-exit v1
+ return-void
+.end method
new NullPointerException(), null));
testCases.add(new TestCase("b/23201502 (double)", "B23201502", "runDouble", null,
new NullPointerException(), null));
+ testCases.add(new TestCase("b/23300986", "B23300986", "runAliasAfterEnter",
+ new Object[] { new Object() }, null, null));
}
public void runTests() {