File tree 2 files changed +14
-2
lines changed
src/dotty/tools/dotc/transform
2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -369,8 +369,9 @@ class LambdaLift extends MiniPhase with IdentityDenotTransformer { thisTransform
369
369
// though the second condition seems weird, it's not true for symbols which are defined in some
370
370
// weird combinations of super calls.
371
371
(encClass, EmptyFlags )
372
- } else
373
- (topClass, JavaStatic )
372
+ } else if (encClass.is(ModuleClass , butNot = Package ) && encClass.isStatic) // needed to not cause deadlocks in classloader. see t5375.scala
373
+ (encClass, EmptyFlags )
374
+ else (topClass, JavaStatic )
374
375
}
375
376
else (lOwner, EmptyFlags )
376
377
local.copySymDenotation(
Original file line number Diff line number Diff line change
1
+ /** Hello fellow compiler developer.
2
+ if you are wondering why does test suite hang on this test
3
+ then it's likely that the lambda inside map has been compiled into static method
4
+ unfotrunatelly, as it is executed inside static object initializer,
5
+ it is executed inside class-loader, in a synchronized block that is not source defined.
6
+
7
+ If the lambda will be static Test$#foo, calling it through a different thread would require grabbing the
8
+ lock inside classloader. Unlike if it not static and is called through This(Test).foo, no lock is grabbed.
9
+
10
+ @DarkDimius
11
+ */
1
12
object Test extends dotty.runtime.LegacyApp {
2
13
val foos = (1 to 1000 ).toSeq
3
14
try
You can’t perform that action at this time.
0 commit comments