Skip to content

Commit 5af3d41

Browse files
committed
Fix #548: use identityHashCode for better performance
The two related Java issues are marked as resolved: - https://bugs.openjdk.java.net/browse/JDK-8068239 - https://bugs.openjdk.java.net/browse/JDK-8130042 There are no actual fix, but it's mentioned not reproducible.
1 parent c165638 commit 5af3d41

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

library/src/dotty/runtime/LazyVals.scala

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@ object LazyVals {
2626
Array.tabulate(base)(_ => new Object)
2727

2828
private def getMonitor(obj: Object, fieldId: Int = 0) = {
29-
var id = (
30-
/*java.lang.System.identityHashCode(obj) + */ // should be here, but #548
31-
fieldId) % base
29+
var id = (java.lang.System.identityHashCode(obj) + fieldId) % base
3230

3331
if (id < 0) id += base
3432
monitors(id)

0 commit comments

Comments
 (0)