Do inline safepoints for watchos_arm64

Merge-request: KT-MR-6993
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
This commit is contained in:
Vladimir Sukharev
2022-09-01 08:14:41 +00:00
committed by Space
parent b801d963a1
commit 77ab69240e
4 changed files with 13 additions and 9 deletions
@@ -6212,11 +6212,11 @@ if (HostManager.@Companion.hostIsMac) {
phaseToCheck = "BitcodeOptimization" phaseToCheck = "BitcodeOptimization"
} }
fileCheckTest("filecheck_redundant_safepoints_removal_arm") { fileCheckTest("filecheck_redundant_safepoints_removal_smallbinary") {
enabled = isExperimentalMM && project.globalTestArgs.contains("-opt") enabled = isExperimentalMM && project.globalTestArgs.contains("-opt")
annotatedSource = project.file('filecheck/redundant_safepoints.kt') annotatedSource = project.file('filecheck/redundant_safepoints.kt')
targetName = "watchos_arm32" targetName = "watchos_arm32"
checkPrefix = "CHECK-ARM" checkPrefix = "CHECK-SMALLBINARY"
extraOpts = ["-Xbinary=memoryModel=experimental", "-opt"] extraOpts = ["-Xbinary=memoryModel=experimental", "-opt"]
phaseToCheck = "RemoveRedundantSafepoints" phaseToCheck = "RemoveRedundantSafepoints"
} }
@@ -6226,8 +6226,7 @@ if (HostManager.@Companion.hostIsMac) {
fileCheckTest("filecheck_redundant_safepoints_removal") { fileCheckTest("filecheck_redundant_safepoints_removal") {
enabled = isExperimentalMM && isCmsGC && enabled = isExperimentalMM && isCmsGC &&
project.globalTestArgs.contains("-opt") && project.globalTestArgs.contains("-opt") &&
project.testTarget != "watchos_arm32" && !needSmallBinary(project)
project.testTarget != "ios_arm32"
annotatedSource = project.file('filecheck/redundant_safepoints.kt') annotatedSource = project.file('filecheck/redundant_safepoints.kt')
phaseToCheck = "RemoveRedundantSafepoints" phaseToCheck = "RemoveRedundantSafepoints"
} }
@@ -16,16 +16,16 @@ fun g() = f()
@Retain @Retain
fun h(cond: Boolean): Any { fun h(cond: Boolean): Any {
// CHECK: _ZN6kotlin2mm8internal20gSuspensionRequestedE // CHECK: _ZN6kotlin2mm8internal20gSuspensionRequestedE
// CHECK-ARM: {{call .*Kotlin_mm_safePointFunctionPrologue}} // CHECK-SMALLBINARY: {{call .*Kotlin_mm_safePointFunctionPrologue}}
// CHECK-NOT: _ZN6kotlin2mm8internal20gSuspensionRequestedE // CHECK-NOT: _ZN6kotlin2mm8internal20gSuspensionRequestedE
// CHECK-NOT: {{call .*Kotlin_mm_safePointFunctionPrologue}} // CHECK-NOT: {{call .*Kotlin_mm_safePointFunctionPrologue}}
// CHECK: br // CHECK: br
// CHECK-ARM: br // CHECK-SMALLBINARY: br
if (cond) { if (cond) {
// CHECK-NOT: _ZN6kotlin2mm8internal20gSuspensionRequestedE // CHECK-NOT: _ZN6kotlin2mm8internal20gSuspensionRequestedE
// CHECK-NOT: {{call .*Kotlin_mm_safePointFunctionPrologue}} // CHECK-NOT: {{call .*Kotlin_mm_safePointFunctionPrologue}}
// CHECK: br // CHECK: br
// CHECK-ARM: br // CHECK-SMALLBINARY: br
return listOf(C(), C()) return listOf(C(), C())
} else { } else {
// CHECK-NOT: _ZN6kotlin2mm8internal20gSuspensionRequestedE // CHECK-NOT: _ZN6kotlin2mm8internal20gSuspensionRequestedE
@@ -39,7 +39,7 @@ fun h(cond: Boolean): Any {
@Retain @Retain
fun main() { fun main() {
// CHECK: _ZN6kotlin2mm8internal20gSuspensionRequestedE // CHECK: _ZN6kotlin2mm8internal20gSuspensionRequestedE
// CHECK-ARM: {{call .*Kotlin_mm_safePointFunctionPrologue}} // CHECK-SMALLBINARY: {{call .*Kotlin_mm_safePointFunctionPrologue}}
// CHECK-NOT: _ZN6kotlin2mm8internal20gSuspensionRequestedE // CHECK-NOT: _ZN6kotlin2mm8internal20gSuspensionRequestedE
// CHECK-NOT: {{call .*Kotlin_mm_safePointFunctionPrologue}} // CHECK-NOT: {{call .*Kotlin_mm_safePointFunctionPrologue}}
println(g()) println(g())
@@ -46,6 +46,11 @@ object PlatformInfo {
return getTarget(project).supportsExceptions() return getTarget(project).supportsExceptions()
} }
@JvmStatic
fun needSmallBinary(project: Project): Boolean {
return getTarget(project).needSmallBinary()
}
@JvmStatic @JvmStatic
fun supportsLibBacktrace(project: Project): Boolean { fun supportsLibBacktrace(project: Project): Boolean {
return getTarget(project).supportsLibBacktrace() return getTarget(project).supportsLibBacktrace()
@@ -137,7 +137,7 @@ fun KonanTarget.supportsUnalignedAccess(): Boolean = when (architecture) {
Architecture.X86, Architecture.ARM64, Architecture.X64 -> true Architecture.X86, Architecture.ARM64, Architecture.X64 -> true
} && this != KonanTarget.WATCHOS_ARM64 } && this != KonanTarget.WATCHOS_ARM64
fun KonanTarget.needSmallBinary() = (architecture == Architecture.ARM32 && family.isAppleFamily) || this == KonanTarget.WATCHOS_ARM64 fun KonanTarget.needSmallBinary() = (architecture == Architecture.ARM32 && family.isAppleFamily)
fun KonanTarget.supportedSanitizers(): List<SanitizerKind> = fun KonanTarget.supportedSanitizers(): List<SanitizerKind> =
when(this) { when(this) {