[K/N] Replace safe points after EnterFrame to allow LLVM reemove repeated instructions

This commit is contained in:
Elena Lepilkina
2021-11-11 15:46:16 +03:00
committed by Space
parent 13e27a3e06
commit 59d74b818e
@@ -1516,12 +1516,17 @@ internal abstract class FunctionGenerationContext(
check(!forbidRuntime) { "Attempt to init runtime where runtime usage is forbidden" } check(!forbidRuntime) { "Attempt to init runtime where runtime usage is forbidden" }
call(context.llvm.initRuntimeIfNeeded, emptyList()) call(context.llvm.initRuntimeIfNeeded, emptyList())
} }
handlePrologueExperimentalMM() if (switchToRunnable) {
switchThreadState(Runnable)
}
if (needSlots || needCleanupLandingpadAndLeaveFrame) { if (needSlots || needCleanupLandingpadAndLeaveFrame) {
call(context.llvm.enterFrameFunction, listOf(slotsPhi!!, Int32(vars.skipSlots).llvm, Int32(slotCount).llvm)) call(context.llvm.enterFrameFunction, listOf(slotsPhi!!, Int32(vars.skipSlots).llvm, Int32(slotCount).llvm))
} else { } else {
check(!setCurrentFrameIsCalled) check(!setCurrentFrameIsCalled)
} }
if (context.memoryModel == MemoryModel.EXPERIMENTAL && !forbidRuntime) {
call(context.llvm.Kotlin_mm_safePointFunctionPrologue, emptyList())
}
resetDebugLocation() resetDebugLocation()
br(entryBb) br(entryBb)
} }
@@ -1575,15 +1580,6 @@ internal abstract class FunctionGenerationContext(
handleEpilogueExperimentalMM() handleEpilogueExperimentalMM()
} }
private fun handlePrologueExperimentalMM() {
if (switchToRunnable) {
switchThreadState(Runnable)
}
if (context.memoryModel == MemoryModel.EXPERIMENTAL && !forbidRuntime) {
call(context.llvm.Kotlin_mm_safePointFunctionPrologue, emptyList())
}
}
private fun handleEpilogueExperimentalMM() { private fun handleEpilogueExperimentalMM() {
if (switchToRunnable) { if (switchToRunnable) {
check(!forbidRuntime) { "Generating a bridge when runtime is forbidden" } check(!forbidRuntime) { "Generating a bridge when runtime is forbidden" }