From d376d084386a94d0cfd54830f15f387865cd6313 Mon Sep 17 00:00:00 2001 From: Sergey Bogolepov Date: Wed, 18 Jul 2018 18:23:42 +0700 Subject: [PATCH] Marked global mutable state in the benchmark as thread local --- performance/src/main/kotlin-jvm/FakeKonanNamespace.kt | 5 +++++ performance/src/main/kotlin/org/jetbrains/ring/Utils.kt | 2 ++ 2 files changed, 7 insertions(+) create mode 100644 performance/src/main/kotlin-jvm/FakeKonanNamespace.kt diff --git a/performance/src/main/kotlin-jvm/FakeKonanNamespace.kt b/performance/src/main/kotlin-jvm/FakeKonanNamespace.kt new file mode 100644 index 00000000000..0e09a23a64e --- /dev/null +++ b/performance/src/main/kotlin-jvm/FakeKonanNamespace.kt @@ -0,0 +1,5 @@ +package org.jetbrains.ring + +class konan { + annotation class ThreadLocal +} \ No newline at end of file diff --git a/performance/src/main/kotlin/org/jetbrains/ring/Utils.kt b/performance/src/main/kotlin/org/jetbrains/ring/Utils.kt index 166d8e961f9..4d8aaca0cae 100644 --- a/performance/src/main/kotlin/org/jetbrains/ring/Utils.kt +++ b/performance/src/main/kotlin/org/jetbrains/ring/Utils.kt @@ -21,6 +21,7 @@ import kotlin.system.measureNanoTime //-----------------------------------------------------------------------------// class Blackhole { + @konan.ThreadLocal companion object { var consumer = 0 fun consume(value: Any) { @@ -32,6 +33,7 @@ class Blackhole { //-----------------------------------------------------------------------------// class Random() { + @konan.ThreadLocal companion object { var seedInt = 0 fun nextInt(boundary: Int = 100): Int {