JVM_IR KT-43401 KT-43518 fix ACC_STRICT and ACC_SYNCHRONIZED flags

This commit is contained in:
Dmitry Petrov
2020-12-16 14:10:36 +03:00
parent 7ed3860c70
commit 8999fd88b1
7 changed files with 190 additions and 2 deletions
@@ -169,8 +169,8 @@ class FunctionCodegen(
isReifiable() ||
isDeprecatedHidden()
val isStrict = hasAnnotation(STRICTFP_ANNOTATION_FQ_NAME)
val isSynchronized = hasAnnotation(SYNCHRONIZED_ANNOTATION_FQ_NAME)
val isStrict = hasAnnotation(STRICTFP_ANNOTATION_FQ_NAME) && origin != JvmLoweredDeclarationOrigin.JVM_OVERLOADS_WRAPPER
val isSynchronized = hasAnnotation(SYNCHRONIZED_ANNOTATION_FQ_NAME) && origin != JvmLoweredDeclarationOrigin.JVM_OVERLOADS_WRAPPER
return getVisibilityAccessFlag() or modalityFlag or
(if (isDeprecatedFunction(context)) Opcodes.ACC_DEPRECATED else 0) or
@@ -0,0 +1,23 @@
// WITH_RUNTIME
@Strictfp
@JvmOverloads
fun testJvmOverloads(a: Int = 0) {}
class C {
@Strictfp
private fun testAccessor() {}
fun lambda() = { -> testAccessor() }
companion object {
@Strictfp
@JvmStatic
fun testJvmStatic() {}
}
}
inline class IC(val x: Int) {
@Strictfp
fun testInlineClassFun() {}
}
@@ -0,0 +1,61 @@
@kotlin.Metadata
public final class C$Companion {
// source: 'strictfpFlag.kt'
private method <init>(): void
public synthetic method <init>(p0: kotlin.jvm.internal.DefaultConstructorMarker): void
public final strict @kotlin.jvm.JvmStatic method testJvmStatic(): void
public final inner class C$Companion
}
@kotlin.Metadata
final class C$lambda$1 {
// source: 'strictfpFlag.kt'
enclosing method C.lambda()Lkotlin/jvm/functions/Function0;
synthetic final field this$0: C
inner (anonymous) class C$lambda$1
method <init>(p0: C): void
public synthetic bridge method invoke(): java.lang.Object
public final method invoke(): void
}
@kotlin.Metadata
public final class C {
// source: 'strictfpFlag.kt'
public final static @org.jetbrains.annotations.NotNull field Companion: C$Companion
inner (anonymous) class C$lambda$1
static method <clinit>(): void
public method <init>(): void
public synthetic final static method access$testAccessor(p0: C): void
public final @org.jetbrains.annotations.NotNull method lambda(): kotlin.jvm.functions.Function0
private final strict method testAccessor(): void
public final strict static @kotlin.jvm.JvmStatic method testJvmStatic(): void
public final inner class C$Companion
}
@kotlin.jvm.JvmInline
@kotlin.Metadata
public final class IC {
// source: 'strictfpFlag.kt'
private final field x: int
private synthetic method <init>(p0: int): void
public synthetic final static method box-impl(p0: int): IC
public static method constructor-impl(p0: int): int
public method equals(p0: java.lang.Object): boolean
public static method equals-impl(p0: int, p1: java.lang.Object): boolean
public final static method equals-impl0(p0: int, p1: int): boolean
public final method getX(): int
public method hashCode(): int
public static method hashCode-impl(p0: int): int
public final strict static method testInlineClassFun-impl(p0: int): void
public method toString(): java.lang.String
public static method toString-impl(p0: int): java.lang.String
public synthetic final method unbox-impl(): int
}
@kotlin.Metadata
public final class StrictfpFlagKt {
// source: 'strictfpFlag.kt'
public synthetic static method testJvmOverloads$default(p0: int, p1: int, p2: java.lang.Object): void
public final static @kotlin.jvm.JvmOverloads method testJvmOverloads(): void
public final strict static @kotlin.jvm.JvmOverloads method testJvmOverloads(p0: int): void
}
@@ -0,0 +1,23 @@
// WITH_RUNTIME
@Synchronized
@JvmOverloads
fun testJvmOverloads(a: Int = 0) {}
class C {
@Synchronized
private fun testAccessor() {}
fun lambda() = { -> testAccessor() }
companion object {
@Synchronized
@JvmStatic
fun testJvmStatic() {}
}
}
inline class IC(val x: Int) {
@Synchronized
fun testInlineClassFun() {}
}
@@ -0,0 +1,61 @@
@kotlin.Metadata
public final class C$Companion {
// source: 'synchronizedFlag.kt'
private method <init>(): void
public synthetic method <init>(p0: kotlin.jvm.internal.DefaultConstructorMarker): void
public synchronized final @kotlin.jvm.JvmStatic method testJvmStatic(): void
public final inner class C$Companion
}
@kotlin.Metadata
final class C$lambda$1 {
// source: 'synchronizedFlag.kt'
enclosing method C.lambda()Lkotlin/jvm/functions/Function0;
synthetic final field this$0: C
inner (anonymous) class C$lambda$1
method <init>(p0: C): void
public synthetic bridge method invoke(): java.lang.Object
public final method invoke(): void
}
@kotlin.Metadata
public final class C {
// source: 'synchronizedFlag.kt'
public final static @org.jetbrains.annotations.NotNull field Companion: C$Companion
inner (anonymous) class C$lambda$1
static method <clinit>(): void
public method <init>(): void
public synthetic final static method access$testAccessor(p0: C): void
public final @org.jetbrains.annotations.NotNull method lambda(): kotlin.jvm.functions.Function0
private synchronized final method testAccessor(): void
public synchronized final static @kotlin.jvm.JvmStatic method testJvmStatic(): void
public final inner class C$Companion
}
@kotlin.jvm.JvmInline
@kotlin.Metadata
public final class IC {
// source: 'synchronizedFlag.kt'
private final field x: int
private synthetic method <init>(p0: int): void
public synthetic final static method box-impl(p0: int): IC
public static method constructor-impl(p0: int): int
public method equals(p0: java.lang.Object): boolean
public static method equals-impl(p0: int, p1: java.lang.Object): boolean
public final static method equals-impl0(p0: int, p1: int): boolean
public final method getX(): int
public method hashCode(): int
public static method hashCode-impl(p0: int): int
public synchronized final static method testInlineClassFun-impl(p0: int): void
public method toString(): java.lang.String
public static method toString-impl(p0: int): java.lang.String
public synthetic final method unbox-impl(): int
}
@kotlin.Metadata
public final class SynchronizedFlagKt {
// source: 'synchronizedFlag.kt'
public synthetic static method testJvmOverloads$default(p0: int, p1: int, p2: java.lang.Object): void
public final static @kotlin.jvm.JvmOverloads method testJvmOverloads(): void
public synchronized final static @kotlin.jvm.JvmOverloads method testJvmOverloads(p0: int): void
}
@@ -214,6 +214,16 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest {
runTest("compiler/testData/codegen/bytecodeListing/rawTypeInSignature.kt");
}
@TestMetadata("strictfpFlag.kt")
public void testStrictfpFlag() throws Exception {
runTest("compiler/testData/codegen/bytecodeListing/strictfpFlag.kt");
}
@TestMetadata("synchronizedFlag.kt")
public void testSynchronizedFlag() throws Exception {
runTest("compiler/testData/codegen/bytecodeListing/synchronizedFlag.kt");
}
@TestMetadata("varargsBridge.kt")
public void testVarargsBridge() throws Exception {
runTest("compiler/testData/codegen/bytecodeListing/varargsBridge.kt");
@@ -214,6 +214,16 @@ public class IrBytecodeListingTestGenerated extends AbstractIrBytecodeListingTes
runTest("compiler/testData/codegen/bytecodeListing/rawTypeInSignature.kt");
}
@TestMetadata("strictfpFlag.kt")
public void testStrictfpFlag() throws Exception {
runTest("compiler/testData/codegen/bytecodeListing/strictfpFlag.kt");
}
@TestMetadata("synchronizedFlag.kt")
public void testSynchronizedFlag() throws Exception {
runTest("compiler/testData/codegen/bytecodeListing/synchronizedFlag.kt");
}
@TestMetadata("varargsBridge.kt")
public void testVarargsBridge() throws Exception {
runTest("compiler/testData/codegen/bytecodeListing/varargsBridge.kt");