Skip to content

Commit 1129592

Browse files
Elena LepilkinaLepilkinaElena
authored andcommitted
Rewrote deprecated things and add consistency with compiler flags
1 parent ddf53bf commit 1129592

File tree

2 files changed

+34
-9
lines changed

2 files changed

+34
-9
lines changed

plugin/main/src/kotlinx/benchmark/gradle/NativeSourceGeneratorTask.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ abstract class NativeSourceGeneratorWorker : WorkAction<NativeSourceGeneratorWor
7979
override fun execute() {
8080
cleanup(parameters.outputSourcesDir)
8181
cleanup(parameters.outputResourcesDir)
82+
parameters.inputClassesDirs
8283
parameters.inputClassesDirs
8384
.filter { it.exists() && it.name.endsWith(KLIB_FILE_EXTENSION_WITH_DOT) }
8485
.forEach { lib ->
Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,37 @@
11
package kotlinx.benchmark
22

33
actual class Blackhole {
4-
actual fun consume(obj: Any?) {}
5-
actual fun consume(bool: Boolean) {}
6-
actual fun consume(c: Char) {}
7-
actual fun consume(b: Byte) {}
8-
actual fun consume(s: Short) {}
9-
actual fun consume(i: Int) {}
10-
actual fun consume(l: Long) {}
11-
actual fun consume(f: Float) {}
12-
actual fun consume(d: Double) {}
4+
@ThreadLocal
5+
companion object {
6+
var consumer = 0
7+
}
8+
actual fun consume(obj: Any?) {
9+
// hashCode now is implemented as taking address of object, so it's suitable now.
10+
// If implementation is changed `Blackhole` should be reimplemented.
11+
consumer += obj.hashCode()
12+
}
13+
actual fun consume(bool: Boolean) {
14+
consumer += bool.hashCode()
15+
}
16+
actual fun consume(c: Char) {
17+
consumer += c.hashCode()
18+
}
19+
actual fun consume(b: Byte) {
20+
consumer += b.hashCode()
21+
}
22+
actual fun consume(s: Short) {
23+
consumer += s.hashCode()
24+
}
25+
actual fun consume(i: Int) {
26+
consumer += i.hashCode()
27+
}
28+
actual fun consume(l: Long) {
29+
consumer += l.hashCode()
30+
}
31+
actual fun consume(f: Float) {
32+
consumer += f.hashCode()
33+
}
34+
actual fun consume(d: Double) {
35+
consumer += d.hashCode()
36+
}
1337
}

0 commit comments

Comments
 (0)