changeset 200:912eff52db80

Blackhole: reset the TLR state after the mask adjustment. This gets us more repeatable behavior vs. multiple consume()-s.
author shade
date Wed, 09 Oct 2013 15:45:14 +0400
parents ca90e70f3831
children 9954a543d607
files jmh-core/src/main/java/org/openjdk/jmh/logic/BlackHole.java
diffstat 1 files changed, 8 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/jmh-core/src/main/java/org/openjdk/jmh/logic/BlackHole.java	Wed Oct 09 15:34:06 2013 +0400
+++ b/jmh-core/src/main/java/org/openjdk/jmh/logic/BlackHole.java	Wed Oct 09 15:45:14 2013 +0400
@@ -210,12 +210,14 @@
         long tlr = this.tlr;
         long tlrMask = this.tlrMask;
 
-        this.tlr = (tlr * 6364136223846793005L + 1442695040888963407L);
+        tlr = (tlr * 6364136223846793005L + 1442695040888963407L);
         if ((tlr & tlrMask) == 0) {
             // SHOULD ALMOST NEVER HAPPEN IN MEASUREMENT
+            this.obj1 = obj;
             this.tlrMask = (tlrMask << 1) + 1;
-            this.obj1 = obj;
+            tlr = 0;
         }
+        this.tlr = tlr;
     }
 
     /**
@@ -228,12 +230,14 @@
         long tlr = this.tlr;
         long tlrMask = this.tlrMask;
 
-        this.tlr = (tlr * 6364136223846793005L + 1442695040888963407L);
+        tlr = (tlr * 6364136223846793005L + 1442695040888963407L);
         if ((tlr & tlrMask) == 0) {
             // SHOULD ALMOST NEVER HAPPEN IN MEASUREMENT
+            this.objs1 = objs;
             this.tlrMask = (tlrMask << 1) + 1;
-            this.objs1 = objs;
+            tlr = 0;
         }
+        this.tlr = tlr;
     }
 
     /**