Repository navigation
Replace synchronized(this) with lock-free initState in LazyList - #26100
Conversation
b77e7d7 to
32723dc
Compare
|
Does this need to be also done for |
Is interesting. For When adding a lazy val to an So adding a lazy val to an existing object triggers MiMa, the class initializer turns from public to private. It's safe to ignore, the method is only invoked by the JVM and it can be private. But it seems worth aligning to avoid the MiMa flag. |
|
IMO MiMa is just wrong here and should never report anything about |
b478e78 to
0135565
Compare
its the same file copy pasted with Seq parent type removed, so yeah :) |
eb6c14f to
c36851b
Compare
|
This seems to pass CI now. @natsukagami would you have time to provide the right capture annotations and |
JDK 23+ allocates `ObjectMonitor` instances in native memory eagerly in the single-threaded case under nested recursive synchronized blocks. This can lead to huge memory consumption while evaluating LazyLists. This commit replaces synchronized with a lock-free coordination.
8c1234a to
8af596f
Compare
natsukagami
left a comment
There was a problem hiding this comment.
I had a look at the CC annotations only.
Aside from my comments the rest seems good!
|
Thank you @natsukagami . @sjrd for rest? |
|
Should we port it to 3.9.1? I assume no, since it does break mima. |
JDK 23+ allocates
ObjectMonitorinstances in native memory eagerly in the single-threaded case under nested recursive synchronized blocks.This can lead to huge memory consumption while evaluating LazyLists.
This commit replaces
synchronizedwith a lock-free coordination.Forward-port of scala/scala#11242.
Fixes #25777
How much have you relied on LLM-based tools in this contribution?
Moderately, for diagnosing the issue, reviewing my code, writing tests.
How was the solution tested?