IR: use synchronized access when creating initial signature stub

This commit is contained in:
Georgy Bronnikov
2021-08-24 17:24:07 +03:00
committed by teamcityserver
parent cb7a59ea0e
commit 570e20696c
@@ -21,7 +21,8 @@ interface IrLazyFunctionBase : IrLazyDeclarationBase, IrTypeParametersContainer
val initialSignatureFunction: IrFunction?
fun createInitialSignatureFunction(): Lazy<IrFunction?> =
lazy(LazyThreadSafetyMode.PUBLICATION) {
// Need SYNCHRONIZED; otherwise two stubs generated in parallel may fight for the same symbol.
lazy(LazyThreadSafetyMode.SYNCHRONIZED) {
descriptor.initialSignatureDescriptor?.takeIf { it != descriptor }?.original?.let(stubGenerator::generateFunctionStub)
}