diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/FunctionCodegen.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/FunctionCodegen.kt index 24bfaf5740c..44e2ff2661c 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/FunctionCodegen.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/FunctionCodegen.kt @@ -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 diff --git a/compiler/testData/codegen/bytecodeListing/strictfpFlag.kt b/compiler/testData/codegen/bytecodeListing/strictfpFlag.kt new file mode 100644 index 00000000000..bba32a3de7c --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/strictfpFlag.kt @@ -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() {} +} \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeListing/strictfpFlag.txt b/compiler/testData/codegen/bytecodeListing/strictfpFlag.txt new file mode 100644 index 00000000000..d5df5cb8688 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/strictfpFlag.txt @@ -0,0 +1,61 @@ +@kotlin.Metadata +public final class C$Companion { + // source: 'strictfpFlag.kt' + private method (): void + public synthetic method (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 (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 (): void + public method (): 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 (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 +} diff --git a/compiler/testData/codegen/bytecodeListing/synchronizedFlag.kt b/compiler/testData/codegen/bytecodeListing/synchronizedFlag.kt new file mode 100644 index 00000000000..744e27b6fde --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/synchronizedFlag.kt @@ -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() {} +} \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeListing/synchronizedFlag.txt b/compiler/testData/codegen/bytecodeListing/synchronizedFlag.txt new file mode 100644 index 00000000000..21c217080e1 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/synchronizedFlag.txt @@ -0,0 +1,61 @@ +@kotlin.Metadata +public final class C$Companion { + // source: 'synchronizedFlag.kt' + private method (): void + public synthetic method (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 (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 (): void + public method (): 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 (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 +} diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java index 4a6242c1ee5..ac103ade528 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java @@ -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"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java index 62eeda4bd02..63f4250d5ac 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java @@ -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");