Skip to content

Commit 185c842

Browse files
authored
Merge pull request #6592 from dotty-staging/fix-548
Fix #548: use identityHashCode for better performance
2 parents bf89558 + 5af3d41 commit 185c842

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)