< prev index next >

test/micro/org/openjdk/bench/vm/lang/LockUnlock.java

Print this page
rev 53382 : 8217368: AArch64: C2 recursive stack locking optimisation not triggered
Reviewed-by: duke

@@ -108,10 +108,22 @@
     @Benchmark
     public void testRecursiveSynchronization() {
         factorial = fact(10);
     }
 
+    /**
+     * Same as {@link #testRecursiveSynchronization()} but the first call
+     * to this method will generate the identity hashcode for this object
+     * which effectively disables biased locking as they occupy the same
+     * bits in the object header.
+     */
+    @Benchmark
+    public void testRecursiveSynchronizationNoBias() {
+        System.identityHashCode(this);
+        factorial = fact(10);
+    }
+
     private synchronized int fact(int n) {
         if (n == 0) {
             return 1;
         } else {
             return fact(n - 1) * n;
< prev index next >